mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 22:51:53 -05:00
Version 0.3
- More configuration options - Added another texture option for bars - /icehud now opens Dewdrop menu directly - Rogue/cat energy ticker
This commit is contained in:
70
modules/TimerBar.lua
Normal file
70
modules/TimerBar.lua
Normal file
@ -0,0 +1,70 @@
|
||||
local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local TimerBar = AceOO.Class(IceBarElement, "AceHook-2.0", "Metrognome-2.0")
|
||||
|
||||
|
||||
-- Constructor --
|
||||
function TimerBar.prototype:init()
|
||||
TimerBar.super.prototype.init(self, "TimerBar")
|
||||
|
||||
self:SetColor("timerFlight", 0.2, 0.7, 0.7)
|
||||
end
|
||||
|
||||
|
||||
-- 'Public' methods -----------------------------------------------------------
|
||||
|
||||
function TimerBar.prototype:GetDefaultSettings()
|
||||
local settings = TimerBar.super.prototype.GetDefaultSettings(self)
|
||||
settings["side"] = IceCore.Side.Left
|
||||
settings["offset"] = 0
|
||||
return settings
|
||||
end
|
||||
|
||||
|
||||
function TimerBar.prototype:Enable()
|
||||
TimerBar.super.prototype.Enable(self)
|
||||
|
||||
self.frame.bottomUpperText:SetWidth(180)
|
||||
self.frame:Hide()
|
||||
|
||||
self:Hook(ToFu, "OnUpdate")
|
||||
end
|
||||
|
||||
|
||||
function TimerBar.prototype:Disable()
|
||||
TimerBar.super.prototype.Disable(self)
|
||||
|
||||
self:Unhook(ToFu, "OnUpdate")
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- 'Protected' methods --------------------------------------------------------
|
||||
|
||||
|
||||
function TimerBar.prototype:OnUpdate(object, timeSinceLast)
|
||||
self.hooks[object].OnUpdate.orig(object, timeSinceLast)
|
||||
|
||||
if (ToFu.inFlight) then
|
||||
local flightTime = ToFu.fullData.paths[ace.char.faction][ToFu.start][ToFu.destination].time
|
||||
|
||||
if (flightTime ~= 0) then
|
||||
local timeRemaining = flightTime - ToFu.timeFlown
|
||||
|
||||
self.frame:Show()
|
||||
self:UpdateBar(timeRemaining / flightTime, "timerFlight")
|
||||
--local text = string.format("%.1fs", timeRemaining)
|
||||
local text = FuBarUtils.FormatDurationCondensed(timeRemaining)
|
||||
self:SetBottomText1(text)
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
self.frame:Hide()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- Load us up
|
||||
TimerBar:new()
|
Reference in New Issue
Block a user