unitframes: add option for custom hp background

This commit is contained in:
shagu
2017-03-04 16:17:14 +01:00
parent d9f29a7e7b
commit 72d1132dcc
8 changed files with 52 additions and 0 deletions
+2
View File
@@ -65,6 +65,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", nil, "pastel", "1")
pfUI:UpdateConfig("unitframes", nil, "custom", "0")
pfUI:UpdateConfig("unitframes", nil, "customcolor", ".2,.2,.2,1")
pfUI:UpdateConfig("unitframes", nil, "custombg", "0")
pfUI:UpdateConfig("unitframes", nil, "custombgcolor", ".5,.2,.2,1")
pfUI:UpdateConfig("unitframes", nil, "animation_speed", "5")
pfUI:UpdateConfig("unitframes", nil, "portraitalpha", "0.1")
pfUI:UpdateConfig("unitframes", nil, "portraittexture", "1")
+8
View File
@@ -104,6 +104,14 @@ pfUI:RegisterModule("group", function ()
pfUI.uf.group[i].hp.bar:SetAllPoints(pfUI.uf.group[i].hp)
pfUI.uf.group[i].hp.bar:SetMinMaxValues(0, 100)
if C.unitframes.custombg == "1" then
local cr, cg, cb, ca = strsplit(",", C.unitframes.custombgcolor)
cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb)
pfUI.uf.group[i].hp.bar.texture = pfUI.uf.group[i].hp.bar:CreateTexture(nil,"BACKGROUND")
pfUI.uf.group[i].hp.bar.texture:SetTexture(cr,cg,cb,ca)
pfUI.uf.group[i].hp.bar.texture:SetAllPoints(pfUI.uf.group[i].hp.bar)
end
pfUI.uf.group[i].power = CreateFrame("Frame",nil, pfUI.uf.group[i])
pfUI.uf.group[i].power:SetWidth(175)
pfUI.uf.group[i].power:SetHeight(10)
+2
View File
@@ -852,6 +852,8 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Pastel Colors", C.unitframes, "pastel", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Custom Color Health Bars", C.unitframes, "custom", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Custom Health Bar Color", C.unitframes, "customcolor", "color")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Custom Color Health Bar Background", C.unitframes, "custombg", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Custom Health Bar Background Color", C.unitframes, "custombgcolor", "color")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Animation Speed", C.unitframes, "animation_speed")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Alpha", C.unitframes, "portraitalpha")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable 2D Portraits As Fallback", C.unitframes, "portraittexture", "checkbox")
+8
View File
@@ -150,6 +150,14 @@ pfUI:RegisterModule("pet", function ()
pfUI.uf.pet.hp.bar:SetAllPoints(pfUI.uf.pet.hp)
pfUI.uf.pet.hp.bar:SetMinMaxValues(0, 100)
if C.unitframes.custombg == "1" then
local cr, cg, cb, ca = strsplit(",", C.unitframes.custombgcolor)
cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb)
pfUI.uf.pet.hp.bar.texture = pfUI.uf.pet.hp.bar:CreateTexture(nil,"BACKGROUND")
pfUI.uf.pet.hp.bar.texture:SetTexture(cr,cg,cb,ca)
pfUI.uf.pet.hp.bar.texture:SetAllPoints(pfUI.uf.pet.hp.bar)
end
pfUI.uf.pet.hp.raidIcon = CreateFrame("Frame",nil,pfUI.uf.pet.hp)
pfUI.uf.pet.hp.raidIcon:SetFrameStrata("MEDIUM")
pfUI.uf.pet.hp.raidIcon:SetParent(pfUI.uf.pet.hp.bar)
+8
View File
@@ -213,6 +213,14 @@ pfUI:RegisterModule("player", function ()
pfUI.uf.player.hp.bar:SetAllPoints(pfUI.uf.player.hp)
pfUI.uf.player.hp.bar:SetMinMaxValues(0, 100)
if C.unitframes.custombg == "1" then
local cr, cg, cb, ca = strsplit(",", C.unitframes.custombgcolor)
cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb)
pfUI.uf.player.hp.bar.texture = pfUI.uf.player.hp.bar:CreateTexture(nil,"BACKGROUND")
pfUI.uf.player.hp.bar.texture:SetTexture(cr,cg,cb,ca)
pfUI.uf.player.hp.bar.texture:SetAllPoints(pfUI.uf.player.hp.bar)
end
pfUI.uf.player.hp.leaderIcon = CreateFrame("Frame",nil,pfUI.uf.player.hp.bar)
pfUI.uf.player.hp.leaderIcon:SetWidth(10)
pfUI.uf.player.hp.leaderIcon:SetHeight(10)
+8
View File
@@ -59,6 +59,14 @@ pfUI:RegisterModule("raid", function ()
pfUI.uf.raid[i].hp.bar:SetAllPoints(pfUI.uf.raid[i].hp)
pfUI.uf.raid[i].hp.bar:SetMinMaxValues(0, 100)
if C.unitframes.custombg == "1" then
local cr, cg, cb, ca = strsplit(",", C.unitframes.custombgcolor)
cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb)
pfUI.uf.raid[i].hp.bar.texture = pfUI.uf.raid[i].hp.bar:CreateTexture(nil,"BACKGROUND")
pfUI.uf.raid[i].hp.bar.texture:SetTexture(cr,cg,cb,ca)
pfUI.uf.raid[i].hp.bar.texture:SetAllPoints(pfUI.uf.raid[i].hp.bar)
end
pfUI.uf.raid[i].power = CreateFrame("Frame",nil, pfUI.uf.raid[i])
pfUI.uf.raid[i].power:SetPoint("BOTTOM", 0, 0)
pfUI.uf.raid[i].power:SetWidth(50)
+8
View File
@@ -253,6 +253,14 @@ pfUI:RegisterModule("target", function ()
pfUI.uf.target.hp.bar:SetAllPoints(pfUI.uf.target.hp)
pfUI.uf.target.hp.bar:SetMinMaxValues(0, 100)
if C.unitframes.custombg == "1" then
local cr, cg, cb, ca = strsplit(",", C.unitframes.custombgcolor)
cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb)
pfUI.uf.target.hp.bar.texture = pfUI.uf.target.hp.bar:CreateTexture(nil,"BACKGROUND")
pfUI.uf.target.hp.bar.texture:SetTexture(cr,cg,cb,ca)
pfUI.uf.target.hp.bar.texture:SetAllPoints(pfUI.uf.target.hp.bar)
end
pfUI.uf.target.hp.leaderIcon = CreateFrame("Frame",nil,pfUI.uf.target.hp.bar)
pfUI.uf.target.hp.leaderIcon:SetWidth(10)
pfUI.uf.target.hp.leaderIcon:SetHeight(10)
+8
View File
@@ -134,6 +134,14 @@ pfUI:RegisterModule("targettarget", function ()
pfUI.uf.targettarget.hp.bar:SetAllPoints(pfUI.uf.targettarget.hp)
pfUI.uf.targettarget.hp.bar:SetMinMaxValues(0, 100)
if C.unitframes.custombg == "1" then
local cr, cg, cb, ca = strsplit(",", C.unitframes.custombgcolor)
cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb)
pfUI.uf.targettarget.hp.bar.texture = pfUI.uf.targettarget.hp.bar:CreateTexture(nil,"BACKGROUND")
pfUI.uf.targettarget.hp.bar.texture:SetTexture(cr,cg,cb,ca)
pfUI.uf.targettarget.hp.bar.texture:SetAllPoints(pfUI.uf.targettarget.hp.bar)
end
pfUI.uf.targettarget.hp.raidIcon = CreateFrame("Frame",nil,pfUI.uf.targettarget.hp)
pfUI.uf.targettarget.hp.raidIcon:SetFrameStrata("MEDIUM")
pfUI.uf.targettarget.hp.raidIcon:SetParent(pfUI.uf.targettarget.hp.bar)