ArenaCountDown update

This commit is contained in:
Sumsebrum 2021-08-10 13:17:46 +02:00
parent 237130e3ce
commit a7cdacb55d
13 changed files with 26 additions and 21 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Images/Countdown/Horde.blp Normal file

Binary file not shown.

View File

@ -21,33 +21,34 @@ function ACDFrame:Initialize()
local ACDNumFrame = CreateFrame("Frame", "ACDNumFrame", UIParent) local ACDNumFrame = CreateFrame("Frame", "ACDNumFrame", UIParent)
ACDNumFrame:EnableMouse(false) ACDNumFrame:EnableMouse(false)
ACDNumFrame:SetHeight(256) ACDNumFrame:SetHeight(512)
ACDNumFrame:SetWidth(256) ACDNumFrame:SetWidth(512)
ACDNumFrame:SetPoint("CENTER", 0, 128) ACDNumFrame:SetPoint("CENTER", 0, 256)
ACDNumFrame:Show() ACDNumFrame:Show()
self.ACDNumFrame = ACDNumFrame self.ACDNumFrame = ACDNumFrame
local ACDNumTens = ACDNumFrame:CreateTexture("ACDNumTens", "HIGH") local ACDNumTens = ACDNumFrame:CreateTexture("ACDNumTens", "HIGH")
ACDNumTens:SetWidth(256) ACDNumTens:SetWidth(256)
ACDNumTens:SetHeight(128) ACDNumTens:SetHeight(256)
ACDNumTens:SetPoint("CENTER", ACDNumFrame, "CENTER", -48, 0) ACDNumTens:SetPoint("CENTER", ACDNumFrame, "CENTER", -48, 0)
self.ACDNumTens = ACDNumTens self.ACDNumTens = ACDNumTens
local ACDNumOnes = ACDNumFrame:CreateTexture("ACDNumOnes", "HIGH") local ACDNumOnes = ACDNumFrame:CreateTexture("ACDNumOnes", "HIGH")
ACDNumOnes:SetWidth(256) ACDNumOnes:SetWidth(256)
ACDNumOnes:SetHeight(128) ACDNumOnes:SetHeight(256)
ACDNumOnes:SetPoint("CENTER", ACDNumFrame, "CENTER", 48, 0) ACDNumOnes:SetPoint("CENTER", ACDNumFrame, "CENTER", 48, 0)
self.ACDNumOnes = ACDNumOnes self.ACDNumOnes = ACDNumOnes
local ACDNumOne = ACDNumFrame:CreateTexture("ACDNumOne", "HIGH") local ACDNumOne = ACDNumFrame:CreateTexture("ACDNumOne", "HIGH")
ACDNumOne:SetWidth(256) ACDNumOne:SetWidth(256)
ACDNumOne:SetHeight(128) ACDNumOne:SetHeight(256)
ACDNumOne:SetPoint("CENTER", ACDNumFrame, "CENTER", 0, 0) ACDNumOne:SetPoint("CENTER", ACDNumFrame, "CENTER", 0, 0)
self.ACDNumOne = ACDNumOne self.ACDNumOne = ACDNumOne
self:RegisterMessage("JOINED_ARENA") self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_SPOTTED") self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("UNIT_SPEC") self:RegisterMessage("UNIT_SPEC")
self.faction = UnitFactionGroup("player")
end end
function ACDFrame.OnUpdate(self, elapse) function ACDFrame.OnUpdate(self, elapse)
@ -57,11 +58,7 @@ function ACDFrame.OnUpdate(self, elapse)
if ((floor(self.countdown) ~= floor(self.countdown - elapse)) and (floor(self.countdown - elapse) >= 0)) then if ((floor(self.countdown) ~= floor(self.countdown - elapse)) and (floor(self.countdown - elapse) >= 0)) then
local str = tostring(floor(self.countdown - elapse)); local str = tostring(floor(self.countdown - elapse));
if (floor(self.countdown - elapse) == 0) then if (str_len(str) == 2) then
self.ACDNumTens:Hide();
self.ACDNumOnes:Hide();
self.ACDNumOne:Hide();
elseif (str_len(str) == 2) then
-- Display has 2 digits -- Display has 2 digits
self.ACDNumOne:Hide(); self.ACDNumOne:Hide();
self.ACDNumTens:Show(); self.ACDNumTens:Show();
@ -72,8 +69,10 @@ function ACDFrame.OnUpdate(self, elapse)
self.ACDNumFrame:SetScale(0.7) self.ACDNumFrame:SetScale(0.7)
elseif (str_len(str) == 1) then elseif (str_len(str) == 1) then
-- Display has 1 digit -- Display has 1 digit
local numStr = str_sub(str, 0, 1)
local path = numStr == "0" and self.faction or numStr
self.ACDNumOne:Show(); self.ACDNumOne:Show();
self.ACDNumOne:SetTexture(self.texturePath .. str_sub(str, 0, 1)); self.ACDNumOne:SetTexture(self.texturePath .. path);
self.ACDNumOnes:Hide(); self.ACDNumOnes:Hide();
self.ACDNumTens:Hide(); self.ACDNumTens:Hide();
self.ACDNumFrame:SetScale(1.0) self.ACDNumFrame:SetScale(1.0)
@ -92,18 +91,24 @@ function ACDFrame.OnUpdate(self, elapse)
end end
function ACDFrame:JOINED_ARENA() function ACDFrame:JOINED_ARENA()
if Gladdy.db.countdown then
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL") self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
self:SetScript("OnEvent", ACDFrame.OnEvent) self:SetScript("OnEvent", ACDFrame.OnEvent)
self.endTime = GetTime() + 70 self.endTime = GetTime() + 70
self:SetScript("OnUpdate", ACDFrame.OnUpdate) self:SetScript("OnUpdate", ACDFrame.OnUpdate)
end
end end
function ACDFrame:ENEMY_SPOTTED() function ACDFrame:ENEMY_SPOTTED()
if not Gladdy.frame.testing then
ACDFrame:Reset() ACDFrame:Reset()
end
end end
function ACDFrame:UNIT_SPEC() function ACDFrame:UNIT_SPEC()
if not Gladdy.frame.testing then
ACDFrame:Reset() ACDFrame:Reset()
end
end end
function ACDFrame:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg) function ACDFrame:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
@ -124,15 +129,15 @@ function ACDFrame:UpdateFrame()
self.ACDNumFrame:SetPoint("CENTER", 0, 128) self.ACDNumFrame:SetPoint("CENTER", 0, 128)
self.ACDNumTens:SetWidth(Gladdy.db.arenaCountdownSize) self.ACDNumTens:SetWidth(Gladdy.db.arenaCountdownSize)
self.ACDNumTens:SetHeight(Gladdy.db.arenaCountdownSize/2) self.ACDNumTens:SetHeight(Gladdy.db.arenaCountdownSize)
self.ACDNumTens:SetPoint("CENTER", self.ACDNumFrame, "CENTER", -(Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0) self.ACDNumTens:SetPoint("CENTER", self.ACDNumFrame, "CENTER", -(Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
self.ACDNumOnes:SetWidth(Gladdy.db.arenaCountdownSize) self.ACDNumOnes:SetWidth(Gladdy.db.arenaCountdownSize)
self.ACDNumOnes:SetHeight(Gladdy.db.arenaCountdownSize/2) self.ACDNumOnes:SetHeight(Gladdy.db.arenaCountdownSize)
self.ACDNumOnes:SetPoint("CENTER", self.ACDNumFrame, "CENTER", (Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0) self.ACDNumOnes:SetPoint("CENTER", self.ACDNumFrame, "CENTER", (Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
self.ACDNumOne:SetWidth(Gladdy.db.arenaCountdownSize) self.ACDNumOne:SetWidth(Gladdy.db.arenaCountdownSize)
self.ACDNumOne:SetHeight(Gladdy.db.arenaCountdownSize/2) self.ACDNumOne:SetHeight(Gladdy.db.arenaCountdownSize)
self.ACDNumOne:SetPoint("CENTER", self.ACDNumFrame, "CENTER", 0, 0) self.ACDNumOne:SetPoint("CENTER", self.ACDNumFrame, "CENTER", 0, 0)
end end