Mercurial > wow > buffalo2
comparison Modules/WorldState.lua @ 114:6748c98a6c6c
- Reworked OrderHallHandler triggers
- OrderHallHandler minimializes hud info
- WorldState currency headers have a unified font
| author | Nick@Zahhak |
|---|---|
| date | Mon, 27 Mar 2017 00:39:29 -0400 |
| parents | 2105b6e5095f |
| children | 8c94bee4fdfc |
comparison
equal
deleted
inserted
replaced
| 113:2105b6e5095f | 114:6748c98a6c6c |
|---|---|
| 145 | 145 |
| 146 | 146 |
| 147 function VeneerWorldStateMixin:OnMouseDown() | 147 function VeneerWorldStateMixin:OnMouseDown() |
| 148 end | 148 end |
| 149 | 149 |
| 150 --- Order Hall mod | |
| 151 local requiresUpdate | |
| 152 local ocb | |
| 150 function VeneerOrderHallMixin:Setup() | 153 function VeneerOrderHallMixin:Setup() |
| 151 print('|cFFFFFF00'..self:GetName()..':Setup()') | 154 print('|cFFFFFF00'..self:GetName()..':Setup()') |
| 152 self:SetParent(OrderHallCommandBar) | 155 ocb = OrderHallCommandBar |
| 153 self:RegisterEvent("UNIT_AURA"); | 156 hooksecurefunc(ocb, 'RefreshCategories', function() |
| 154 self:RegisterEvent("GARRISON_FOLLOWER_CATEGORIES_UPDATED") | 157 requiresUpdate = true |
| 155 self:RegisterEvent("GARRISON_FOLLOWER_ADDED") | 158 end) |
| 156 self:RegisterEvent("GARRISON_FOLLOWER_REMOVED") | 159 hooksecurefunc(ocb, 'RefreshCurrency', |
| 157 | 160 function() |
| 158 self:SetShown(true) | 161 requiresUpdate = true |
| 162 end) | |
| 163 hooksecurefunc(ocb, 'SetShown', function(isShown) | |
| 164 self:SetShown(isShown) | |
| 165 end) | |
| 166 hooksecurefunc(ocb, 'RefreshAll', function() | |
| 167 self:Update() | |
| 168 end) | |
| 169 | |
| 170 ocb:ClearAllPoints() | |
| 171 ocb:SetAllPoints(self) | |
| 172 | |
| 173 | |
| 174 ocb.WorldMapButton:Hide() | |
| 175 ocb.AreaName:Hide() | |
| 176 | |
| 177 ocb.Currency:SetFontObject(VeneerHeaderFont) | |
| 178 ocb.Currency:ClearAllPoints() | |
| 179 ocb.Currency:SetPoint('BOTTOMLEFT', ocb.ClassIcon, 'BOTTOMRIGHT', 15, 0) | |
| 180 | |
| 181 ocb.CurrencyIcon:ClearAllPoints() | |
| 182 ocb.CurrencyIcon:SetPoint('TOP', ocb.ClassIcon, 'TOPRIGHT') | |
| 183 | |
| 184 ocb.Background:SetColorTexture(0,0,0,0.5) | |
| 185 | |
| 186 -- frame that calls up the resources tooltip | |
| 187 ocb.CurrencyHitTest:SetPoint('LEFT', ocb.CurrencyIcon, 'LEFT') | |
| 188 ocb.CurrencyHitTest:SetPoint('RIGHT', ocb.Currency, 'RIGHT') | |
| 189 | |
| 190 | |
| 191 self:SetSize(700, 23) | |
| 192 self:SetShown(ocb:IsShown()) | |
| 193 end | |
| 194 | |
| 195 function VeneerOrderHallMixin:OnUpdate() | |
| 196 if requiresUpdate then | |
| 197 self:Update() | |
| 198 end | |
| 199 | |
| 159 end | 200 end |
| 160 | 201 |
| 161 function VeneerOrderHallMixin:OnLoad() | 202 function VeneerOrderHallMixin:OnLoad() |
| 162 Veneer:AddHandler(self, 'TOP', 1) | 203 Veneer:AddHandler(self, 'TOP', 1) |
| 163 self:EnableMouse(false) | 204 self:EnableMouse(false) |
| 164 end | 205 end |
| 165 | 206 |
| 166 function VeneerOrderHallMixin:OnEvent(event, ...) | |
| 167 | |
| 168 print('|cFF00AAFF'..self:GetName()..'|r:'.. event, ...) | |
| 169 self:Update() | |
| 170 end | |
| 171 | 207 |
| 172 function VeneerOrderHallMixin:OnShow() | 208 function VeneerOrderHallMixin:OnShow() |
| 173 if OrderHallCommandBar then | 209 if ocb then |
| 174 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', OrderHallCommandBar:IsShown(), self:IsShown()) | 210 --self:Print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', ocb:IsShown(), self:IsShown()) |
| 175 self:Update() | 211 self:Update() |
| 176 end | 212 end |
| 177 Veneer:DynamicReanchor() | |
| 178 end | |
| 179 | |
| 180 function VeneerOrderHallMixin:OnHide() | |
| 181 if OrderHallCommandBar then | |
| 182 print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', OrderHallCommandBar:IsShown(), self:IsShown()) | |
| 183 end | |
| 184 Veneer:Reanchor() | |
| 185 end | 213 end |
| 186 | 214 |
| 187 function VeneerOrderHallMixin:Update() | 215 function VeneerOrderHallMixin:Update() |
| 188 if not OrderHallCommandBar then | 216 self:SetShown(ocb:IsShown()) |
| 189 print('|cFFFF4400'..self:GetName()..' updater called without target') | 217 local lastFrame |
| 190 return | 218 local categoriesWidth = 0 |
| 191 end | |
| 192 | |
| 193 OrderHallCommandBar:ClearAllPoints() | |
| 194 OrderHallCommandBar:SetAllPoints(self) | |
| 195 | |
| 196 OrderHallCommandBar.Background:SetColorTexture(0,0,0,0.5) | |
| 197 OrderHallCommandBar.WorldMapButton:Hide() | |
| 198 OrderHallCommandBar:EnableMouse(false) | |
| 199 self:SetSize(700, 22) | |
| 200 | |
| 201 local troops = OrderHallCommandBar.TroopSummary | 219 local troops = OrderHallCommandBar.TroopSummary |
| 202 if troops then | 220 if troops then |
| 203 for _, category in ipairs(troops) do | 221 for _, category in ipairs(troops) do |
| 204 category.Count:SetFontObject(VeneerNumberFont) | 222 category.Count:SetFontObject(VeneerHeaderFont) |
| 223 category.Count:SetTextColor(1,1,1,1) | |
| 205 category.Count:ClearAllPoints() | 224 category.Count:ClearAllPoints() |
| 206 category.Count:SetPoint('BOTTOMRIGHT', category.Icon, 'BOTTOMRIGHT', -1, 1) | 225 category.Count:SetPoint('BOTTOMRIGHT', category.Icon, 'BOTTOMRIGHT', -1, 1) |
| 207 end | 226 |
| 208 end | 227 category:ClearAllPoints() |
| 209 | 228 if lastFrame then |
| 210 | 229 lastFrame:SetPoint('TOPRIGHT', category, 'TOPLEFT', 0, 0) |
| 211 | 230 end |
| 212 print('|cFF00AAFF'..self:GetName()..'|r:Update()', OrderHallCommandBar:IsVisible(), self:IsShown()) | 231 category:SetSize(category.TroopPortraitCover:GetSize()) |
| 213 print(debugstack(6)) | 232 |
| 233 lastFrame = category | |
| 234 categoriesWidth = categoriesWidth + category:GetWidth() | |
| 235 end | |
| 236 | |
| 237 if lastFrame then | |
| 238 lastFrame:SetPoint('TOPRIGHT', ocb, 'TOPRIGHT', 0, 0) | |
| 239 end | |
| 240 | |
| 241 end | |
| 242 self:SetWidth(ocb.ClassIcon:GetWidth() + 15 + ocb.Currency:GetWidth() + ocb.CurrencyIcon:GetWidth() + categoriesWidth) | |
| 243 requiresUpdate = nil | |
| 244 --print('|cFF00AAFF'..self:GetName()..'|r:Update()', OrderHallCommandBar:IsVisible(), self:IsShown()) | |
| 245 --print(debugstack(6)) | |
| 214 Veneer:DynamicReanchor() | 246 Veneer:DynamicReanchor() |
| 215 end | 247 end |
| 216 | 248 |
| 217 | 249 |
| 218 | 250 |
