unitframes: add option to specify alpha values

This commit is contained in:
shagu
2020-03-07 09:40:10 +01:00
parent d7c3215b0b
commit 3024a42644
3 changed files with 36 additions and 3 deletions
+3
View File
@@ -356,6 +356,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", unit, "debuff_ind_size", ".65")
pfUI:UpdateConfig("unitframes", unit, "clickcast", "0")
pfUI:UpdateConfig("unitframes", unit, "faderange", "0")
pfUI:UpdateConfig("unitframes", unit, "alpha_visible", "1")
pfUI:UpdateConfig("unitframes", unit, "alpha_outrange", ".50")
pfUI:UpdateConfig("unitframes", unit, "alpha_offline", ".25")
pfUI:UpdateConfig("unitframes", unit, "glowaggro", "1")
pfUI:UpdateConfig("unitframes", unit, "glowcombat", "1")
pfUI:UpdateConfig("unitframes", unit, "showtooltip", "1")
+7 -3
View File
@@ -311,6 +311,10 @@ function pfUI.uf:UpdateConfig()
relative_point = "BOTTOMRIGHT"
end
f.alpha_visible = tonumber(f.config.alpha_visible)
f.alpha_outrange = tonumber(f.config.alpha_outrange)
f.alpha_offline = tonumber(f.config.alpha_offline)
f:SetFrameStrata("BACKGROUND")
f.glow:SetFrameStrata("BACKGROUND")
@@ -1087,18 +1091,18 @@ function pfUI.uf:RefreshUnitAnimation(unitframe)
end
function pfUI.uf:RefreshUnitState(unit)
local alpha = 1
local alpha = unit.alpha_visible
local unlock = pfUI.unlock and pfUI.unlock:IsShown() or nil
if not UnitIsConnected(unit.label .. unit.id) and not unlock then
-- offline
alpha = .25
alpha = unit.alpha_offline
unit.hp.bar:SetMinMaxValues(0, 100)
unit.power.bar:SetMinMaxValues(0, 100)
unit.hp.bar:SetValue(0)
unit.power.bar:SetValue(0)
elseif unit.config.faderange == "1" and not pfUI.api.UnitInRange(unit.label .. unit.id, 4) and not unlock then
alpha = .5
alpha = unit.alpha_outrange
end
-- skip if alpha is already correct
+26
View File
@@ -969,6 +969,29 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
".75:75%",
".90:90%",
},
["percent_small"] = {
"0:0%",
".05:5%",
".10:10%",
".15:15%",
".20:20%",
".25:25%",
".30:30%",
".35:35%",
".40:40%",
".45:45%",
".50:50%",
".55:55%",
".60:60%",
".65:65%",
".70:70%",
".75:75%",
".80:80%",
".85:85%",
".90:90%",
".95:95%",
"1:100%",
},
["uf_overheal"] = {
"0:0%",
"10:10%",
@@ -1560,6 +1583,9 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(U[c], T["Display Frame"] .. ": " .. t, C.unitframes[c], "visible", "checkbox")
CreateConfig(U[c], T["Enable Mouseover Tooltip"], C.unitframes[c], "showtooltip", "checkbox")
CreateConfig(U[c], T["Enable Clickcast"], C.unitframes[c], "clickcast", "checkbox")
CreateConfig(U[c], T["Default Transparency"], C.unitframes[c], "alpha_visible", "dropdown", pfUI.gui.dropdowns.percent_small)
CreateConfig(U[c], T["Out Of Range Transparency"], C.unitframes[c], "alpha_outrange", "dropdown", pfUI.gui.dropdowns.percent_small)
CreateConfig(U[c], T["Offline Transparency"], C.unitframes[c], "alpha_offline", "dropdown", pfUI.gui.dropdowns.percent_small)
CreateConfig(U[c], T["Enable Range Fading"], C.unitframes[c], "faderange", "checkbox")
CreateConfig(U[c], T["Enable Aggro Glow"], C.unitframes[c], "glowaggro", "checkbox")
CreateConfig(U[c], T["Enable Combat Glow"], C.unitframes[c], "glowcombat", "checkbox")