WoWInterface SVN oUF_ReadyCheck

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 3 to Rev 4
    Reverse comparison

Rev 3 → Rev 4

oUF_ReadyCheck/oUF_ReadyCheck.lua
3,28 → 3,38
Elements handled:
.ReadyCheck [texture]
 
Shared:
- delayTime [value] default: 10
- fadeTime [value] default: 1.5
 
--]]
 
local OnCheckUpdate
 
local OnFinishUpdate
do
local total = 0
local pairs = pairs
function OnCheckUpdate(self, elapsed)
total = total + elapsed
if(total >= 10) then
for k,v in ipairs(oUF.objects) do
if(type(v) == 'table' and v.ReadyCheck) then
v.ReadyCheck:Hide()
end
function OnFinishUpdate(self, elapsed)
if(self.finish) then
self.finish = self.finish - elapsed
if(self.finish <= 0) then
self.finish = nil
end
total = 0
self:SetScript('OnUpdate', nil)
else
local alpha = (15 - total) / 15
for k,v in ipairs(oUF.objects) do
if(type(v) == 'table' and v.ReadyCheck) then
v.ReadyCheck:SetAlpha(alpha)
elseif(self.fade) then
self.fade = self.fade - elapsed
if(self.fade <= 0) then
self.fade = nil
self:SetScript('OnUpdate', nil)
 
for k,v in ipairs(oUF.objects) do
if(type(v) == 'table' and v.ReadyCheck) then
v.ReadyCheck:Hide()
end
end
else
for k,v in ipairs(oUF.objects) do
if(type(v) == 'table' and v.ReadyCheck) then
v.ReadyCheck:SetAlpha(self.fade / self.offset)
end
end
end
end
end
33,37 → 43,45
local function READY_CHECK(self, event, name)
if(not IsRaidLeader() and not IsRaidOfficer() and not IsPartyLeader()) then return end
 
local icon = self.ReadyCheck
local texture = self.ReadyCheck
if(UnitName(self.unit) == name) then
icon:SetTexture([=[Interface\RAIDFRAME\ReadyCheck-Ready]=])
texture:SetTexture([=[Interface\RAIDFRAME\ReadyCheck-Ready]=])
else
icon:SetTexture([=[Interface\RAIDFRAME\ReadyCheck-Waiting]=])
texture:SetTexture([=[Interface\RAIDFRAME\ReadyCheck-Waiting]=])
end
 
icon:SetAlpha(1)
icon:Show()
texture:SetAlpha(1)
texture:Show()
end
 
local function READY_CHECK_CONFIRM(self, event, index, status)
if(self.id ~= tostring(index)) then return end
 
local texture = self.ReadyCheck
if(status and status == 1) then
icon:SetTexture([=[Interface\RAIDFRAME\ReadyCheck-Ready]=])
texture:SetTexture([=[Interface\RAIDFRAME\ReadyCheck-Ready]=])
else
icon:SetTexture([=[Interface\RAIDFRAME\ReadyCheck-NotReady]=])
texture:SetTexture([=[Interface\RAIDFRAME\ReadyCheck-NotReady]=])
end
end
 
local function READY_CHECK_FINISHED()
CreateFrame('Frame'):SetScript('OnUpdate', OnCheckUpdate)
local function READY_CHECK_FINISHED(self)
local rc = self.ReadyCheck
rc.dummy.finish = rc.delayTime or 10
rc.dummy.fade = rc.fadeTime or 1.5
rc.dummy.offset = rc.fadeTime or 1.5
rc.dummy:SetScript('OnUpdate', OnFinishUpdate)
end
 
local function Enable(self)
if(self.ReadyCheck) then
local readycheck = self.ReadyCheck
if(readycheck) then
self:RegisterEvent('READY_CHECK', READY_CHECK)
self:RegisterEvent('READY_CHECK_CONFIRM', READY_CHECK_CONFIRM)
self:RegisterEvent('READY_CHECK_FINISHED', READY_CHECK_FINISHED)
 
readycheck.dummy = CreateFrame('Frame', nil, self)
 
return true
end
end