unitframes: add option to hide frames

This commit is contained in:
shagu
2017-06-02 18:01:50 +02:00
parent 2c6c212c2d
commit 20861d9373
3 changed files with 27 additions and 0 deletions
+8
View File
@@ -94,6 +94,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", nil, "clickcast_alt", "")
pfUI:UpdateConfig("unitframes", nil, "clickcast_ctrl", "")
pfUI:UpdateConfig("unitframes", "player", "visible", "1")
pfUI:UpdateConfig("unitframes", "player", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "player", "width", "200")
pfUI:UpdateConfig("unitframes", "player", "height", "50")
@@ -116,6 +117,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "player", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "player", "energy", "1")
pfUI:UpdateConfig("unitframes", "target", "visible", "1")
pfUI:UpdateConfig("unitframes", "target", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "target", "width", "200")
pfUI:UpdateConfig("unitframes", "target", "height", "50")
@@ -135,6 +137,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "target", "txtright", "healthdyn")
pfUI:UpdateConfig("unitframes", "target", "animation", "0")
pfUI:UpdateConfig("unitframes", "group", "visible", "1")
pfUI:UpdateConfig("unitframes", "group", "portrait", "off")
pfUI:UpdateConfig("unitframes", "group", "width", "164")
pfUI:UpdateConfig("unitframes", "group", "height", "32")
@@ -154,6 +157,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "group", "txtright", "healthmiss")
pfUI:UpdateConfig("unitframes", "group", "hide_in_raid", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "portrait", "off")
pfUI:UpdateConfig("unitframes", "grouptarget", "width", "120")
pfUI:UpdateConfig("unitframes", "grouptarget", "height", "16")
@@ -172,6 +176,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouptarget", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "grouptarget", "txtright", "healthperc")
pfUI:UpdateConfig("unitframes", "grouppet", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "portrait", "off")
pfUI:UpdateConfig("unitframes", "grouppet", "width", "100")
pfUI:UpdateConfig("unitframes", "grouppet", "height", "14")
@@ -190,6 +195,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouppet", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "grouppet", "txtright", "healthperc")
pfUI:UpdateConfig("unitframes", "raid", "visible", "1")
pfUI:UpdateConfig("unitframes", "raid", "portrait", "off")
pfUI:UpdateConfig("unitframes", "raid", "width", "50")
pfUI:UpdateConfig("unitframes", "raid", "height", "26")
@@ -208,6 +214,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "raid", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "raid", "txtright", "healthmiss")
pfUI:UpdateConfig("unitframes", "ttarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "ttarget", "width", "100")
pfUI:UpdateConfig("unitframes", "ttarget", "height", "20")
@@ -226,6 +233,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "ttarget", "txtcenter", "name")
pfUI:UpdateConfig("unitframes", "ttarget", "txtright", "none")
pfUI:UpdateConfig("unitframes", "pet", "visible", "1")
pfUI:UpdateConfig("unitframes", "pet", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "pet", "width", "100")
pfUI:UpdateConfig("unitframes", "pet", "height", "16")
+11
View File
@@ -1,6 +1,7 @@
pfUI.uf = CreateFrame("Frame",nil,UIParent)
local uf_defaults = {
visible = "1",
portrait = "bar",
width = "200",
height = "50",
@@ -10,6 +11,11 @@ local uf_defaults = {
buffsize = "20",
debuffs = "top",
debuffsize = "20",
invert_healthbar = "0",
buff_indicator = "0",
debuff_indicator = "0",
clickcast = "0",
faderange = "0",
}
local pfValidUnits = {}
@@ -66,6 +72,11 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
f.config = config or uf_defaults
f.tick = tick
if f.config.visible ~= "1" then
f:Hide()
return
end
f.hp = CreateFrame("Frame",nil, f)
f.hp:SetPoint("TOP", 0, 0)
f.hp:SetWidth(f.config.width)
+8
View File
@@ -881,6 +881,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Ctrl-Click Action", C.unitframes, "clickcast_ctrl")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Player", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Display Player Frame", C.unitframes.player, "visible", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Position", C.unitframes.player, "portrait", "dropdown", { "bar", "left", "right", "off" })
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Width", C.unitframes.player, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Height", C.unitframes.player, "height")
@@ -904,6 +905,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Energy Ticks", C.unitframes.player, "energy", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Display Target Frame", C.unitframes.target, "visible", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Target Switch Animation", C.unitframes.target, "animation", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Position", C.unitframes.target, "portrait", "dropdown", { "bar", "left", "right", "off" })
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Width", C.unitframes.target, "width")
@@ -924,6 +926,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Right Text", C.unitframes.target, "txtright", "dropdown", txtValues)
pfUI.gui:CreateConfig(pfUI.gui.uf, "Group", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Display Group Frames", C.unitframes.group, "visible", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Position", C.unitframes.group, "portrait", "dropdown", { "bar", "left", "right", "off" })
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Width", C.unitframes.group, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Height", C.unitframes.group, "height")
@@ -944,6 +947,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Hide Group Frames When In A Raid", C.unitframes.group, "hide_in_raid", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Group Target", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Display Group Target Frames", C.unitframes.grouptarget, "visible", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Position", C.unitframes.grouptarget, "portrait", "dropdown", { "bar", "left", "right", "off" })
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Width", C.unitframes.grouptarget, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Height", C.unitframes.grouptarget, "height")
@@ -963,6 +967,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Right Text", C.unitframes.grouptarget, "txtright", "dropdown", txtValues)
pfUI.gui:CreateConfig(pfUI.gui.uf, "Group Pet", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Display Group Pet Frames", C.unitframes.grouppet, "visible", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Position", C.unitframes.grouppet, "portrait", "dropdown", { "bar", "left", "right", "off" })
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Width", C.unitframes.grouppet, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Height", C.unitframes.grouppet, "height")
@@ -982,6 +987,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Right Text", C.unitframes.grouppet, "txtright", "dropdown", txtValues)
pfUI.gui:CreateConfig(pfUI.gui.uf, "Raid", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Display Raid Frames", C.unitframes.raid, "visible", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Position", C.unitframes.raid, "portrait", "dropdown", { "bar", "left", "right", "off" })
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Width", C.unitframes.raid, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Height", C.unitframes.raid, "height")
@@ -1001,6 +1007,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Right Text", C.unitframes.raid, "txtright", "dropdown", txtValues)
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target of Target", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Display Target of Target Frame", C.unitframes.ttarget, "visible", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Position", C.unitframes.ttarget, "portrait", "dropdown", { "bar", "left", "right", "off" })
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Width", C.unitframes.ttarget, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Height", C.unitframes.ttarget, "height")
@@ -1020,6 +1027,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Right Text", C.unitframes.ttarget, "txtright", "dropdown", txtValues)
pfUI.gui:CreateConfig(pfUI.gui.uf, "Pet", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Display Pet Frame", C.unitframes.player, "visible", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Position", C.unitframes.pet, "portrait", "dropdown", { "bar", "left", "right", "off" })
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Width", C.unitframes.pet, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Height", C.unitframes.pet, "height")