diff 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
line wrap: on
line diff
--- a/Modules/WorldState.lua	Tue Oct 25 12:33:20 2016 -0400
+++ b/Modules/WorldState.lua	Sun Jan 01 18:25:26 2017 -0500
@@ -13,10 +13,14 @@
   addonTrigger = 'Blizzard_OrderHallUI',
   addonFrame = 'OrderHallCommandBar',
 }
+VeneerWorldStateHeadsUpMixin = {
+
+}
+
 VeneerWorldStateCurrencyMixin = {
 }
 VeneerWorldStateProgressMixin = {
-  keepOpen = true,
+  keepOpen = false,
 }
 VeneerWorldStateMixin = {
   maxHeight = 0,
@@ -107,7 +111,7 @@
   local lastFrame
   for i, frame in ipairs(self.modules) do
     print('  '..frame:GetName()..':',frame:IsShown(), frame:IsVisible(), frame:GetHeight())
-    if frame:IsShown() then
+    if frame:IsVisible() then
       if lastFrame then
         frame:SetPoint('TOP', lastFrame, 'BOTTOM')
       else
@@ -130,6 +134,9 @@
   if not isUpdate then
     Veneer:InternalReanchor(self, print)
   end
+
+  WorldStateAlwaysUpFrame:ClearAllPoints()
+  WorldStateAlwaysUpFrame:SetPoint('TOP', self, 'BOTTOM', 0, 0)
 end
 
 
@@ -204,23 +211,34 @@
 function VeneerWorldStateCurrencyMixin:OnEvent (event, arg)
   self:Update()
 end
+local zoneCurrency = {
+  ['Suramar'] = 1155,
+  ["Sashj'tar Ruins"] = 1155,
+  ["Faronaar Ruins"] = 1155
+}
+local zoneBountyInfo = {
+  ['Suramar'] = 1859,
+  ["Sashj'tar Ruins"] = 1859,
+  ["Faronaar Ruins"] = 1859,
 
-
+  ['Azsuna'] = 1900,
+}
+local globalBountyInfo = {
+}
 function VeneerWorldStateCurrencyMixin:Update(isBatchUpdate)
-
-  print('  Zone:', GetZoneText())
-  if GetZoneText() == 'Suramar' then
-    local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(1155)
-
-    self.Icon:SetTexture(texture)
-    self.Label:SetFormattedText("%d / %d", earned, totalMax)
-    self:Show()
-    self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6)
+  local zoneText = GetRealZoneText()
+  if zoneText then
+    local currency = zoneCurrency[zoneText]
+    if currency then
+      local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(zoneCurrency[zoneText])
+      self.Icon:SetTexture(texture)
+      self.Label:SetFormattedText("%d / %d", earned, totalMax)
+      self:Show()
+      self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6)
+    end
   else
     self:Hide()
   end
-
-
 end
 
 function VeneerWorldStateProgressMixin:OnUpdate(sinceLast)
@@ -228,15 +246,11 @@
   if self.keepOpen then
     return
   end
-  if self.timeLived >= 3 and not self.TransitionFadeOut:IsPlaying() then
-    if not self.timeOut then
-      self.timeOut = true
-      self.TimedFadeOut:Play()
-    end
+  if self.timeLived >= 3 and not self.TimedFadeOut:IsPlaying() then
+    self.TimedFadeOut:Play()
   end
 end
 
-
 function VeneerWorldStateProgressMixin:OnLoad()
   self:RegisterEvent('PLAYER_EQUIPMENT_CHANGED')
 
@@ -375,7 +389,7 @@
 function VeneerWorldStateProgressMixin:Update(isBatchUpdate)
 
   local progressChange = false
-  print('  current mode:', self.mode)
+  print('  current mode:', self.mode, 'vis:', self:IsVisible())
   if (not self.mode) or (not progressHandlers[self.mode]) then
     self:HidePanel()
     return
@@ -388,6 +402,7 @@
     self.timeLived = 0
   end
 
+
   if not self:IsVisible() then
     self.TransitionFadeIn:Play()
   else
@@ -454,8 +469,11 @@
       self.timeLived = 1000
     else
       self.keepOpen = true
+
+      self.modeChanged = true
     end
     print('keepOpen =', self.keepOpen)
+    self:Update()
   else
 
     if self.mode == 'xp' then
@@ -486,6 +504,7 @@
   function WorldStateBlockMixin:ShowPanel()
     print('|cFF0088FF'..self:GetName()..':ShowPanel()')
     self:SetShown(true)
+    self:SetAlpha(1)
     VeneerWorldState:Show()
   end
   function WorldStateBlockMixin:HidePanel()
@@ -522,4 +541,5 @@
     self.keepOpen = true
     self:Setup()
   end
-end
\ No newline at end of file
+end
+