Quantcast

reskin ls_toasts

Ou Junhui [09-20-21 - 15:51]
reskin ls_toasts
Filename
rSkin/init.lua
rSkin/modules/MerInspect.lua
rSkin/modules/ThreatClassic2.lua
rSkin/rSkin.toc
diff --git a/rSkin/init.lua b/rSkin/init.lua
index f6ff11e..134034f 100644
--- a/rSkin/init.lua
+++ b/rSkin/init.lua
@@ -8,6 +8,8 @@ rSkin.addonName = A
 -- init skins table
 rSkin.skins = {}

+local Hider = CreateFrame("Frame", nil, UIParent) Hider:Hide()
+
 local function ThrowError(err, message)
 	if not err then return end

@@ -20,6 +22,30 @@ local function ThrowError(err, message)
 	end
 end

+-- Kills --
+local function Kill(self)
+	if (self.UnregisterAllEvents) then
+		self:UnregisterAllEvents()
+		self:SetParent(Hider)
+	else
+		self.Show = self.Hide
+	end
+
+	self:Hide()
+end
+L.Kill = Kill
+
+local function StripTextures(self)
+	for i = 1, self:GetNumRegions() do
+		local Region = select(i, self:GetRegions())
+		if (Region and Region:GetObjectType() == "Texture") then
+			Region:SetTexture(nil)
+			Kill(Region)
+		end
+	end
+end
+L.StripTextures = StripTextures
+
 --CreateBackdrop
 local function CreateBackdrop(self, relativeTo)
   local backdrop = oUF_SimpleConfig.backdrop
@@ -34,7 +60,7 @@ local function CreateBackdrop(self, relativeTo)
 end
 L.CreateBackdrop = CreateBackdrop

-local function Dummy() end
+local function Dummy() return end
 L.Dummy = Dummy

 function rSkin:RegisterSkin(name, func)
diff --git a/rSkin/modules/MerInspect.lua b/rSkin/modules/MerInspect.lua
index a980c98..249e39e 100644
--- a/rSkin/modules/MerInspect.lua
+++ b/rSkin/modules/MerInspect.lua
@@ -1,47 +1,48 @@
-local _, ns = ...
-local B, C, L, DB, P = unpack(ns)
-local S = P:GetModule("Skins")
-local M = B:GetModule("Misc")
+local A, L = ...
+-- local B, C, L, DB, P = unpack(ns)
+-- local S = P:GetModule("Skins")
+-- local M = B:GetModule("Misc")

 local _G = getfenv(0)
 local select, pairs, type = select, pairs, type

-local function reskinFrame(frame)
-	frame:SetBackdrop(nil)
-	frame.SetBackdrop = B.Dummy
-	frame:SetBackdropColor(0, 0, 0, 0)
-	frame.SetBackdropColor = B.Dummy
-	frame:SetBackdropBorderColor(0, 0, 0, 0)
-	frame.SetBackdropBorderColor = B.Dummy
-	B.SetBD(frame, nil, 0, 0, 0, 0)
+local function ReskinFrame(frame)
+	-- L.CreateBackdrop(frame)
+	-- frame.SetBackdrop = L.Dummy
+	-- frame:SetBackdropColor(0, 0, 0, 0)
+	-- frame.SetBackdropColor = L.Dummy
+	-- frame:SetBackdropBorderColor(0, 0, 0, 0)
+	-- frame.SetBackdropBorderColor = L.Dummy
+	-- L.CreateBackdrop(frame)
+	-- B.SetBD(frame, nil, 0, 0, 0, 0)
 end

-function S:MerInspect()
+function MerInspect()
 	if not IsAddOnLoaded("MerInspect") then return end
