Progress on aura bars

This commit is contained in:
Logan Payton
2018-05-16 18:34:42 -04:00
parent 315be29774
commit 97c5248058
2 changed files with 25 additions and 24 deletions
+14 -13
View File
@@ -69,8 +69,8 @@ local function CreateAuraBar(oUF, anchor)
local auraBarParent = oUF.AuraBars local auraBarParent = oUF.AuraBars
local frame = CreateFrame("Frame", nil, auraBarParent) local frame = CreateFrame("Frame", nil, auraBarParent)
frame:Height(auraBarParent.auraBarHeight or 20) frame:SetHeight(auraBarParent.auraBarHeight or 20)
frame:Width((auraBarParent.auraBarWidth or auraBarParent:GetWidth()) - (frame:GetHeight() + (auraBarParent.gap or 0))) frame:SetWidth((auraBarParent.auraBarWidth or auraBarParent:GetWidth()) - (frame:GetHeight() + (auraBarParent.gap or 0)))
frame.anchor = anchor frame.anchor = anchor
-- the main bar -- the main bar
@@ -97,7 +97,7 @@ local function CreateAuraBar(oUF, anchor)
local spark = statusBar:CreateTexture(nil, "OVERLAY", nil) local spark = statusBar:CreateTexture(nil, "OVERLAY", nil)
spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]]) spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]])
spark:Width(12) spark:SetWidth(12)
spark:SetBlendMode("ADD") spark:SetBlendMode("ADD")
spark:SetPoint("CENTER", statusBar:GetStatusBarTexture(), "RIGHT") spark:SetPoint("CENTER", statusBar:GetStatusBarTexture(), "RIGHT")
statusBar.spark = spark statusBar.spark = spark
@@ -121,10 +121,10 @@ local function CreateAuraBar(oUF, anchor)
else else
statusBar.spelltime:SetFont(auraBarParent.spellTimeFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.spellTimeSize or 10) statusBar.spelltime:SetFont(auraBarParent.spellTimeFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.spellTimeSize or 10)
end end
statusBar.spelltime:SetTextColor(1 ,1, 1) statusBar.spelltime:SetTextColor(1, 1, 1)
statusBar.spelltime:SetJustifyH"RIGHT" statusBar.spelltime:SetJustifyH("RIGHT")
statusBar.spelltime:SetJustifyV"CENTER" statusBar.spelltime:SetJustifyV("CENTER")
statusBar.spelltime:SetPoint"RIGHT" statusBar.spelltime:SetPoint("RIGHT", 0, 0)
statusBar.spellname = statusBar:CreateFontString(nil, "ARTWORK") statusBar.spellname = statusBar:CreateFontString(nil, "ARTWORK")
if auraBarParent.spellNameObject then if auraBarParent.spellNameObject then
@@ -133,9 +133,9 @@ local function CreateAuraBar(oUF, anchor)
statusBar.spellname:SetFont(auraBarParent.spellNameFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.spellNameSize or 10) statusBar.spellname:SetFont(auraBarParent.spellNameFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.spellNameSize or 10)
end end
statusBar.spellname:SetTextColor(1, 1, 1) statusBar.spellname:SetTextColor(1, 1, 1)
statusBar.spellname:SetJustifyH"LEFT" statusBar.spellname:SetJustifyH("LEFT")
statusBar.spellname:SetJustifyV"CENTER" statusBar.spellname:SetJustifyV("CENTER")
statusBar.spellname:SetPoint"LEFT" statusBar.spellname:SetPoint("LEFT", 0, 0)
statusBar.spellname:SetPoint("RIGHT", statusBar.spelltime, "LEFT") statusBar.spellname:SetPoint("RIGHT", statusBar.spelltime, "LEFT")
if auraBarParent.PostCreateBar then if auraBarParent.PostCreateBar then
@@ -288,7 +288,7 @@ local function Update(self, event, unit)
end end
for index = 1 , lastAuraIndex do for index = 1 , lastAuraIndex do
if auraBars:GetWidth() == 0 then break end -- if auraBars:GetWidth() == 0 then break end
local aura = auras[index] local aura = auras[index]
local frame = bars[index] local frame = bars[index]
@@ -333,7 +333,7 @@ local function Update(self, event, unit)
bar.icon:SetTexture(bar.aura.icon) bar.icon:SetTexture(bar.aura.icon)
bar.spellname:SetText(bar.aura.count > 1 and format("%s [%d]", bar.aura.name, bar.aura.count) or bar.aura.name) -- bar.spellname:SetText(bar.aura.count > 1 and format("%s [%d]", bar.aura.name, bar.aura.count) or bar.aura.name)
bar.spelltime:SetText(not bar.noTime and FormatTime(bar.aura.expirationTime-GetTime())) bar.spelltime:SetText(not bar.noTime and FormatTime(bar.aura.expirationTime-GetTime()))
-- Colour bars -- Colour bars
@@ -370,7 +370,8 @@ end
local function Enable(self) local function Enable(self)
if self.AuraBars then if self.AuraBars then
self:RegisterEvent("PLAYER_AURAS_CHANGED", Update) self:RegisterEvent("PLAYER_AURAS_CHANGED")
self:SetScript("OnEvent", function() Update(self, event, "player") end)
self.AuraBars:SetHeight(1) self.AuraBars:SetHeight(1)
self.AuraBars.bars = self.AuraBars.bars or {} self.AuraBars.bars = self.AuraBars.bars or {}
self.AuraBars.SetAnchors = SetAnchors self.AuraBars.SetAnchors = SetAnchors
+11 -11
View File
@@ -24,7 +24,7 @@ function UF:Construct_AuraBars()
E:SetTemplate(self, "Default", nil, nil, UF.thinBorders, true) E:SetTemplate(self, "Default", nil, nil, UF.thinBorders, true)
local inset = UF.thinBorders and E.mult or nil local inset = UF.thinBorders and E.mult or nil
bar:SetInside(self, inset, inset) E:SetInside(bar, self, inset, inset)
UF["statusbars"][bar] = true UF["statusbars"][bar] = true
UF:Update_StatusBar(bar) UF:Update_StatusBar(bar)
@@ -34,12 +34,12 @@ function UF:Construct_AuraBars()
UF:Update_FontString(bar.spellname) UF:Update_FontString(bar.spellname)
bar.spellname:ClearAllPoints() bar.spellname:ClearAllPoints()
bar.spellname:Point("LEFT", bar, "LEFT", 2, 0) E:Point(bar.spellname, "LEFT", bar, "LEFT", 2, 0)
bar.spellname:Point("RIGHT", bar.spelltime, "LEFT", -4, 0) E:Point(bar.spellname, "RIGHT", bar.spelltime, "LEFT", -4, 0)
bar.spellname:SetWordWrap(false) -- bar.spellname:SetWordWrap(false)
bar.iconHolder:SetTemplate("Default", nil, nil, UF.thinBorders, true) E:SetTemplate(bar.iconHolder, "Default", nil, nil, UF.thinBorders, true)
bar.icon:SetInside(bar.iconHolder, inset, inset) E:SetInside(bar.icon, bar.iconHolder, inset, inset)
bar.icon:SetDrawLayer("OVERLAY") bar.icon:SetDrawLayer("OVERLAY")
bar.bg = bar:CreateTexture(nil, "BORDER") bar.bg = bar:CreateTexture(nil, "BORDER")
@@ -255,11 +255,11 @@ function UF:ColorizeAuraBars()
if not frame:IsVisible() then break end if not frame:IsVisible() then break end
local spellName = frame.statusBar.aura.name local spellName = frame.statusBar.aura.name
local spellID = frame.statusBar.aura.spellID local spellID = frame.statusBar.aura.spellID
local colors = E.global.unitframe.AuraBarColors[spellID] or E.global.unitframe.AuraBarColors[tostring(spellID)] or E.global.unitframe.AuraBarColors[spellName] -- local colors = E.global.unitframe.AuraBarColors[spellID] or E.global.unitframe.AuraBarColors[tostring(spellID)] or E.global.unitframe.AuraBarColors[spellName]
if E.db.unitframe.colors.auraBarTurtle and (E.global.unitframe.aurafilters.TurtleBuffs.spells[spellID] or E.global.unitframe.aurafilters.TurtleBuffs.spells[spellName]) and not colors then -- if E.db.unitframe.colors.auraBarTurtle and (E.global.unitframe.aurafilters.TurtleBuffs.spells[spellID] or E.global.unitframe.aurafilters.TurtleBuffs.spells[spellName]) and not colors then
colors = E.db.unitframe.colors.auraBarTurtleColor -- colors = E.db.unitframe.colors.auraBarTurtleColor
end -- end
if colors then if colors then
frame.statusBar:SetStatusBarColor(colors.r, colors.g, colors.b) frame.statusBar:SetStatusBarColor(colors.r, colors.g, colors.b)
@@ -275,7 +275,7 @@ function UF:ColorizeAuraBars()
UF:ToggleTransparentStatusBar(false, frame.statusBar, frame.statusBar.bg, nil, true) UF:ToggleTransparentStatusBar(false, frame.statusBar, frame.statusBar.bg, nil, true)
end end
if(UF.db.colors.transparentAurabars) then if UF.db.colors.transparentAurabars then
local _, _, _, alpha = frame:GetBackdropColor() local _, _, _, alpha = frame:GetBackdropColor()
if colors then if colors then
frame:SetBackdropColor(colors.r * 0.58, colors.g * 0.58, colors.b * 0.58, alpha) frame:SetBackdropColor(colors.r * 0.58, colors.g * 0.58, colors.b * 0.58, alpha)