local A, L = ... ----------------------------- -- rSkin Global ----------------------------- rSkin = CreateFrame("Frame") rSkin.addonName = A -- init skins table rSkin.skins = {} L.C = { style = "ZorkUI", backdrop = rLib.CopyTable(oUF_SimpleConfig.backdrop), -- default bd font = oUF_SimpleConfig.fonts.expressway, -- font scale = oUF_SimpleConfig.globalscale, -- scale bar = { small = {150, 20}, -- small size big = rLib.CopyTable(oUF_SimpleConfig.target.size), -- big size tex = oUF_SimpleConfig.textures.statusbar, -- bar texture space = { small = 4, big = 8, } }, button = rLib.CopyTable(rButtonTemplate_Zork_ActionButtonConfig), -- btn thin = rLib.CopyTable(oUF_SimpleConfig.backdrop), -- thin bd } L.C.thin.edgeSize = 2 L.C.thin.inset = 2 L.C.thin.insets = {left=2,right=2,top=2,bottom=2} L.C.thin.bgColor = {0.23,0.23,0.23,0.7} L.C.thin.edgeColor = {0,0,0,1} L.C.button.backdrop.bgColor = L.C.button.backdrop.backgroundColor L.C.button.backdrop.edgeColor = L.C.button.backdrop.borderColor L.C.button.backdrop.inset = 3 -- defaults vars local defaults = { resets = { bigwigs = true, dbm = true, details = true, weakauras = true, lstoasts = true, threatclassic2 = true, dominos = true, } } if (not rSkinDB) then rSkinDB = rLib.CopyTable(defaults) end --CreateBackdrop local function CreateBackdrop(self, relativeTo, anotherBackdrop) local backdrop = anotherBackdrop or oUF_SimpleConfig.backdrop local parent = self.IsObjectType and self:IsObjectType('Texture') and self:GetParent() or self local bd = CreateFrame("Frame", nil, parent, BackdropTemplateMixin and "BackdropTemplate") if (parent:GetFrameLevel() - 1) >= 0 then bd:SetFrameLevel(parent:GetFrameLevel() - 1) else bd:SetFrameLevel(0) end -- bd:SetFrameLevel(parent:GetFrameLevel()-1 or 0) bd:SetPoint("TOPLEFT", relativeTo or self, "TOPLEFT", -backdrop.inset, backdrop.inset) bd:SetPoint("BOTTOMRIGHT", relativeTo or self, "BOTTOMRIGHT", backdrop.inset, -backdrop.inset) bd:SetBackdrop(backdrop) bd:SetBackdropColor(unpack(backdrop.bgColor)) bd:SetBackdropBorderColor(unpack(backdrop.edgeColor)) return bd end L.CreateBackdrop = CreateBackdrop local function Dummy() return end L.Dummy = Dummy local function ThrowError(err, message) if not err then return end err = format("%s: %s Error\n%s", A, message, err) if _G.BaudErrorFrameHandler then _G.BaudErrorFrameHandler(err) else _G.ScriptErrorsFrame:OnError(err, false, false) end end function rSkin:RegisterSkin(name, func) if not self.skins[name] then self.skins[name] = func end end function rSkin:OnLogin() print("|cffffa6c9"..A.." loaded.|r") for name, func in next, self.skins do if name and type(func) == "function" then local _, catch = pcall(func) ThrowError(catch, format("%s Skin", name)) end end end rSkin:RegisterEvent("PLAYER_LOGIN") -- Handle the events as they happen rSkin:SetScript("OnEvent", function(self, event, ...) if (event == "PLAYER_LOGIN") then self:OnLogin() end end)