Quantcast
local A, L = ...

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

	local LE, LC, LL = unpack(_G.ls_Toasts)
	LE:RegisterSkin(strlower(L.C.style), {
		name = L.C.style,
		border = {
			color = {0, 0, 0},
			offset = 0,
			size = 1,
			texture = {1, 1, 1, 1},
		},
		icon = {
			tex_coords = L.C.button.icon.texCoord,
		},
		icon_border = {
			color = {0, 0, 0},
			offset = 0,
			size = 1,
			texture = {1, 1, 1, 1},
		},
		slot = {
			tex_coords = L.C.button.icon.texCoord,
		},
		slot_border = {
			color = {0, 0, 0},
			offset = 0,
			size = 1,
			texture = {1, 1, 1, 1},
		},
		glow = {
			texture = {1, 1, 1, 1},
			size = {226, 50},
		},
		shine = {
			tex_coords = {403 / 512, 465 / 512, 15 / 256, 61 / 256},
			size = {67, 50},
			point = {
				y = -1,
			},
		},
		text_bg = {
			hidden = true,
		},
		dragon = {
			hidden = true,
		},
		icon_highlight = {
			hidden = true,
		},
		bg = {
			default = {
				texture = {0.06, 0.06, 0.06, 0.8},
			},
		},
	})

	LC.db.profile.skin = strlower(L.C.style)
	LC.options.args.general.args.skin.disabled = true

	local function reskinFunc()
		local index = 1
		local toast = _G["LSToast"..index]
		while toast do
			if toast.BG and not toast.styled then
				toast.BG:SetTexture(nil)
				L.CreateBackdrop(toast)
				toast.SetBackground = L.Dummy
				toast.styled = true
			end
			index = index + 1
			toast = _G["LSToast"..index]
		end
	end
	hooksecurefunc(LE, "GetToast", reskinFunc)
end

rSkin:RegisterSkin("ls_Toasts", ls_Toasts)