mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 11:10:00 +00:00
introducing new config approach
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
pfUI_playerDB = {}
|
||||
pfUI_config = {}
|
||||
|
||||
function pfUI:LoadConfig()
|
||||
-- MODULE SUBGROUP ENTRY VALUE
|
||||
pfUI:UpdateConfig("unitframes", nil, "animation_speed", "5")
|
||||
pfUI:UpdateConfig("unitframes", nil, "portrait", "1")
|
||||
pfUI:UpdateConfig("unitframes", nil, "buff_size", "22")
|
||||
pfUI:UpdateConfig("unitframes", nil, "debuff_size", "22")
|
||||
pfUI:UpdateConfig("unitframes", nil, "layout", "default")
|
||||
pfUI:UpdateConfig("unitframes", "player", "width", "200")
|
||||
pfUI:UpdateConfig("unitframes", "player", "height", "50")
|
||||
pfUI:UpdateConfig("unitframes", "player", "pheight", "10")
|
||||
pfUI:UpdateConfig("unitframes", "target", "width", "200")
|
||||
pfUI:UpdateConfig("unitframes", "target", "height", "50")
|
||||
pfUI:UpdateConfig("unitframes", "target", "pheight", "10")
|
||||
pfUI:UpdateConfig("bars", nil, "icon_size", "22")
|
||||
pfUI:UpdateConfig("bars", nil, "border", "2")
|
||||
pfUI:UpdateConfig("panel", "left", "left", "guild")
|
||||
pfUI:UpdateConfig("panel", "left", "center", "durability")
|
||||
pfUI:UpdateConfig("panel", "left", "right", "friends")
|
||||
pfUI:UpdateConfig("panel", "right", "left", "fps")
|
||||
pfUI:UpdateConfig("panel", "right", "center", "time")
|
||||
pfUI:UpdateConfig("panel", "right", "right", "gold")
|
||||
pfUI:UpdateConfig("panel", "other", "minimap", "zone")
|
||||
pfUI:UpdateConfig("tooltip", nil, "position", "bottom")
|
||||
pfUI:UpdateConfig("position", nil, nil, nil)
|
||||
end
|
||||
|
||||
function pfUI:UpdateConfig(group, subgroup, entry, value)
|
||||
-- check for missing config groups
|
||||
if not pfUI_config[group] then
|
||||
pfUI_config[group] = {}
|
||||
end
|
||||
|
||||
-- update config
|
||||
if not subgroup and entry and value and not pfUI_config[group][entry] then
|
||||
pfUI:Debug("Creating Config: " .. entry .. " with value " .. value)
|
||||
pfUI_config[group][entry] = value
|
||||
end
|
||||
|
||||
-- check for missing config subgroups
|
||||
if subgroup and not pfUI_config[group][subgroup] then
|
||||
pfUI:Debug("Creating Subgroup: " .. subgroup)
|
||||
pfUI_config[group][subgroup] = {}
|
||||
end
|
||||
|
||||
-- update config in subgroup
|
||||
if subgroup and entry and value and not pfUI_config[group][subgroup][entry] then
|
||||
pfUI:Debug("Creating Config in Subgroup (" .. subgroup .. "): " .. entry .. " with value " .. value)
|
||||
pfUI_config[group][subgroup][entry] = value
|
||||
end
|
||||
end
|
||||
@@ -15,6 +15,7 @@ end
|
||||
pfUI = CreateFrame("Frame",nil,UIParent)
|
||||
pfUI:RegisterEvent("ADDON_LOADED")
|
||||
pfUI:SetScript("OnEvent", function()
|
||||
pfUI:LoadConfig()
|
||||
if arg1 == "pfUI" then
|
||||
pfUI:Debug("pfUI module loader:")
|
||||
for i,m in pairs(this.modules) do
|
||||
@@ -35,9 +36,7 @@ function pfUI:RegisterModule(n, f)
|
||||
end
|
||||
|
||||
function pfUI:Debug(msg)
|
||||
if pfUI_config.debug == 1 then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(msg)
|
||||
end
|
||||
-- DEFAULT_CHAT_FRAME:AddMessage(msg)
|
||||
end
|
||||
|
||||
pfUI.backdrop = {
|
||||
@@ -61,52 +60,6 @@ pfUI.backdrop_underline = {
|
||||
insets = {left = 0, right = 0, top = 0, bottom = 0},
|
||||
}
|
||||
|
||||
pfUI_playerDB = {}
|
||||
pfUI_config = {
|
||||
debug = 1,
|
||||
["unitframes"] = {
|
||||
animation_speed = 5,
|
||||
portrait = 1,
|
||||
buff_size = "22",
|
||||
debuff_size = "22",
|
||||
layout = "default",
|
||||
["player"] = {
|
||||
width = 200,
|
||||
height = 50,
|
||||
pheight = 10,
|
||||
},
|
||||
["target"] = {
|
||||
width = 200,
|
||||
height = 50,
|
||||
pheight = 10,
|
||||
},
|
||||
},
|
||||
["bars"] = {
|
||||
icon_size = "22",
|
||||
border = 2,
|
||||
},
|
||||
["panel"] = {
|
||||
["left"] = {
|
||||
left = "guild",
|
||||
center = "durability",
|
||||
right = "friends",
|
||||
},
|
||||
["right"] = {
|
||||
left = "fps",
|
||||
center = "time",
|
||||
right = "gold",
|
||||
},
|
||||
["other"] = {
|
||||
minimap = "zone",
|
||||
},
|
||||
},
|
||||
["tooltip"] = {
|
||||
position = "bottom"
|
||||
},
|
||||
["position"] = {
|
||||
}
|
||||
}
|
||||
|
||||
pfUI.utils = CreateFrame("Frame",nil,UIParent)
|
||||
|
||||
function pfUI.utils:loadPosition(frame)
|
||||
|
||||
Reference in New Issue
Block a user