From 96ce26eee9ca261bcab0fb1244ebe8878ad70f94 Mon Sep 17 00:00:00 2001 From: Tuller Date: Sat, 28 Aug 2010 16:28:10 -0400 Subject: [PATCH 1/4] toc & version bump for cata --- tullaCC/tullaCC.toc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tullaCC/tullaCC.toc b/tullaCC/tullaCC.toc index ebf7fbd..d9c6ca7 100644 --- a/tullaCC/tullaCC.toc +++ b/tullaCC/tullaCC.toc @@ -1,6 +1,6 @@ -## Interface: 30300 +## Interface: 40000 ## Title: tullaCooldownCount ## Notes: Adds text to cooldowns ## Author: Tuller -## Version: 1.4 +## Version: 2.0 cc.lua \ No newline at end of file -- 1.7.9.5 From a6a7c1307f723f8cf5fc606ddd4a4214be5162ef Mon Sep 17 00:00:00 2001 From: Tuller Date: Mon, 6 Sep 2010 16:21:47 -0400 Subject: [PATCH 2/4] updated deploy script --- deploy.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy.sh b/deploy.sh index 80246be..64d6d2d 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,8 +1,8 @@ #!/bin/sh -rm -rf "${WOW_ADDON_DIR}tullaCC" +rm -rf "${WOW_BETA_ADDON_DIR}tullaCC" -cp -r tullaCC "${WOW_ADDON_DIR}" +cp -r tullaCC "${WOW_BETA_ADDON_DIR}" -cp LICENSE "${WOW_ADDON_DIR}tullaCC" -cp README "${WOW_ADDON_DIR}tullaCC" \ No newline at end of file +cp LICENSE "${WOW_BETA_ADDON_DIR}tullaCC" +cp README "${WOW_BETA_ADDON_DIR}tullaCC" \ No newline at end of file -- 1.7.9.5 From 768410d3b8e6d479afb42cd96b91990d35fe6dbd Mon Sep 17 00:00:00 2001 From: Jason Greer Date: Wed, 29 Sep 2010 16:07:38 -0700 Subject: [PATCH 3/4] cleaned up comments a bit --- tullaCC/config.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tullaCC/config.lua b/tullaCC/config.lua index d058272..47cf6b7 100644 --- a/tullaCC/config.lua +++ b/tullaCC/config.lua @@ -10,9 +10,9 @@ C.fontFace = STANDARD_TEXT_FONT --what font to use C.fontSize = 18 --the base font size to use at a scale of 1 --display settings -C.minScale = 0.6 --the minimum duration to show cooldown text for -C.minDuration = 3 --the minimum number of seconds a cooldown must be to use to display in the expiring format -C.expiringDuration = 5 --the minimum number of seconds a cooldown must be to use to display in the expiring format +C.minScale = 0.6 --the minimum scale we want to show cooldown counts at, anything below this will be hidden +C.minDuration = 3 --the minimum number of seconds a cooldown's duration must be to display text +C.expiringDuration = 5 --the minimum number of seconds a cooldown must be to display in the expiring format --text format strings C.expiringFormat = '|cffff0000%d|r' --format for timers that are soon to expire -- 1.7.9.5 From 3619f32647205e6b076c4ab01a7ba41fec67c453 Mon Sep 17 00:00:00 2001 From: Tuller Date: Sun, 10 Oct 2010 16:37:17 -0400 Subject: [PATCH 4/4] replaced OnUpdate timers with the animation system --- tullaCC/cc.lua | 63 +++++++++++++++++++++++++++++++-------------------- tullaCC/tullaCC.toc | 2 +- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/tullaCC/cc.lua b/tullaCC/cc.lua index 2ab0bb3..cc42b70 100644 --- a/tullaCC/cc.lua +++ b/tullaCC/cc.lua @@ -54,15 +54,43 @@ local function getTimeText(s) end end + +local function Timer_SetNextUpdate(self, nextUpdate) + self.updater:GetAnimations():SetDuration(nextUpdate) + if self.updater:IsPlaying() then + self.updater:Stop() + end + self.updater:Play() +end + --stops the timer local function Timer_Stop(self) self.enabled = nil + if self.updater:IsPlaying() then + self.updater:Stop() + end self:Hide() end +local function Timer_UpdateText(self) + local remain = self.duration - (GetTime() - self.start) + if round(remain) > 0 then + if (self.fontScale * self:GetEffectiveScale() / UIParent:GetScale()) < MIN_SCALE then + self.text:SetText('') + Timer_SetNextUpdate(self, 1) + else + local formatStr, time, nextUpdate = getTimeText(remain) + self.text:SetFormattedText(formatStr, time) + Timer_SetNextUpdate(self, nextUpdate) + end + else + Timer_Stop(self) + end +end + --forces the given timer to update on the next frame local function Timer_ForceUpdate(self) - self.nextUpdate = 0 + Timer_UpdateText(self) self:Show() end @@ -87,28 +115,6 @@ local function Timer_OnSizeChanged(self, width, height) end end ---update timer text, if it needs to be ---hide the timer if done -local function Timer_OnUpdate(self, elapsed) - if self.nextUpdate > 0 then - self.nextUpdate = self.nextUpdate - elapsed - else - local remain = self.duration - (GetTime() - self.start) - if round(remain) > 0 then - if (self.fontScale * self:GetEffectiveScale() / UIParent:GetScale()) < MIN_SCALE then - self.text:SetText('') - self.nextUpdate = 1 - else - local formatStr, time, nextUpdate = getTimeText(remain) - self.text:SetFormattedText(formatStr, time) - self.nextUpdate = nextUpdate - end - else - Timer_Stop(self) - end - end -end - --returns a new timer object local function Timer_Create(cd) --a frame to watch for OnSizeChanged events @@ -118,10 +124,17 @@ local function Timer_Create(cd) local timer = CreateFrame('Frame', nil, scaler); timer:Hide() timer:SetAllPoints(scaler) - timer:SetScript('OnUpdate', Timer_OnUpdate) + + local updater = timer:CreateAnimationGroup() + updater:SetLooping('NONE') + updater:SetScript('OnFinished', function(self) Timer_UpdateText(timer) end) + + local a = updater:CreateAnimation('Animation'); a:SetOrder(1) + timer.updater = updater local text = timer:CreateFontString(nil, 'OVERLAY') text:SetPoint('CENTER', 0, 0) + text:SetFont(FONT_FACE, FONT_SIZE, 'OUTLINE') timer.text = text Timer_OnSizeChanged(timer, scaler:GetSize()) @@ -141,7 +154,7 @@ hooksecurefunc(getmetatable(ActionButton1Cooldown).__index, 'SetCooldown', funct timer.start = start timer.duration = duration timer.enabled = true - timer.nextUpdate = 0 + Timer_UpdateText(timer) if timer.fontScale >= MIN_SCALE then timer:Show() end --stop timer else diff --git a/tullaCC/tullaCC.toc b/tullaCC/tullaCC.toc index dd7444e..978cb8b 100644 --- a/tullaCC/tullaCC.toc +++ b/tullaCC/tullaCC.toc @@ -2,6 +2,6 @@ ## Title: tullaCooldownCount ## Notes: Adds text to cooldowns ## Author: Tuller -## Version: 2.0 +## Version: 2.1 config.lua cc.lua \ No newline at end of file -- 1.7.9.5