mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
Updated TimerBar to reflect changes in ToFu
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
local AceOO = AceLibrary("AceOO-2.0")
|
local AceOO = AceLibrary("AceOO-2.0")
|
||||||
|
|
||||||
local TimerBar = AceOO.Class(IceBarElement, "AceHook-2.0", "Metrognome-2.0")
|
local TimerBar = AceOO.Class(IceBarElement, "AceHook-2.0", "Metrognome-2.0")
|
||||||
|
local abacus = nil
|
||||||
|
|
||||||
|
|
||||||
-- Constructor --
|
-- Constructor --
|
||||||
@ -27,33 +28,33 @@ function TimerBar.prototype:Enable()
|
|||||||
self.frame.bottomUpperText:SetWidth(180)
|
self.frame.bottomUpperText:SetWidth(180)
|
||||||
self.frame:Hide()
|
self.frame:Hide()
|
||||||
|
|
||||||
self:Hook(ToFu, "OnUpdate")
|
self:Hook(ToFu, "OnTextUpdate")
|
||||||
|
|
||||||
|
self:HookReport()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function TimerBar.prototype:Disable()
|
function TimerBar.prototype:Disable()
|
||||||
TimerBar.super.prototype.Disable(self)
|
TimerBar.super.prototype.Disable(self)
|
||||||
|
|
||||||
self:Unhook(ToFu, "OnUpdate")
|
self:Unhook(ToFu, "OnTextUpdate")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 'Protected' methods --------------------------------------------------------
|
-- 'Protected' methods --------------------------------------------------------
|
||||||
|
|
||||||
function TimerBar.prototype:OnUpdate(object, timeSinceLast)
|
function TimerBar.prototype:OnTextUpdate(object)
|
||||||
self.hooks[object].OnUpdate.orig(object, timeSinceLast)
|
self.hooks[object].OnTextUpdate.orig(object)
|
||||||
|
|
||||||
if (ToFu.inFlight) then
|
if (ToFu.inFlight) then
|
||||||
local flightTime = ToFu.fullData.paths[ace.char.faction][ToFu.start][ToFu.destination].time
|
if (ToFu.timeAvg ~= 0) then
|
||||||
|
local timeRemaining = ToFu.timeAvg - ToFu.timeFlown
|
||||||
if (flightTime ~= 0) then
|
|
||||||
local timeRemaining = flightTime - ToFu.timeFlown
|
|
||||||
|
|
||||||
self.frame:Show()
|
self.frame:Show()
|
||||||
self:UpdateBar(timeRemaining / flightTime, "timerFlight")
|
self:UpdateBar(timeRemaining / ToFu.timeAvg, "timerFlight")
|
||||||
--local text = string.format("%.1fs", timeRemaining)
|
|
||||||
local text = FuBarUtils.FormatDurationCondensed(timeRemaining)
|
local text = abacus:FormatDurationCondensed(timeRemaining, true)
|
||||||
self:SetBottomText1(text)
|
self:SetBottomText1(text)
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -67,5 +68,6 @@ end
|
|||||||
|
|
||||||
-- Load us up
|
-- Load us up
|
||||||
if (IsAddOnLoaded("FuBar_ToFu")) then
|
if (IsAddOnLoaded("FuBar_ToFu")) then
|
||||||
|
abacus = AceLibrary("Abacus-2.0")
|
||||||
TimerBar:new()
|
TimerBar:new()
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user