PageRenderTime 16ms CodeModel.GetById 9ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/Tukui/modules/blizzard/timertracker.lua

http://github.com/Asphyxia/Tukui
Lua | 41 lines | 33 code | 8 blank | 0 comment | 6 complexity | f769570d5540fa07932ba010e1c7d84b MD5 | raw file
 1local T, C, L = unpack(select(2, ...))
 2
 3local function SkinIt(bar)	
 4	local _, originalPoint, _, _, _ = bar:GetPoint()
 5	
 6	bar:ClearAllPoints()
 7	bar:Point("TOPLEFT", originalPoint, "TOPLEFT", 2, -2)
 8	bar:Point("BOTTOMRIGHT", originalPoint, "BOTTOMRIGHT", -2, 2)
 9		
10	for i=1, bar:GetNumRegions() do
11		local region = select(i, bar:GetRegions())
12		if region:GetObjectType() == "Texture" then
13			region:SetTexture(nil)
14		elseif region:GetObjectType() == "FontString" then
15			region:SetFont(C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
16			region:SetShadowColor(0,0,0,0)
17		end
18	end
19	
20	bar:SetStatusBarTexture(C["media"].blank)
21	bar:SetStatusBarColor(170/255, 10/255, 10/255)
22	
23	bar.backdrop = CreateFrame("Frame", nil, bar)
24	bar.backdrop:SetFrameLevel(0)
25	bar.backdrop:SetTemplate("Default")
26	bar.backdrop:SetAllPoints(originalPoint)
27end
28
29
30local function SkinBlizzTimer(self, event)
31	for _, b in pairs(TimerTracker.timerList) do
32		if not b["bar"].skinned then
33			SkinIt(b["bar"])
34			b["bar"].skinned = true
35		end
36	end
37end
38
39local load = CreateFrame("Frame")
40load:RegisterEvent("START_TIMER")
41load:SetScript("OnEvent", SkinBlizzTimer)