Adds auras to oUF frames.
(ported from Shadowed Unit Frames AuraTracker by Proditor)
example
Code:
-- update
local function updateAuraTrackerTime(self, elapsed)
if (self.active) then
self.timeleft = self.timeleft - elapsed
if (self.timeleft <= 5) then
self.text:SetTextColor(1, 0, 0) -- red
else
self.text:SetTextColor(1, 1, 1) -- white
end
if (self.timeleft <= 0) then
self.icon:SetTexture("")
self.text:SetText("")
end
self.text:SetFormattedText("%.1f", self.timeleft)
end
end
-- layout
self.Portrait = CreateFrame("PlayerModel", nil, self)
self.Portrait:SetWidth(32)
self.Portrait:SetHeight(32)
self.Portrait:SetPoint("BOTTOMRIGHT", self, "BOTTOMLEFT", -3, 0)
self.Portrait.type = "3D"
self.Portrait.bg = CreateFrame("Frame", nil, self)
self.Portrait.bg:SetFrameStrata('BACKGROUND')
self.Portrait.bg:SetWidth(self.Portrait:GetWidth())
self.Portrait.bg:SetHeight(self.Portrait:GetHeight())
self.Portrait.bg:SetPoint("CENTER", self.Portrait)
self.Portrait.bg:SetBackdrop(backdrop)
self.Portrait.bg:SetBackdropColor(0,0,0,.6)
-- Aura Tracker
self.AuraTracker = CreateFrame("Frame", nil, self)
self.AuraTracker:SetWidth(self.Portrait:GetWidth())
self.AuraTracker:SetHeight(self.Portrait:GetHeight())
self.AuraTracker:SetPoint("CENTER", self.Portrait, "CENTER")
self.AuraTracker:SetFrameStrata("HIGH")
self.AuraTracker.icon = self.AuraTracker:CreateTexture(nil, "ARTWORK")
self.AuraTracker.icon:SetWidth(self.Portrait:GetWidth()+1)
self.AuraTracker.icon:SetHeight(self.Portrait:GetHeight()+1)
self.AuraTracker.icon:SetPoint("CENTER", self.Portrait, "CENTER")
self.AuraTracker.icon:SetTexCoord(0.07,0.93,0.07,0.93)
self.AuraTracker.text = self.AuraTracker:CreateFontString(nil, 'OVERLAY', 'NumberFontNormal')
self.AuraTracker.text:SetPoint('CENTER', self.AuraTracker, 0, 0)
self.AuraTracker:SetScript("OnUpdate", updateAuraTrackerTime)