Mercurial > wow > buffalo2
comparison Modules/WorldState.lua @ 93:caded2668701
Curseforge migration and source tree cleaning
author | Nenue |
---|---|
date | Sun, 01 Jan 2017 18:25:26 -0500 |
parents | 6e2cb847c3c6 |
children | bb38bc0e787f |
comparison
equal
deleted
inserted
replaced
92:d41c7dc3012f | 93:caded2668701 |
---|---|
11 anchorX = 0, | 11 anchorX = 0, |
12 anchorY = 0, | 12 anchorY = 0, |
13 addonTrigger = 'Blizzard_OrderHallUI', | 13 addonTrigger = 'Blizzard_OrderHallUI', |
14 addonFrame = 'OrderHallCommandBar', | 14 addonFrame = 'OrderHallCommandBar', |
15 } | 15 } |
16 VeneerWorldStateHeadsUpMixin = { | |
17 | |
18 } | |
19 | |
16 VeneerWorldStateCurrencyMixin = { | 20 VeneerWorldStateCurrencyMixin = { |
17 } | 21 } |
18 VeneerWorldStateProgressMixin = { | 22 VeneerWorldStateProgressMixin = { |
19 keepOpen = true, | 23 keepOpen = false, |
20 } | 24 } |
21 VeneerWorldStateMixin = { | 25 VeneerWorldStateMixin = { |
22 maxHeight = 0, | 26 maxHeight = 0, |
23 detectedFrames = {}, | 27 detectedFrames = {}, |
24 anchorPoint = 'TOP', | 28 anchorPoint = 'TOP', |
105 print(' |cFF0088FF'..self:GetName()..':Reanchor()|r', #self.modules, 'blocks') | 109 print(' |cFF0088FF'..self:GetName()..':Reanchor()|r', #self.modules, 'blocks') |
106 self.maxHeight = 0 | 110 self.maxHeight = 0 |
107 local lastFrame | 111 local lastFrame |
108 for i, frame in ipairs(self.modules) do | 112 for i, frame in ipairs(self.modules) do |
109 print(' '..frame:GetName()..':',frame:IsShown(), frame:IsVisible(), frame:GetHeight()) | 113 print(' '..frame:GetName()..':',frame:IsShown(), frame:IsVisible(), frame:GetHeight()) |
110 if frame:IsShown() then | 114 if frame:IsVisible() then |
111 if lastFrame then | 115 if lastFrame then |
112 frame:SetPoint('TOP', lastFrame, 'BOTTOM') | 116 frame:SetPoint('TOP', lastFrame, 'BOTTOM') |
113 else | 117 else |
114 frame:SetPoint('TOP', self, 'TOP') | 118 frame:SetPoint('TOP', self, 'TOP') |
115 end | 119 end |
128 end | 132 end |
129 | 133 |
130 if not isUpdate then | 134 if not isUpdate then |
131 Veneer:InternalReanchor(self, print) | 135 Veneer:InternalReanchor(self, print) |
132 end | 136 end |
137 | |
138 WorldStateAlwaysUpFrame:ClearAllPoints() | |
139 WorldStateAlwaysUpFrame:SetPoint('TOP', self, 'BOTTOM', 0, 0) | |
133 end | 140 end |
134 | 141 |
135 | 142 |
136 | 143 |
137 function VeneerWorldStateMixin:OnMouseDown() | 144 function VeneerWorldStateMixin:OnMouseDown() |
202 end | 209 end |
203 | 210 |
204 function VeneerWorldStateCurrencyMixin:OnEvent (event, arg) | 211 function VeneerWorldStateCurrencyMixin:OnEvent (event, arg) |
205 self:Update() | 212 self:Update() |
206 end | 213 end |
207 | 214 local zoneCurrency = { |
208 | 215 ['Suramar'] = 1155, |
216 ["Sashj'tar Ruins"] = 1155, | |
217 ["Faronaar Ruins"] = 1155 | |
218 } | |
219 local zoneBountyInfo = { | |
220 ['Suramar'] = 1859, | |
221 ["Sashj'tar Ruins"] = 1859, | |
222 ["Faronaar Ruins"] = 1859, | |
223 | |
224 ['Azsuna'] = 1900, | |
225 } | |
226 local globalBountyInfo = { | |
227 } | |
209 function VeneerWorldStateCurrencyMixin:Update(isBatchUpdate) | 228 function VeneerWorldStateCurrencyMixin:Update(isBatchUpdate) |
210 | 229 local zoneText = GetRealZoneText() |
211 print(' Zone:', GetZoneText()) | 230 if zoneText then |
212 if GetZoneText() == 'Suramar' then | 231 local currency = zoneCurrency[zoneText] |
213 local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(1155) | 232 if currency then |
214 | 233 local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(zoneCurrency[zoneText]) |
215 self.Icon:SetTexture(texture) | 234 self.Icon:SetTexture(texture) |
216 self.Label:SetFormattedText("%d / %d", earned, totalMax) | 235 self.Label:SetFormattedText("%d / %d", earned, totalMax) |
217 self:Show() | 236 self:Show() |
218 self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6) | 237 self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6) |
238 end | |
219 else | 239 else |
220 self:Hide() | 240 self:Hide() |
221 end | 241 end |
222 | |
223 | |
224 end | 242 end |
225 | 243 |
226 function VeneerWorldStateProgressMixin:OnUpdate(sinceLast) | 244 function VeneerWorldStateProgressMixin:OnUpdate(sinceLast) |
227 self.timeLived = (self.timeLived or 0) + sinceLast | 245 self.timeLived = (self.timeLived or 0) + sinceLast |
228 if self.keepOpen then | 246 if self.keepOpen then |
229 return | 247 return |
230 end | 248 end |
231 if self.timeLived >= 3 and not self.TransitionFadeOut:IsPlaying() then | 249 if self.timeLived >= 3 and not self.TimedFadeOut:IsPlaying() then |
232 if not self.timeOut then | 250 self.TimedFadeOut:Play() |
233 self.timeOut = true | 251 end |
234 self.TimedFadeOut:Play() | 252 end |
235 end | |
236 end | |
237 end | |
238 | |
239 | 253 |
240 function VeneerWorldStateProgressMixin:OnLoad() | 254 function VeneerWorldStateProgressMixin:OnLoad() |
241 self:RegisterEvent('PLAYER_EQUIPMENT_CHANGED') | 255 self:RegisterEvent('PLAYER_EQUIPMENT_CHANGED') |
242 | 256 |
243 self:RegisterEvent("PLAYER_XP_UPDATE"); | 257 self:RegisterEvent("PLAYER_XP_UPDATE"); |
373 } | 387 } |
374 | 388 |
375 function VeneerWorldStateProgressMixin:Update(isBatchUpdate) | 389 function VeneerWorldStateProgressMixin:Update(isBatchUpdate) |
376 | 390 |
377 local progressChange = false | 391 local progressChange = false |
378 print(' current mode:', self.mode) | 392 print(' current mode:', self.mode, 'vis:', self:IsVisible()) |
379 if (not self.mode) or (not progressHandlers[self.mode]) then | 393 if (not self.mode) or (not progressHandlers[self.mode]) then |
380 self:HidePanel() | 394 self:HidePanel() |
381 return | 395 return |
382 end | 396 end |
383 | 397 |
385 self:SetSize(600,16) | 399 self:SetSize(600,16) |
386 if hasNewInfo then | 400 if hasNewInfo then |
387 self.timeOut = nil | 401 self.timeOut = nil |
388 self.timeLived = 0 | 402 self.timeLived = 0 |
389 end | 403 end |
404 | |
390 | 405 |
391 if not self:IsVisible() then | 406 if not self:IsVisible() then |
392 self.TransitionFadeIn:Play() | 407 self.TransitionFadeIn:Play() |
393 else | 408 else |
394 self:ShowPanel() | 409 self:ShowPanel() |
452 if self.keepOpen then | 467 if self.keepOpen then |
453 self.keepOpen = nil | 468 self.keepOpen = nil |
454 self.timeLived = 1000 | 469 self.timeLived = 1000 |
455 else | 470 else |
456 self.keepOpen = true | 471 self.keepOpen = true |
472 | |
473 self.modeChanged = true | |
457 end | 474 end |
458 print('keepOpen =', self.keepOpen) | 475 print('keepOpen =', self.keepOpen) |
476 self:Update() | |
459 else | 477 else |
460 | 478 |
461 if self.mode == 'xp' then | 479 if self.mode == 'xp' then |
462 self.mode = 'artifact' | 480 self.mode = 'artifact' |
463 else | 481 else |
484 | 502 |
485 do | 503 do |
486 function WorldStateBlockMixin:ShowPanel() | 504 function WorldStateBlockMixin:ShowPanel() |
487 print('|cFF0088FF'..self:GetName()..':ShowPanel()') | 505 print('|cFF0088FF'..self:GetName()..':ShowPanel()') |
488 self:SetShown(true) | 506 self:SetShown(true) |
507 self:SetAlpha(1) | |
489 VeneerWorldState:Show() | 508 VeneerWorldState:Show() |
490 end | 509 end |
491 function WorldStateBlockMixin:HidePanel() | 510 function WorldStateBlockMixin:HidePanel() |
492 print('|cFF0088FF'..self:GetName()..':HidePanel()') | 511 print('|cFF0088FF'..self:GetName()..':HidePanel()') |
493 self:SetShown(false) | 512 self:SetShown(false) |
521 print('|cFF0088FF'..self:GetName()..':Reset()') | 540 print('|cFF0088FF'..self:GetName()..':Reset()') |
522 self.keepOpen = true | 541 self.keepOpen = true |
523 self:Setup() | 542 self:Setup() |
524 end | 543 end |
525 end | 544 end |
545 |