Mercurial > wow > reaction
comparison VehicleExitButton.lua @ 286:77609bfa804e stable
Merge 1.1 beta 8 to stable
author | Flick |
---|---|
date | Sat, 11 Jun 2011 10:57:00 -0700 |
parents | 5b9c0164a491 |
children | e337b39dc491 |
comparison
equal
deleted
inserted
replaced
272:71d1a5e47e72 | 286:77609bfa804e |
---|---|
1 local addonName, addonTable = ... | 1 local _, ns = ... |
2 local ReAction = addonTable.ReAction | 2 local ReAction = ns.ReAction |
3 local L = ReAction.L | 3 local L = ReAction.L |
4 local format = string.format | 4 local format = string.format |
5 | 5 |
6 -- | 6 -- |
7 -- VExitButton Button class | 7 -- VExitButton Button class |
27 | 27 |
28 ReAction.Button.VehicleExit = VExitButton | 28 ReAction.Button.VehicleExit = VExitButton |
29 ReAction:RegisterBarType(VExitButton) | 29 ReAction:RegisterBarType(VExitButton) |
30 | 30 |
31 function VExitButton:New( config, bar, idx ) | 31 function VExitButton:New( config, bar, idx ) |
32 local name = format("ReAction_%s_VehicleExit_%d",bar:GetName(),idx) | 32 self = Super.New(self, config, bar, idx, "SecureFrameTemplate, ActionButtonTemplate", "Button") |
33 | |
34 self = Super.New(self, name, config, bar, idx, "SecureFrameTemplate, ActionButtonTemplate", "Button") | |
35 | 33 |
36 -- frame setup | 34 -- frame setup |
37 local f = self:GetFrame() | 35 local f = self:GetFrame() |
38 self.frames.icon:SetTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up") | 36 self.frames.icon:SetTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up") |
39 self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) | 37 self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) |
94 | 92 |
95 function VExitButton:UpdateRegistration(bar) | 93 function VExitButton:UpdateRegistration(bar) |
96 -- auto show/hide when on a vehicle | 94 -- auto show/hide when on a vehicle |
97 local config = bar:GetConfig() | 95 local config = bar:GetConfig() |
98 local f = bar:GetFrame() | 96 local f = bar:GetFrame() |
99 if config.withControls then | 97 if config.withControls or ReAction:GetConfigMode() then |
100 if bar.vehicleExitStateRegistered then | 98 if bar.vehicleExitStateRegistered then |
101 UnregisterStateDriver(f, "unitexists") | 99 UnregisterStateDriver(f, "unitexists") |
102 bar.vehicleExitStateRegistered = false | 100 bar.vehicleExitStateRegistered = false |
103 end | 101 end |
104 bar:RegisterUnitWatch("vehicle",true) | 102 bar:RegisterUnitWatch("vehicle",not ReAction:GetConfigMode()) |
105 else | 103 else |
106 bar:RegisterUnitWatch("vehicle",false) | 104 bar:RegisterUnitWatch("vehicle",false) |
107 if not bar.vehicleExitStateRegistered then | 105 if not bar.vehicleExitStateRegistered then |
108 f:SetAttribute("unit","vehicle") | 106 f:SetAttribute("unit","vehicle") |
109 RegisterStateDriver(f, "unitexists", "[target=vehicle,exists,novehicleui] show; hide") -- spoof onstate-unitexists | 107 RegisterStateDriver(f, "unitexists", "[target=vehicle,exists,novehicleui] show; hide") -- spoof onstate-unitexists |