diff QuestPOI.lua @ 34:0100d923d8c3

WorldPlan: - Reward filter toggle changed to clear out other reward filters. The assumption being that one is most often looking only for that particular type of quest when they go to use it. - Fixed filter bar info falling out of sync after player-triggered world map updates. - Code stuff: -- Quest pin shown-state management makes better use of OnShow OnHide handlers, SetShown is toggled and it all goes from there -- WorldQuests module re-factored outside of the top level frame script. ClassPlan: - Available missions are now recorded; the mission list can be toggled between in-progress and available by clicking the heading.
author Nenue
date Wed, 02 Nov 2016 19:04:47 -0400
parents be4db60219ca
children 26dfa661daa7
line wrap: on
line diff
--- a/QuestPOI.lua	Wed Nov 02 17:25:07 2016 -0400
+++ b/QuestPOI.lua	Wed Nov 02 19:04:47 2016 -0400
@@ -344,23 +344,57 @@
   print('cheevos')
 end
 
-function WorldPlanPOIMixin:ShowNew()
-  self:SetShown(true)
-  self.isNew = nil
-  self.isStale = true
-  self.FadeIn:Play()
+-- run from OnShow if .isNew is set
+function WorldPlanPOIMixin:OnNew()
+  self:SetAlpha(0)
+
+  if WorldPlan.db.FadeWhileGrouped then
+    self.FadeIn.FadeIn:SetToAlpha(0.15)
+    self.PendingFade.FadeIn:SetToAlpha(0.15)
+    self.PendingFade.FadeIn:SetFromAlpha(0.15)
+  else
+    self.FadeIn.FadeIn:SetToAlpha(1)
+    self.PendingFade.FadeIn:SetToAlpha(1)
+    self.PendingFade.FadeIn:SetFromAlpha(1)
+  end
+  if not self.isAnimating then
+    self.isAnimating = true
+    WorldPlan:OnNext(function()
+      self.isNew = nil
+      self.FadeIn:Play()
+    end)
+  end
 end
 
 function WorldPlanPOIMixin:OnShow ()
   qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
   -- pop this on principle
-  if self.isStale then
+
+  if self.isNew or self.isStale then
     self:Refresh()
   end
 
+
+  -- is it a new quest?
+  if self.isNew then
+    WorldPlan:print('|cFF0088FF', self.title, '|r', self.isNew and 'new', self.isStale and 'stale', self.isAnimating and 'animating')
+    self:OnNew()
+    -- trap new but animating pins here
+  else
+    -- hard show existing self
+    --print('refresh #', questID, 'filtered:', self.filtered, 'hasUpdate', self.hasUpdate)
+    self:Show()
+  end
+
+
 end
 function WorldPlanPOIMixin:OnHide()
   qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
+  if not self:IsShown() then
+    self.isAnimating = nil
+    self:SetAlpha(0)
+  end
+
 end
 
 function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight)
@@ -581,7 +615,7 @@
       self.used = nil
     end
   end
-  print('  |cFFFF4400IsShowable()|r', self.used, self.filtered, self.title)
+  print('  |cFFFF4400IsShowable()|r', self.isNew, self.isAnimating, self.used, self.filtered, self.title)
   return self.used, self.filtered
 end