Mercurial > wow > buffalo2
comparison Modules/WorldState.lua @ 90:6e2cb847c3c6
Implement a mixin template for the basic visual config widgets.
author | Nenue |
---|---|
date | Mon, 24 Oct 2016 18:28:40 -0400 |
parents | 74e714637d6a |
children | caded2668701 |
comparison
equal
deleted
inserted
replaced
89:74e714637d6a | 90:6e2cb847c3c6 |
---|---|
5 -- | 5 -- |
6 | 6 |
7 local WorldStateBlockMixin = {} | 7 local WorldStateBlockMixin = {} |
8 VeneerOrderHallMixin = { | 8 VeneerOrderHallMixin = { |
9 anchorPoint = 'TOP', | 9 anchorPoint = 'TOP', |
10 anchorFrom = 'TOP', | |
11 anchorX = 0, | |
12 anchorY = 0, | |
13 addonTrigger = 'Blizzard_OrderHallUI', | |
14 addonFrame = 'OrderHallCommandBar', | |
10 } | 15 } |
11 VeneerWorldStateCurrencyMixin = { | 16 VeneerWorldStateCurrencyMixin = { |
12 } | 17 } |
13 VeneerWorldStateProgressMixin = { | 18 VeneerWorldStateProgressMixin = { |
14 keepOpen = true, | 19 keepOpen = true, |
64 self.modules = {self:GetChildren()} | 69 self.modules = {self:GetChildren()} |
65 print('|cFFFFFF00'..self:GetName()..'|r!') | 70 print('|cFFFFFF00'..self:GetName()..'|r!') |
66 self:RegisterEvent('PLAYER_ENTERING_WORLD') | 71 self:RegisterEvent('PLAYER_ENTERING_WORLD') |
67 self:RegisterEvent('PLAYER_REGEN_ENABLED') | 72 self:RegisterEvent('PLAYER_REGEN_ENABLED') |
68 self:RegisterEvent('PLAYER_REGEN_DISABLED') | 73 self:RegisterEvent('PLAYER_REGEN_DISABLED') |
69 self:RegisterEvent('ZONE_CHANGED_NEW_AREA') | |
70 self:RegisterEvent('ADDON_LOADED') | |
71 Veneer:AddHandler(self, self.anchorPoint, true) | 74 Veneer:AddHandler(self, self.anchorPoint, true) |
72 SLASH_VENEERWORLDSTATE1 = "/vws" | 75 SLASH_VENEERWORLDSTATE1 = "/vws" |
73 SLASH_VENEERWORLDSTATE2 = "/worldstate" | 76 SLASH_VENEERWORLDSTATE2 = "/worldstate" |
74 SlashCmdList.VENEERWORLDSTATE = function() | 77 SlashCmdList.VENEERWORLDSTATE = function() |
75 self:Reset() | 78 self:Reset() |
76 end | 79 end |
77 end | 80 end |
78 | 81 |
79 function VeneerWorldStateMixin:OnEvent(event, arg) | 82 function VeneerWorldStateMixin:OnEvent(event, arg) |
80 print(event, arg) | 83 print(event, arg) |
81 if event == 'ZONE_CHANGED_NEW_AREA' or event == 'ADDON_LOADED' then | 84 if event == 'PLAYER_ENTERING_WORLD' then |
82 if OrderHallCommandBar then | |
83 self:UnregisterEvent('ZONE_CHANGED_NEW_AREA') | |
84 self:UnregisterEvent('ADDON_LOADED') | |
85 Veneer:AddHandler(VeneerOrderHallHandler, 'TOP', true) | |
86 end | |
87 elseif event == 'PLAYER_ENTERING_WORLD' then | |
88 self:Update() | 85 self:Update() |
89 elseif event == 'PLAYER_REGEN_ENABLED' then | 86 elseif event == 'PLAYER_REGEN_ENABLED' then |
90 self:SetShown(true) | 87 self:SetShown(true) |
91 elseif event == 'PLAYER_REGEN_DISABLED' then | 88 elseif event == 'PLAYER_REGEN_DISABLED' then |
92 self:SetShown(false) | 89 self:SetShown(false) |
147 self:RegisterEvent("ZONE_CHANGED_INDOORS"); | 144 self:RegisterEvent("ZONE_CHANGED_INDOORS"); |
148 self:RegisterEvent("ZONE_CHANGED_NEW_AREA"); | 145 self:RegisterEvent("ZONE_CHANGED_NEW_AREA"); |
149 self:SetShown(true) | 146 self:SetShown(true) |
150 end | 147 end |
151 | 148 |
149 function VeneerOrderHallMixin:OnLoad() | |
150 | |
151 Veneer:AddHandler(VeneerOrderHallHandler, 'TOP', true) | |
152 end | |
153 | |
152 function VeneerOrderHallMixin:OnEvent(event, ...) | 154 function VeneerOrderHallMixin:OnEvent(event, ...) |
153 | 155 |
154 print('|cFF00AAFF'..self:GetName()..'|r:'.. event, ...) | 156 print('|cFF00AAFF'..self:GetName()..'|r:'.. event, ...) |
155 self:Update() | 157 self:Update() |
156 end | 158 end |
157 | 159 |
158 function VeneerOrderHallMixin:OnShow() | 160 function VeneerOrderHallMixin:OnShow() |
159 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', OrderHallCommandBar:IsShown(), self:IsShown()) | 161 if OrderHallCommandBar then |
160 self:Update() | 162 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', OrderHallCommandBar:IsShown(), self:IsShown()) |
163 self:Update() | |
164 end | |
161 Veneer:InternalReanchor(self) | 165 Veneer:InternalReanchor(self) |
162 end | 166 end |
163 | 167 |
164 function VeneerOrderHallMixin:OnHide() | 168 function VeneerOrderHallMixin:OnHide() |
165 print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', OrderHallCommandBar:IsShown(), self:IsShown()) | 169 if OrderHallCommandBar then |
170 print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', OrderHallCommandBar:IsShown(), self:IsShown()) | |
171 end | |
166 Veneer:Reanchor() | 172 Veneer:Reanchor() |
167 end | 173 end |
168 | 174 |
169 function VeneerOrderHallMixin:Update() | 175 function VeneerOrderHallMixin:Update() |
170 | 176 |