infight: modernize and add instant updates

This commit is contained in:
shagu
2020-06-15 17:14:43 +02:00
parent 81610f18dd
commit d79b05e85e
2 changed files with 36 additions and 36 deletions
+1 -1
View File
@@ -1451,7 +1451,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["Bags Border Size"], C.appearance.border, "bags", "dropdown", pfUI.gui.dropdowns.border)
CreateConfig(U["nameplates"], T["Nameplate Border Size"], C.appearance.border, "nameplates", "dropdown", pfUI.gui.dropdowns.border)
CreateConfig(nil) -- spacer
CreateConfig(nil, T["Enable Combat Glow Effects On Screen Edges"], C.appearance.infight, "screen", "checkbox")
CreateConfig(U["infight"], T["Enable Combat Glow Effects On Screen Edges"], C.appearance.infight, "screen", "checkbox")
end)
CreateGUIEntry(T["Settings"], T["Cooldown"], function()
+35 -35
View File
@@ -1,42 +1,42 @@
pfUI:RegisterModule("infight", "vanilla:tbc", function ()
-- build the frame
pfUI.infight = CreateFrame("Frame", "pfUICombat", UIParent)
local function OnUpdate()
if this.mode == 0 then return end
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + .1 end
pfUI.infight.backdrop = {
edgeFile = pfUI.media["img:glow"], edgeSize = 8,
insets = {left = 0, right = 0, top = 0, bottom = 0},
}
if not this.fadeValue then this.fadeValue = 1 end
if this.fadeValue >= 0.3 then
this.fadeModifier = -0.1
end
if this.fadeValue <= 0 then
this.fadeModifier = 0.1
end
this.fadeValue = this.fadeValue + this.fadeModifier
pfUI.infight:SetScript("OnUpdate",function(s,e)
if not pfUI.infight.clock then pfUI.infight.clock = GetTime() -0.1 end
if GetTime() >= pfUI.infight.clock + 0.1 then
pfUI.infight.clock = GetTime()
if not pfUI.infight.fadeValue then pfUI.infight.fadeValue = 1 end
if pfUI.infight.fadeValue >= 0.3 then
pfUI.infight.fadeModifier = -0.1
end
if pfUI.infight.fadeValue <= 0 then
pfUI.infight.fadeModifier = 0.1
end
pfUI.infight.fadeValue = pfUI.infight.fadeValue + pfUI.infight.fadeModifier
if C.appearance.infight.screen == "1" and pfUI.infight.screen then
if UnitAffectingCombat("player") then
pfUI.infight.screen:Show()
pfUI.infight.screen:SetBackdropBorderColor(1,0.2+pfUI.infight.fadeValue, pfUI.infight.fadeValue, 1-pfUI.infight.fadeValue);
else
pfUI.infight.screen:Hide()
end
if C.appearance.infight.screen == "1" and this.screen then
if UnitAffectingCombat("player") then
this.screen:Show()
this.screen:SetBackdropBorderColor(1,0.2+this.fadeValue, this.fadeValue, 1-this.fadeValue);
else
this.screen:Hide()
end
end
end)
if C.appearance.infight.screen == "1" then
pfUI.infight.screen = CreateFrame("Frame", "pfUICombatScreen", UIParent)
pfUI.infight.screen:SetFrameStrata("BACKGROUND")
pfUI.infight.screen:SetBackdrop(pfUI.infight.backdrop)
pfUI.infight.screen:SetAllPoints(WorldFrame)
pfUI.infight.screen:Hide()
end
pfUI.infight = CreateFrame("Frame", "pfUICombat", UIParent)
pfUI.infight:SetScript("OnUpdate", OnUpdate)
pfUI.infight.screen = CreateFrame("Frame", "pfUICombatScreen", UIParent)
pfUI.infight.screen:SetFrameStrata("BACKGROUND")
pfUI.infight.screen:SetAllPoints(WorldFrame)
pfUI.infight.screen:SetBackdrop({
edgeFile = pfUI.media["img:glow"], edgeSize = 8,
insets = {left = 0, right = 0, top = 0, bottom = 0},
})
pfUI.infight.screen:Hide()
pfUI.infight.UpdateConfig = function(self)
pfUI.infight.mode = tonumber(C.appearance.infight.screen)
end
pfUI.infight.UpdateConfig()
end)