-	if not S.db["MerInspect"] then return end

 	hooksecurefunc("ShowInspectItemListFrame", function(_, parent)
 		local frame = parent.inspectFrame
 		if not frame then return end

+		-- frame:SetFrameLevel(1)
 		for i = 1, frame:GetNumChildren() do
 			local child = select(i, frame:GetChildren())
 			if child and child.itemString then
-				child.itemString:SetFont(child.itemString:GetFont(), 13, "OUTLINE") -- 装备字体描边
+				child.itemString:SetFont(child.itemString:GetFont(), 12, "OUTLINE") -- 装备字体描边
 			end
 		end

-		local f = parent:GetName()
-		if (f == "InspectFrame" or f == "PaperDollFrame") then
-			frame:SetPoint("TOPLEFT", parent, "TOPRIGHT", -33, -15)
-		else
-			frame:SetPoint("TOPLEFT", parent, "TOPRIGHT", 1, 0)
-		end
+		-- local f = parent:GetName()
+		-- if (f == "InspectFrame" or f == "PaperDollFrame") then
+		-- 	frame:SetPoint("TOPLEFT", parent, "TOPRIGHT", -33, -15)
+		-- else
+		-- 	frame:SetPoint("TOPLEFT", parent, "TOPRIGHT", 1, 0)
+		-- end

-		if not frame.styled then
-			reskinFrame(frame)
-			frame.styled = true
-		end
+		-- if not frame.styled then
+		-- 	ReskinFrame(frame)
+		-- 	frame.styled = true
+		-- end
 	end)

 	hooksecurefunc("ClassicStatsFrameTemplate_OnShow", function(self)
@@ -49,17 +50,17 @@ function S:MerInspect()
 			local category = {self.AttributesCategory, self.ResistanceCategory, self.EnhancementsCategory, self.SuitCategory}
 			for _, v in pairs(category) do
 				v.Background:Hide()
-				local line = v:CreateTexture(nil, "ARTWORK")
-				line:SetSize(180, C.mult)
-				line:SetPoint("BOTTOM", 0, 5)
-				line:SetColorTexture(1, 1, 1, .25)
+				-- local line = v:CreateTexture(nil, "ARTWORK")
+				-- line:SetSize(180, oUF_SimpleConfig.colors.bgMultiplier)
+				-- line:SetPoint("BOTTOM", 0, 8)
+				-- line:SetColorTexture(1, 1, 1, .25)
 			end

-			B.StripTextures(self)
-			reskinFrame(self)
+			-- L.StripTextures(self)
+			ReskinFrame(self)
 			self.styled = true
 		end
 	end)
 end

-S:RegisterSkin("MerInspect", S.MerInspect)
\ No newline at end of file
+rSkin:RegisterSkin("MerInspect", MerInspect)
\ No newline at end of file
diff --git a/rSkin/modules/ThreatClassic2.lua b/rSkin/modules/ThreatClassic2.lua
index 0e389f7..95c6417 100644
--- a/rSkin/modules/ThreatClassic2.lua
+++ b/rSkin/modules/ThreatClassic2.lua
@@ -1,81 +1,75 @@
-local _, ns = ...
-local B, C, L, DB, P = unpack(ns)
-local S = P:GetModule("Skins")
+local A, L = ...

-local _G = getfenv(0)
-
-local function reskinStatusBar(self)
+local function ReskinStatusBar(self)
 	self:SetBackdrop(nil)
-	self.SetBackdrop = B.Dummy
+	self.SetBackdrop = L.Dummy

 	local backdrop = self.edgeBackdrop or self.backdrop
 	if backdrop then
 		backdrop:SetBackdrop(nil)
-		backdrop.SetBackdrop = B.Dummy
+		backdrop.SetBackdrop = L.Dummy
 	end
 end

-local function delayFunc()
+local function DelayFunc()
 	local frame = _G.ThreatClassic2BarFrame
 	if not frame then return end

-	local bg = B.SetBD(frame)
+	local bg = L.CreateBackdrop(frame)
 	if frame.header:IsShown() then
-		bg:SetPoint("TOPLEFT", -C.mult, 18)
+		bg:SetPoint("TOPLEFT", -oUF_SimpleConfig.colors.bgMultiplier, 18)
 	end

 	local frameBg = frame.bg
 	if frameBg then
 		frameBg:SetColorTexture(0, 0, 0, 0)
 		frameBg:SetVertexColor(0, 0, 0, 0)
