PageRenderTime 17ms CodeModel.GetById 11ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Tukui/modules/skins/achievementpopup.lua

http://github.com/Asphyxia/Tukui
Lua | 94 lines | 72 code | 17 blank | 5 comment | 13 complexity | 10c711c8580fefa4efdf9901bcbe811a MD5 | raw file
 1local T, C, L = unpack(select(2, ...))
 2
 3local function LoadSkin()
 4	local function SkinAchievePopUp()
 5		for i = 1, MAX_ACHIEVEMENT_ALERTS do
 6			local frame = _G["AchievementAlertFrame"..i]
 7			
 8			if frame then
 9				frame:SetAlpha(1)
10				frame.SetAlpha = T.dummy
11				if not frame.backdrop then
12					frame:CreateBackdrop("Transparent")
13					frame.backdrop:Point("TOPLEFT", _G[frame:GetName().."Background"], "TOPLEFT", -2, -6)
14					frame.backdrop:Point("BOTTOMRIGHT", _G[frame:GetName().."Background"], "BOTTOMRIGHT", -2, 6)		
15				end
16				
17				-- Background
18				_G["AchievementAlertFrame"..i.."Background"]:SetTexture(nil)
19
20				_G["AchievementAlertFrame"..i.."Glow"]:Kill()
21				_G["AchievementAlertFrame"..i.."Shine"]:Kill()
22				
23				-- Text
24				_G["AchievementAlertFrame"..i.."Unlocked"]:SetFont(C.media.font, 12)
25				_G["AchievementAlertFrame"..i.."Unlocked"]:SetTextColor(1, 1, 1)
26				_G["AchievementAlertFrame"..i.."Name"]:SetFont(C.media.font, 14)
27
28				-- Icon
29				_G["AchievementAlertFrame"..i.."IconTexture"]:SetTexCoord(0.08, 0.92, 0.08, 0.92)
30				_G["AchievementAlertFrame"..i.."IconOverlay"]:Kill()
31				
32				_G["AchievementAlertFrame"..i.."IconTexture"]:ClearAllPoints()
33				_G["AchievementAlertFrame"..i.."IconTexture"]:Point("LEFT", frame, 7, 0)
34				
35				if not _G["AchievementAlertFrame"..i.."IconTexture"].b then
36					_G["AchievementAlertFrame"..i.."IconTexture"].b = CreateFrame("Frame", nil, _G["AchievementAlertFrame"..i])
37					_G["AchievementAlertFrame"..i.."IconTexture"].b:SetFrameLevel(0)
38					_G["AchievementAlertFrame"..i.."IconTexture"].b:SetTemplate("Transparent")
39					_G["AchievementAlertFrame"..i.."IconTexture"].b:Point("TOPLEFT", _G["AchievementAlertFrame"..i.."IconTexture"], "TOPLEFT", -2, 2)
40					_G["AchievementAlertFrame"..i.."IconTexture"].b:Point("BOTTOMRIGHT", _G["AchievementAlertFrame"..i.."IconTexture"], "BOTTOMRIGHT", 2, -2)
41				end
42			end
43		end
44	end
45	hooksecurefunc("AchievementAlertFrame_FixAnchors", SkinAchievePopUp)
46
47	function SkinDungeonPopUP()
48		for i = 1, DUNGEON_COMPLETION_MAX_REWARDS do
49			local frame = _G["DungeonCompletionAlertFrame"..i]
50			if frame then
51				frame:SetAlpha(1)
52				frame.SetAlpha = T.dummy
53				if not frame.backdrop then
54					frame:CreateBackdrop("Transparent")
55					frame.backdrop:Point("TOPLEFT", frame, "TOPLEFT", -2, -6)
56					frame.backdrop:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -2, 6)		
57				end
58				
59				-- Background
60				for i=1, frame:GetNumRegions() do
61					local region = select(i, frame:GetRegions())
62					if region:GetObjectType() == "Texture" then
63						if region:GetTexture() == "Interface\\LFGFrame\\UI-LFG-DUNGEONTOAST" then
64							region:Kill()
65						end
66					end
67				end
68				
69				_G["DungeonCompletionAlertFrame"..i.."Shine"]:Kill()
70				
71				_G["DungeonCompletionAlertFrame"..i.."GlowFrame"]:Kill()
72				_G["DungeonCompletionAlertFrame"..i.."GlowFrame"].glow:Kill()
73				
74				-- Icon
75				_G["DungeonCompletionAlertFrame"..i.."DungeonTexture"]:SetTexCoord(0.08, 0.92, 0.08, 0.92)
76				
77				_G["DungeonCompletionAlertFrame"..i.."DungeonTexture"]:ClearAllPoints()
78				_G["DungeonCompletionAlertFrame"..i.."DungeonTexture"]:Point("LEFT", frame, 7, 0)
79				
80				if not _G["DungeonCompletionAlertFrame"..i.."DungeonTexture"].b then
81					_G["DungeonCompletionAlertFrame"..i.."DungeonTexture"].b = CreateFrame("Frame", nil, _G["DungeonCompletionAlertFrame"..i])
82					_G["DungeonCompletionAlertFrame"..i.."DungeonTexture"].b:SetFrameLevel(0)
83					_G["DungeonCompletionAlertFrame"..i.."DungeonTexture"].b:SetTemplate("Transparent")
84					_G["DungeonCompletionAlertFrame"..i.."DungeonTexture"].b:Point("TOPLEFT", _G["DungeonCompletionAlertFrame"..i.."DungeonTexture"], "TOPLEFT", -2, 2)
85					_G["DungeonCompletionAlertFrame"..i.."DungeonTexture"].b:Point("BOTTOMRIGHT", _G["DungeonCompletionAlertFrame"..i.."DungeonTexture"], "BOTTOMRIGHT", 2, -2)
86				end
87			end
88		end				
89	end
90
91	hooksecurefunc("DungeonCompletionAlertFrame_FixAnchors", SkinDungeonPopUP)
92end
93
94tinsert(T.SkinFuncs["Tukui"], LoadSkin)