Quantcast

reskin ls toasts

Ou Junhui [09-20-21 - 12:45]
reskin ls toasts
Filename
rSkin/init.lua
rSkin/modules/Ls_Toasts.lua
rSkin/rSkin.toc
diff --git a/rSkin/init.lua b/rSkin/init.lua
index 5d965f4..f6ff11e 100644
--- a/rSkin/init.lua
+++ b/rSkin/init.lua
@@ -3,7 +3,9 @@ local A, L = ...
 -----------------------------
 -- rSkin Global
 -----------------------------
-local rSkin = CreateFrame("Frame")
+rSkin = CreateFrame("Frame")
+rSkin.addonName = A
+-- init skins table
 rSkin.skins = {}

 local function ThrowError(err, message)
@@ -18,6 +20,23 @@ local function ThrowError(err, message)
 	end
 end

+--CreateBackdrop
+local function CreateBackdrop(self, relativeTo)
+  local backdrop = oUF_SimpleConfig.backdrop
+  local bd = CreateFrame("Frame", nil, self, BackdropTemplateMixin and "BackdropTemplate")
+  bd:SetFrameLevel(self: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() end
+L.Dummy = Dummy
+
 function rSkin:RegisterSkin(name, func)
     if not self.skins[name] then
 		self.skins[name] = func
@@ -25,7 +44,7 @@ function rSkin:RegisterSkin(name, func)
 end

 function rSkin:OnLogin()
-    print(A.." loaded.")
+    print("|cffffa6c9"..A.."|r loaded.")
     for name, func in next, self.skins do
 		if name and type(func) == "function" then
 			local _, catch = pcall(func)
@@ -34,4 +53,11 @@ function rSkin:OnLogin()
 	end
 end

-rSkin:RegisterEvent("PLAYER_LOGIN", self.OnLogin)
\ No newline at end of file
+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)
\ No newline at end of file
diff --git a/rSkin/modules/Ls_Toasts.lua b/rSkin/modules/Ls_Toasts.lua
index 537b155..a3e0dab 100644
--- a/rSkin/modules/Ls_Toasts.lua
+++ b/rSkin/modules/Ls_Toasts.lua
@@ -1,6 +1,6 @@
 local A, L = ...

-local function Skin_LsToasts()
+local function ls_Toasts()
 	if not IsAddOnLoaded("ls_Toasts") then return end

 	local LE, LC, LL = unpack(_G.ls_Toasts)
@@ -13,7 +13,7 @@ local function Skin_LsToasts()
 			texture = {1, 1, 1, 1},
 		},
 		icon = {
-			tex_coords = DB.TexCoord,
+			tex_coords = rButtonTemplate_Zork_ActionButtonConfig.icon.texCoord,
 		},
 		icon_border = {
 			color = {0, 0, 0},
@@ -22,7 +22,7 @@ local function Skin_LsToasts()
 			texture = {1, 1, 1, 1},
 		},
 		slot = {
-			tex_coords = DB.TexCoord,
+			tex_coords = rButtonTemplate_Zork_ActionButtonConfig.icon.texCoord,
 		},
 		slot_border = {
 			color = {0, 0, 0},
@@ -67,7 +67,8 @@ local function Skin_LsToasts()
 			if toast.BG and not toast.styled then
 				toast.BG:SetTexture(nil)
 				-- B.SetBD(toast)
-				-- toast.SetBackground = B.Dummy
+				L.CreateBackdrop(toast)
+				toast.SetBackground = L.Dummy
 				toast.styled = true
 			end
 			index = index + 1
@@ -77,4 +78,4 @@ local function Skin_LsToasts()
 	hooksecurefunc(LE, "GetToast", reskinFunc)
 end

-rSkin:RegisterSkin("ls_Toasts", Skin_LsToasts)
\ No newline at end of file
+rSkin:RegisterSkin("ls_Toasts", ls_Toasts)
\ No newline at end of file
diff --git a/rSkin/rSkin.toc b/rSkin/rSkin.toc
index 8796324..76265e8 100644
--- a/rSkin/rSkin.toc
+++ b/rSkin/rSkin.toc
@@ -2,7 +2,8 @@
 ## Author: rawoil
 ## Title: rSkin |cff1a9fc0BCC|r
 ## Notes: Reskin other addons to fit zorkui's L&F
-## RequiredDeps: rLib, rButtonTemplate_Zork
+## RequiredDeps: rLib, rButtonTemplate_Zork, oUF_SimpleConfig
 ## OptionalDeps: MerInspect, ThreatClassic2, DBM, WeakAuras, ls_Toasts

-init.lua
\ No newline at end of file
+init.lua
+modules\ls_Toasts.lua
\ No newline at end of file