Mercurial > wow > buffalo2
comparison Modules/WorldState.lua @ 108:a41f6b74709a
- Handler number and boolean cluster arguments as positioning priority layer and "always top" respectively
- Use SetShown and IsShown instead of IsVisible in doing full re-anchor checks
| author | Nick@Zahhak |
|---|---|
| date | Sat, 25 Feb 2017 11:42:07 -0500 |
| parents | 74d6d97a2d24 |
| children | 1196c2bad31c |
comparison
equal
deleted
inserted
replaced
| 107:ff00679a7817 | 108:a41f6b74709a |
|---|---|
| 73 self.modules = {self:GetChildren()} | 73 self.modules = {self:GetChildren()} |
| 74 print('|cFFFFFF00'..self:GetName()..'|r!') | 74 print('|cFFFFFF00'..self:GetName()..'|r!') |
| 75 self:RegisterEvent('PLAYER_ENTERING_WORLD') | 75 self:RegisterEvent('PLAYER_ENTERING_WORLD') |
| 76 self:RegisterEvent('PLAYER_REGEN_ENABLED') | 76 self:RegisterEvent('PLAYER_REGEN_ENABLED') |
| 77 self:RegisterEvent('PLAYER_REGEN_DISABLED') | 77 self:RegisterEvent('PLAYER_REGEN_DISABLED') |
| 78 Veneer:AddHandler(self, self.anchorPoint, true) | 78 Veneer:AddHandler(self, self.anchorPoint, 2) |
| 79 SLASH_VENEERWORLDSTATE1 = "/vws" | 79 SLASH_VENEERWORLDSTATE1 = "/vws" |
| 80 SLASH_VENEERWORLDSTATE2 = "/worldstate" | 80 SLASH_VENEERWORLDSTATE2 = "/worldstate" |
| 81 SlashCmdList.VENEERWORLDSTATE = function() | 81 SlashCmdList.VENEERWORLDSTATE = function() |
| 82 self:Reset() | 82 self:Reset() |
| 83 end | 83 end |
| 84 end | 84 end |
| 85 | 85 |
| 86 function VeneerWorldStateMixin:OnEvent(event, arg) | 86 function VeneerWorldStateMixin:OnEvent(event, arg) |
| 87 print(event, arg) | 87 print(event, arg) |
| 88 if event == 'PLAYER_ENTERING_WORLD' then | 88 if event == 'PLAYER_ENTERING_WORLD' then |
| 89 self:Show() | |
| 90 self:Update() | 89 self:Update() |
| 91 elseif event == 'PLAYER_REGEN_ENABLED' then | 90 elseif event == 'PLAYER_REGEN_ENABLED' then |
| 92 self:SetShown(true) | 91 self:Update(true) |
| 93 elseif event == 'PLAYER_REGEN_DISABLED' then | 92 elseif event == 'PLAYER_REGEN_DISABLED' then |
| 94 self:SetShown(false) | 93 self:Update(true) |
| 95 end | 94 end |
| 96 end | 95 end |
| 97 | 96 |
| 98 function VeneerWorldStateMixin:Update(isBatchUpdate) | 97 function VeneerWorldStateMixin:Update(isBatchUpdate) |
| 99 print('|cFFFFFF00All:Update()|r') | 98 print('|cFFFFFF00All:Update()|r') |
| 104 print(' ', frame:IsVisible(), frame:IsShown()) | 103 print(' ', frame:IsVisible(), frame:IsShown()) |
| 105 end | 104 end |
| 106 end | 105 end |
| 107 end | 106 end |
| 108 | 107 |
| 108 function VeneerWorldStateMixin:OnShow() | |
| 109 print('OnShow()', debugstack()) | |
| 110 end | |
| 111 | |
| 109 function VeneerWorldStateMixin:Reanchor(isUpdate) | 112 function VeneerWorldStateMixin:Reanchor(isUpdate) |
| 110 print(' |cFF0088FF'..self:GetName()..':Reanchor()|r', #self.modules, 'blocks') | 113 print(' |cFF0088FF'..self:GetName()..':Reanchor()|r', #self.modules, 'blocks') |
| 111 self.maxHeight = 0 | 114 self.maxHeight = 0 |
| 112 local lastFrame | 115 local lastFrame |
| 113 for i, frame in ipairs(self.modules) do | 116 for i, frame in ipairs(self.modules) do |
| 114 print(' '..frame:GetName()..':',frame:IsShown(), frame:IsVisible(), frame:GetHeight()) | 117 print(' '..frame:GetName()..':',frame:IsShown(), frame:GetHeight()) |
| 115 if frame:IsVisible() then | 118 if frame:IsShown() then |
| 116 if lastFrame then | 119 if lastFrame then |
| 117 frame:SetPoint('TOP', lastFrame, 'BOTTOM') | 120 frame:SetPoint('TOP', lastFrame, 'BOTTOM') |
| 118 else | 121 else |
| 119 frame:SetPoint('TOP', self, 'TOP') | 122 frame:SetPoint('TOP', self, 'TOP') |
| 120 end | 123 end |
| 121 | 124 |
| 122 self.maxHeight = self.maxHeight + frame:GetHeight() | 125 self.maxHeight = self.maxHeight + frame:GetHeight() |
| 123 lastFrame = frame | 126 lastFrame = frame |
| 124 end | 127 end |
| 125 end | 128 end |
| 126 if self.maxHeight == 0 then | 129 if (self.maxHeight == 0) or InCombatLockdown() then |
| 127 print (' hiding because there are no blocks') | 130 print (' hiding; combat =', InCombatLockdown()) |
| 128 self:Hide() | 131 self:SetShown(false) |
| 129 else | 132 else |
| 130 self:Show() | |
| 131 print (' height update:', self.maxHeight) | 133 print (' height update:', self.maxHeight) |
| 132 self:SetHeight(self.maxHeight) | 134 self:SetHeight(self.maxHeight) |
| 135 self:SetShown(true) | |
| 133 end | 136 end |
| 134 | 137 |
| 135 if not isUpdate then | 138 if not isUpdate then |
| 136 Veneer:InternalReanchor(self, print) | 139 Veneer:InternalReanchor(self, print) |
| 137 end | 140 end |
| 153 self:RegisterEvent("ZONE_CHANGED_NEW_AREA"); | 156 self:RegisterEvent("ZONE_CHANGED_NEW_AREA"); |
| 154 self:SetShown(true) | 157 self:SetShown(true) |
| 155 end | 158 end |
| 156 | 159 |
| 157 function VeneerOrderHallMixin:OnLoad() | 160 function VeneerOrderHallMixin:OnLoad() |
| 158 Veneer:AddHandler(self, 'TOP', true) | 161 Veneer:AddHandler(self, 'TOP', 1) |
| 159 end | 162 end |
| 160 | 163 |
| 161 function VeneerOrderHallMixin:OnEvent(event, ...) | 164 function VeneerOrderHallMixin:OnEvent(event, ...) |
| 162 | 165 |
| 163 print('|cFF00AAFF'..self:GetName()..'|r:'.. event, ...) | 166 print('|cFF00AAFF'..self:GetName()..'|r:'.. event, ...) |
| 185 print('|cFFFF4400'..self:GetName()..' updater called without target') | 188 print('|cFFFF4400'..self:GetName()..' updater called without target') |
| 186 return | 189 return |
| 187 end | 190 end |
| 188 | 191 |
| 189 OrderHallCommandBar:ClearAllPoints() | 192 OrderHallCommandBar:ClearAllPoints() |
| 190 OrderHallCommandBar:SetPoint('TOP', UIParent, 'TOP') | 193 OrderHallCommandBar:SetAllPoints(self) |
| 191 OrderHallCommandBar:SetWidth(600) | 194 OrderHallCommandBar:SetWidth(600) |
| 192 OrderHallCommandBar.Background:SetColorTexture(0,0,0,0.5) | 195 OrderHallCommandBar.Background:SetColorTexture(0,0,0,0.5) |
| 193 OrderHallCommandBar.WorldMapButton:Hide() | 196 OrderHallCommandBar.WorldMapButton:Hide() |
| 194 OrderHallCommandBar:EnableMouse(false) | 197 OrderHallCommandBar:EnableMouse(false) |
| 195 self:SetSize(OrderHallCommandBar:GetSize()) | 198 self:SetSize(OrderHallCommandBar:GetSize()) |
