If you make them use a common folder starting name like myrroddinUI_xxx makes it easier to detect and list them. You can have the skin addon overwrite your settings function to replace the configuration table like:
Code:
function FauxMazzleUI:SetSkin(load)
FauxMazzleUI.Skin = {
left = "Interface\\AddOns\\FauxMazzle_Skin_Default\\Bottom1",
centreleft = "Interface\\AddOns\\FauxMazzle_Skin_Default\\Bottom2",
right = "Interface\\AddOns\\FauxMazzle_Skin_Default\\Bottom4",
centreright = "Interface\\AddOns\\FauxMazzle_Skin_Default\\Bottom3",
cave = "Interface\\AddOns\\FauxMazzle_Skin_Default\\FloatingCave",
minimap = "Interface\\AddOns\\FauxMazzle_Skin_Default\\MinimapBorder",
}
return "The default skin", "Interface\\AddOns\\FauxMazzle_Skin_Default\\"
end
When the user selects a theme/skin, you load it (again) and do the setup with the newly overwritten config.
Code:
function NS:LoadSkin(settings, update)
local skin = settings.skin
if not skin or skin == "" then return end
local addon = "FauxMazzle_Skin_"..skin -- from the common folder naming
local loaded, reason = LoadAddOn(addon)
if not loaded then
print(NS.TEXTS.Error..": "..NS.TEXTS.ErrorLoadSkin.."(".._G["ADDON_".. reason].." - "..addon..")")
skin = FMGLOBAL.DefaultSkin -- my default skin as backup
loaded, reason = LoadAddOn(skin)
if not loaded then
print(NS.TEXTS.Error..": "..NS.TEXTS.ErrorLoadSkin.."(".._G["ADDON_".. reason].." - "..addon..")")
return
end
end
local name, path = FauxMazzleUI:SetSkin() -- Function created when loading the skin
if not update then
return name
end
-- replace all the textures.
for i=1,4 do
NS.Frames["Main_"..i].Texture:SetTexture(path.."Bottom"..i)
end
NS.Frames.Minimap.Texture:SetTexture(path.."MinimapBorder")
NS.Frames.Cave.Texture:SetTexture(path.."FloatingCave")
print(NS.TEXTS.SkinLoaded..name)
settings.skin = skin
end
One possibility.