PK>ߟOmniCC/aniUpdater.lua--[[ An animation sytem based timer thingy --]] local Classy = LibStub('Classy-1.0') local OmniCC = OmniCC local AniUpdater = Classy:New('Frame'); OmniCC.AniUpdater = AniUpdater local updaters = setmetatable({}, {__index = function(self, frame) local updater = AniUpdater:New(frame) self[frame] = updater return updater end}) function AniUpdater:Get(frame) -- print('AniUpdater:Get', frame) return updaters[frame] end function AniUpdater:GetActive(frame) -- print('AniUpdater:GetActive', frame) return rawget(updaters, frame) end local animation_OnFinished = function(self) self:GetParent():OnFinished() end function AniUpdater:New(frame) -- print('AniUpdater:New', frame) local updater = self:Bind(CreateFrame('Frame', nil)); updater:Hide() updater.frame = frame local aniGroup = updater:CreateAnimationGroup() aniGroup:SetLooping('NONE') aniGroup:SetScript('OnFinished', animation_OnFinished) updater.aniGroup = aniGroup local ani = aniGroup:CreateAnimation('Animation') ani:SetOrder(1) updater.ani = ani return updater end function AniUpdater:StopAnimation() -- print('AniUpdater:StopAnimation') if self.aniGroup:IsPlaying() then self.aniGroup:Stop() end end function AniUpdater:ScheduleUpdate(delay) -- print('AniUpdater:ScheduleUpdate', delay) self:StopAnimation() if delay > 0 then self:Show() self.ani:SetDuration(delay) self.aniGroup:Play() else self:OnFinished() end end function AniUpdater:CancelUpdate() -- print('AniUpdater:CancelUpdate') self:StopAnimation() self:Hide() end function AniUpdater:OnFinished() -- print('AniUpdater:OnFinished') self:Hide() self.frame:OnScheduledUpdate() endPK>dLOmniCC/classicUpdater.lua--[[ An OnUpdate sytem based timer thingy --]] local OmniCC = OmniCC local Classy = LibStub('Classy-1.0') local ClassicUpdater = Classy:New('Frame'); OmniCC.ClassicUpdater = ClassicUpdater local updaters = setmetatable({}, {__index = function(self, frame) local updater = ClassicUpdater:New(frame) self[frame] = updater return updater end}) --[[ Updater Retrieval ]]-- function ClassicUpdater:Get(frame) -- print('ClassicUpdater:Get', frame) return updaters[frame] end function ClassicUpdater:GetActive(frame) -- print('ClassicUpdater:GetActive', frame) return rawget(updaters, frame) end function ClassicUpdater:New(frame) -- print('ClassicUpdater:New', count, frame) local updater = self:Bind(CreateFrame('Frame', nil)); updater:Hide() updater:SetScript('OnUpdate', updater.OnUpdate) updater.frame = frame return updater end --[[ Updater Events ]]-- function ClassicUpdater:OnUpdate(elapsed) -- print('ClassicUpdater:OnUpdate', elapsed) local delay = self.delay - elapsed if delay > 0 then self.delay = delay else self:OnFinished() end end function ClassicUpdater:OnFinished() -- print('ClassicUpdater:OnFinished') self:Cleanup() self.frame:OnScheduledUpdate() end --[[ Updater Updating ]]-- function ClassicUpdater:ScheduleUpdate(delay) -- print('ClassicUpdater:ScheduleUpdate', delay) if delay > 0 then self.delay = delay self:Show() else self:OnFinished() end end function ClassicUpdater:CancelUpdate() -- print('ClassicUpdater:CancelUpdate') self:Cleanup() end function ClassicUpdater:Cleanup() -- print('ClassicUpdater:Cleanup') self:Hide() self.delay = nil endPK>S;jOmniCC/embeds.xml