merged cata changes
Tuller [10-13-10 - 01:09]
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
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/config.lua b/tullaCC/config.lua
index 39cc5d5..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 size ratio of an object relative to an action button for a cooldown text to display.
-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
diff --git a/tullaCC/tullaCC.toc b/tullaCC/tullaCC.toc
index eb323c1..978cb8b 100644
--- a/tullaCC/tullaCC.toc
+++ b/tullaCC/tullaCC.toc
@@ -1,7 +1,7 @@
-## Interface: 30300
+## Interface: 40000
## Title: tullaCooldownCount
## Notes: Adds text to cooldowns
## Author: Tuller
-## Version: 1.5
+## Version: 2.1
config.lua
cc.lua
\ No newline at end of file