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