mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-29 18:56:02 +00:00
cooldown: read variables to hide text or animation
This commit is contained in:
+26
-17
@@ -27,23 +27,23 @@ pfUI:RegisterModule("cooldown", "vanilla:tbc", function ()
|
||||
end
|
||||
|
||||
local function pfCreateCoolDown(cooldown, start, duration)
|
||||
cooldown.cd = CreateFrame("Frame", "pfCooldownFrame", cooldown:GetParent())
|
||||
cooldown.cd:SetAllPoints(cooldown:GetParent())
|
||||
cooldown.cd:SetFrameLevel(cooldown.cd:GetFrameLevel() + 1)
|
||||
cooldown.pfCooldownText = CreateFrame("Frame", "pfCooldownFrame", cooldown:GetParent())
|
||||
cooldown.pfCooldownText:SetAllPoints(cooldown:GetParent())
|
||||
cooldown.pfCooldownText:SetFrameLevel(cooldown:GetParent():GetFrameLevel() + 1)
|
||||
|
||||
cooldown.cd.text = cooldown.cd:CreateFontString("pfCooldownFrameText", "OVERLAY")
|
||||
cooldown.pfCooldownText.text = cooldown.pfCooldownText:CreateFontString("pfCooldownFrameText", "OVERLAY")
|
||||
if not cooldown.pfCooldownType then
|
||||
cooldown.cd.text:SetFont(pfUI.font_unit, C.appearance.cd.font_size_foreign, "OUTLINE")
|
||||
cooldown.pfCooldownText.text:SetFont(pfUI.font_unit, C.appearance.cd.font_size_foreign, "OUTLINE")
|
||||
elseif cooldown.pfCooldownType == "BLIZZARD" then
|
||||
cooldown.cd.text:SetFont(pfUI.font_unit, C.appearance.cd.font_size_blizz, "OUTLINE")
|
||||
cooldown.pfCooldownText.text:SetFont(pfUI.font_unit, C.appearance.cd.font_size_blizz, "OUTLINE")
|
||||
elseif cooldown.pfCooldownSize then
|
||||
cooldown.cd.text:SetFont(pfUI.font_unit, cooldown.pfCooldownSize, "OUTLINE")
|
||||
cooldown.pfCooldownText.text:SetFont(pfUI.font_unit, cooldown.pfCooldownSize, "OUTLINE")
|
||||
else
|
||||
cooldown.cd.text:SetFont(pfUI.font_unit, C.appearance.cd.font_size, "OUTLINE")
|
||||
cooldown.pfCooldownText.text:SetFont(pfUI.font_unit, C.appearance.cd.font_size, "OUTLINE")
|
||||
end
|
||||
|
||||
cooldown.cd.text:SetPoint("CENTER", cooldown.cd, "CENTER", 0, 0)
|
||||
cooldown.cd:SetScript("OnUpdate", pfCooldownOnUpdate)
|
||||
cooldown.pfCooldownText.text:SetPoint("CENTER", cooldown.pfCooldownText, "CENTER", 0, 0)
|
||||
cooldown.pfCooldownText:SetScript("OnUpdate", pfCooldownOnUpdate)
|
||||
end
|
||||
|
||||
-- hook
|
||||
@@ -66,16 +66,25 @@ pfUI:RegisterModule("cooldown", "vanilla:tbc", function ()
|
||||
return
|
||||
end
|
||||
|
||||
-- hide animation
|
||||
if this.pfCooldownStyleAnimation == 0 then
|
||||
this:SetAlpha(0)
|
||||
else
|
||||
this:SetAlpha(1)
|
||||
end
|
||||
|
||||
-- print time as text on cooldown frames
|
||||
if start > 0 and duration > 0 and (not enable or enable > 0) then
|
||||
if( not this.cd ) then
|
||||
if ( not this.pfCooldownStyleText or this.pfCooldownStyleText == 1)
|
||||
and start > 0 and duration > 0 and (not enable or enable > 0) then
|
||||
if( not this.pfCooldownText ) then
|
||||
pfCreateCoolDown(this, start, duration)
|
||||
end
|
||||
this.cd.start = start
|
||||
this.cd.duration = duration
|
||||
this.cd:Show()
|
||||
elseif(this.cd) then
|
||||
this.cd:Hide()
|
||||
|
||||
this.pfCooldownText.start = start
|
||||
this.pfCooldownText.duration = duration
|
||||
this.pfCooldownText:Show()
|
||||
elseif(this.pfCooldownText) then
|
||||
this.pfCooldownText:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user