From 3c95c2339e61f66e9c6d71debdbd58ea1d3f572d Mon Sep 17 00:00:00 2001 From: shagu Date: Wed, 19 Apr 2017 19:52:23 +0200 Subject: [PATCH] unitframes: add custom frame configurations --- api/config.lua | 19 +++++++++++++++++++ api/unitframes.lua | 20 +------------------- modules/gui.lua | 20 ++++++++++++++++++++ 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/api/config.lua b/api/config.lua index 584306d3..bf9887fd 100644 --- a/api/config.lua +++ b/api/config.lua @@ -271,6 +271,25 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "pet", "txtcenter", "name") pfUI:UpdateConfig("unitframes", "pet", "txtright", "none") + pfUI:UpdateConfig("unitframes", "fallback", "visible", "1") + pfUI:UpdateConfig("unitframes", "fallback", "portrait", "bar") + pfUI:UpdateConfig("unitframes", "fallback", "width", "200") + pfUI:UpdateConfig("unitframes", "fallback", "height", "50") + pfUI:UpdateConfig("unitframes", "fallback", "pheight", "10") + pfUI:UpdateConfig("unitframes", "fallback", "pspace", "-3") + pfUI:UpdateConfig("unitframes", "fallback", "buffs", "top") + pfUI:UpdateConfig("unitframes", "fallback", "buffsize", "20") + pfUI:UpdateConfig("unitframes", "fallback", "debuffs", "top") + pfUI:UpdateConfig("unitframes", "fallback", "debuffsize", "20") + pfUI:UpdateConfig("unitframes", "fallback", "invert_healthbar", "0") + pfUI:UpdateConfig("unitframes", "fallback", "buff_indicator", "0") + pfUI:UpdateConfig("unitframes", "fallback", "debuff_indicator", "0") + pfUI:UpdateConfig("unitframes", "fallback", "clickcast", "0") + pfUI:UpdateConfig("unitframes", "fallback", "faderange", "0") + pfUI:UpdateConfig("unitframes", "fallback", "txtleft", "unit") + pfUI:UpdateConfig("unitframes", "fallback", "txtcenter", "none") + pfUI:UpdateConfig("unitframes", "fallback", "txtright", "healthdyn") + pfUI:UpdateConfig("bars", nil, "icon_size", "20") pfUI:UpdateConfig("bars", nil, "background", "1") pfUI:UpdateConfig("bars", nil, "glowrange", "1") diff --git a/api/unitframes.lua b/api/unitframes.lua index 3788326e..374a0d26 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -1,23 +1,5 @@ pfUI.uf = CreateFrame("Frame",nil,UIParent) -local uf_defaults = { - visible = "1", - portrait = "bar", - width = "200", - height = "50", - pheight = "10", - pspace = "-3", - buffs = "top", - buffsize = "20", - debuffs = "top", - debuffsize = "20", - invert_healthbar = "0", - buff_indicator = "0", - debuff_indicator = "0", - clickcast = "0", - faderange = "0", -} - local pfValidUnits = {} pfValidUnits["player"] = true pfValidUnits["target"] = true @@ -68,7 +50,7 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick) f.label = unit f.id = id - f.config = config or uf_defaults + f.config = config or pfUI_config.unitframes.fallback f.tick = tick if f.config.visible ~= "1" then diff --git a/modules/gui.lua b/modules/gui.lua index 516882ef..f17e793c 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1066,6 +1066,26 @@ pfUI:RegisterModule("gui", function () pfUI.gui:CreateConfig(pfUI.gui.uf, "Center Text", C.unitframes.pet, "txtcenter", "dropdown", txtValues) pfUI.gui:CreateConfig(pfUI.gui.uf, "Right Text", C.unitframes.pet, "txtright", "dropdown", txtValues) + pfUI.gui:CreateConfig(pfUI.gui.uf, "Custom Units", nil, nil, "header") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Display Custom Frames", C.unitframes.fallback, "visible", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Position", C.unitframes.fallback, "portrait", "dropdown", { "bar", "left", "right", "off" }) + pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Width", C.unitframes.fallback, "width") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Health Bar Height", C.unitframes.fallback, "height") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Power Bar Height", C.unitframes.fallback, "pheight") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Spacing", C.unitframes.fallback, "pspace") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Buff Position", C.unitframes.fallback, "buffs", "dropdown", { "top", "bottom", "hide"}) + pfUI.gui:CreateConfig(pfUI.gui.uf, "Buff Size", C.unitframes.fallback, "buffsize") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Debuff Position", C.unitframes.fallback, "debuffs", "dropdown", { "top", "bottom", "hide"}) + pfUI.gui:CreateConfig(pfUI.gui.uf, "Debuff Size", C.unitframes.fallback, "debuffsize") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Invert Health Bar", C.unitframes.fallback, "invert_healthbar", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Buff Indicators", C.unitframes.fallback, "buff_indicator", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Debuff Indicators", C.unitframes.fallback, "debuff_indicator", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Clickcast", C.unitframes.fallback, "clickcast", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Range Fading", C.unitframes.fallback, "faderange", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Left Text", C.unitframes.fallback, "txtleft", "dropdown", txtValues) + pfUI.gui:CreateConfig(pfUI.gui.uf, "Center Text", C.unitframes.fallback, "txtcenter", "dropdown", txtValues) + pfUI.gui:CreateConfig(pfUI.gui.uf, "Right Text", C.unitframes.fallback, "txtright", "dropdown", txtValues) + -- action bar pfUI.gui.bar = pfUI.gui:CreateConfigTab("Action Bar") pfUI.gui:CreateConfig(pfUI.gui.bar, "Icon Size", C.bars, "icon_size")