-		frameBg.SetVertexColor = B.Dummy
+		frameBg.SetVertexColor = L.Dummy
 	end

 	local header = frame.header
 	if header then
-		reskinStatusBar(header)
+		ReskinStatusBar(header)
 		header:SetStatusBarColor(0, 0, 0, 0)
-		header.SetStatusBarColor = B.Dummy
+		header.SetStatusBarColor = L.Dummy
 		header.text:SetPoint("LEFT", header, 4, 0)
 	end

 	for _, child in pairs {frame:GetChildren()} do
 		if child:GetObjectType() == "StatusBar" and child.bg and child.val then
-			reskinStatusBar(child)
+			ReskinStatusBar(child)
 			child.bg:SetVertexColor(0, 0, 0, 0)
-			child.bg.SetVertexColor = B.Dummy
+			child.bg.SetVertexColor = L.Dummy
 		end
 	end
 end

-function S:ThreatClassic2()
+function ThreatClassic2()
 	if not IsAddOnLoaded("ThreatClassic2") then return end
-	if not S.db["ClassicThreatMeter"] then return end
-
-	P:Delay(.5, delayFunc)
+	DelayFunc()
 end

-S:RegisterSkin("ThreatClassic2", S.ThreatClassic2)
+rSkin:RegisterSkin("ThreatClassic2", ThreatClassic2)

-local function loadStyle(event, addon)
-	if addon ~= "ThreatClassic2" then return end
+-- local function LoadStyle(event, addon)
+-- 	if addon ~= "ThreatClassic2" then return end

-	local charKey = DB.MyName .. " - " .. DB.MyRealm
-	ThreatClassic2DB = ThreatClassic2DB or {}
-	ThreatClassic2DB["profileKeys"] = ThreatClassic2DB["profileKeys"] or {}
-	ThreatClassic2DB["profileKeys"][charKey] = ThreatClassic2DB["profileKeys"][charKey] or charKey
-	ThreatClassic2DB["profiles"] = ThreatClassic2DB["profiles"] or {}
-	ThreatClassic2DB["profiles"][charKey] = ThreatClassic2DB["profiles"][charKey] or {}
+-- 	local charKey = DB.MyName .. " - " .. DB.MyRealm
+-- 	ThreatClassic2DB = ThreatClassic2DB or {}
+-- 	ThreatClassic2DB["profileKeys"] = ThreatClassic2DB["profileKeys"] or {}
+-- 	ThreatClassic2DB["profileKeys"][charKey] = ThreatClassic2DB["profileKeys"][charKey] or charKey
+-- 	ThreatClassic2DB["profiles"] = ThreatClassic2DB["profiles"] or {}
+-- 	ThreatClassic2DB["profiles"][charKey] = ThreatClassic2DB["profiles"][charKey] or {}

-	local profileKey = ThreatClassic2DB["profileKeys"][charKey]
-	local profile = profileKey and ThreatClassic2DB["profiles"][profileKey]
-	if profile then
-		profile.bar = profile.bar or {}
-		profile.bar.texture = profile.bar.texture or "normTex"
-		profile.bar.padding = 2
-	end
+-- 	local profileKey = ThreatClassic2DB["profileKeys"][charKey]
+-- 	local profile = profileKey and ThreatClassic2DB["profiles"][profileKey]
+-- 	if profile then
+-- 		profile.bar = profile.bar or {}
+-- 		profile.bar.texture = profile.bar.texture or "normTex"
+-- 		profile.bar.padding = 2
+-- 	end

-	B:UnregisterEvent(event, loadStyle)
-end
+-- 	B:UnregisterEvent(event, loadStyle)
+-- end

-B:RegisterEvent("ADDON_LOADED", loadStyle)
\ No newline at end of file
+-- B:RegisterEvent("ADDON_LOADED", loadStyle)
\ No newline at end of file
diff --git a/rSkin/rSkin.toc b/rSkin/rSkin.toc
index f283788..eb26403 100644
--- a/rSkin/rSkin.toc
+++ b/rSkin/rSkin.toc
@@ -7,5 +7,5 @@

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