PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 5ms RepoModel.GetById 36ms app.codeStats 0ms

/Tukui/modules/actionbars/Others.lua

http://github.com/Asphyxia/Tukui
Lua | 65 lines | 51 code | 11 blank | 3 comment | 5 complexity | f945ec03aa8625534e31811e475b349d MD5 | raw file
 1
 2local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
 3if not C["actionbar"].enable == true then return end
 4---------------------------------------------------------------------------
 5-- Manage all others stuff for actionbars
 6---------------------------------------------------------------------------
 7
 8local TukuiOnLogon = CreateFrame("Frame")
 9TukuiOnLogon:RegisterEvent("PLAYER_ENTERING_WORLD")
10TukuiOnLogon:SetScript("OnEvent", function(self, event)
11	self:UnregisterEvent("PLAYER_ENTERING_WORLD")	
12	SetActionBarToggles(1, 1, 1, 1, 0)
13	SetCVar("alwaysShowActionBars", 0)	
14	if C["actionbar"].showgrid == true then
15		ActionButton_HideGrid = T.dummy
16		for i = 1, 12 do
17			local button = _G[format("ActionButton%d", i)]
18			button:SetAttribute("showgrid", 1)
19			ActionButton_ShowGrid(button)
20
21			button = _G[format("BonusActionButton%d", i)]
22			button:SetAttribute("showgrid", 1)
23			ActionButton_ShowGrid(button)
24			
25			button = _G[format("MultiBarRightButton%d", i)]
26			button:SetAttribute("showgrid", 1)
27			ActionButton_ShowGrid(button)
28
29			button = _G[format("MultiBarBottomRightButton%d", i)]
30			button:SetAttribute("showgrid", 1)
31			ActionButton_ShowGrid(button)
32			
33			button = _G[format("MultiBarLeftButton%d", i)]
34			button:SetAttribute("showgrid", 1)
35			ActionButton_ShowGrid(button)
36			
37			button = _G[format("MultiBarBottomLeftButton%d", i)]
38			button:SetAttribute("showgrid", 1)
39			ActionButton_ShowGrid(button)
40		end
41	end
42end)
43
44local function ModifiedBackdrop(self)
45	local color = RAID_CLASS_COLORS[T.myclass]
46	self:SetBackdropColor(color.r*.15, color.g*.15, color.b*.15)
47	self:SetBackdropBorderColor(color.r, color.g, color.b)
48end
49
50local function OriginalBackdrop(self)
51	self:SetTemplate("Default")
52end
53
54local vehicle = CreateFrame("Button", "TukuiExitVehicleButton", UIParent, "SecureHandlerClickTemplate")
55vehicle:CreatePanel("Default", T.buttonsize * 2, T.buttonsize + 1, "BOTTOMRIGHT", TukuiChatBackgroundRight, "BOTTOMLEFT", -3, 0)
56vehicle:CreateOverlay(vehicle)
57vehicle:RegisterForClicks("AnyUp")
58vehicle:SetScript("OnClick", function() VehicleExit() end)
59vehicle.text = T.SetFontString(vehicle, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
60vehicle.text:Point("CENTER", 1, 1)
61vehicle.text:SetText(T.datacolor.."Exit")
62RegisterStateDriver(vehicle, "visibility", "[target=vehicle,exists] show;hide")
63
64vehicle:HookScript("OnEnter", ModifiedBackdrop)
65vehicle:HookScript("OnLeave", OriginalBackdrop)