/Tukui/modules/unitframes/core/oUF/elements/picon.lua
http://github.com/Asphyxia/Tukui · Lua · 46 lines · 39 code · 7 blank · 0 comment · 5 complexity · fbb049f86c66349172e0dcd5097d0549 MD5 · raw file
- local parent, ns = ...
- local oUF = ns.oUF
- local Update = function(self, event)
- local inPhase = UnitInPhase(self.unit)
- local picon = self.PhaseIcon
- if(inPhase) then
- picon:Hide()
- else
- picon:Show()
- end
- end
- local Path = function(self, ...)
- return (self.PhaseIcon.Override or Update) (self, ...)
- end
- local ForceUpdate = function(element)
- return Path(element.__owner, 'ForceUpdate')
- end
- local Enable = function(self)
- local picon = self.PhaseIcon
- if(picon) then
- picon.__owner = self
- picon.ForceUpdate = ForceUpdate
- self:RegisterEvent('UNIT_PHASE', Path)
- if(picon:IsObjectType'Texture' and not picon:GetTexture()) then
- picon:SetTexture[[Interface\TargetingFrame\UI-PhasingIcon]]
- end
- return true
- end
- end
- local Disable = function(self)
- local picon = self.PhaseIcon
- if(picon) then
- self:UnregisterEvent('UNIT_PHASE', Path)
- end
- end
- oUF:AddElement('PhaseIcon', Path, Enable, Disable)