changeset 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
files Modules/Currency.lua Modules/Currency.xml Modules/WorldState.lua
diffstat 3 files changed, 101 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/Modules/Currency.lua	Sun Mar 26 06:25:18 2017 -0400
+++ b/Modules/Currency.lua	Mon Mar 27 00:39:29 2017 -0400
@@ -85,6 +85,7 @@
       frame.Update = function (block)
         debug('Update [Currency]')
         local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(currencyID)
+        
         block.Icon:SetTexture(texture)
         block.Label:SetFormattedText("%d / %d", earned, totalMax)
         block:SetWidth(block.Icon:GetWidth() + block.Label:GetStringWidth() + 6)
@@ -186,6 +187,23 @@
   end
 end
 
+function block:OnEnter()
+  if not InCombatLockdown() then
+    GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT");
+    if self.currencyID then
+      GameTooltip:SetCurrencyTokenByID(self.currencyID);
+    else
+      GameTooltip:SetItemByID(self.itemID);
+    end
+    GameTooltip:Show();
+  end
+end
+function block:OnLeave()
+  if GameTooltip:IsOwned(self) then
+    GameTooltip_Hide()
+  end
+end
+
 function block:OnEvent(event, ...)
   print('|cFF0088FF<'..self.name..'>|r', 'OnEvent', event, ...)
   self:Update()
--- a/Modules/Currency.xml	Sun Mar 26 06:25:18 2017 -0400
+++ b/Modules/Currency.xml	Mon Mar 27 00:39:29 2017 -0400
@@ -8,20 +8,28 @@
             <OnEvent method="OnEvent" />
             <OnShow method="OnShow" />
             <OnHide method="OnHide" />
+            <OnEnter method="OnEnter" />
+            <OnLeave method="OnLeave"/>
+
         </Scripts>
         <Layers>
+            <Layer level="BACKGROUND">
+                <Texture setAllPoints="true" parentKey="Background">
+                    <Color a="0.5" r="0" g="0" b="0" />
+                </Texture>
+            </Layer>
             <Layer level="ARTWORK">
                 <Texture parentKey="Icon" >
-                    <Size x="16" y="16" />
+                    <Size x="20" y="20" />
                     <Anchors>
                         <Anchor point="LEFT" />
                     </Anchors>
                 </Texture>
             </Layer>
             <Layer level="OVERLAY">
-                <FontString parentKey="Label" inherits="VeneerNumberFont">
+                <FontString parentKey="Label" inherits="VeneerHeaderFont">
                     <Anchors>
-                        <Anchor point="LEFT" relativePoint="RIGHT" relativeKey="$parent.Icon" x="2" y="0" />
+                        <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT" relativeKey="$parent.Icon" x="2" y="0" />
                     </Anchors>
                 </FontString>
             </Layer>
--- a/Modules/WorldState.lua	Sun Mar 26 06:25:18 2017 -0400
+++ b/Modules/WorldState.lua	Mon Mar 27 00:39:29 2017 -0400
@@ -147,15 +147,56 @@
 function VeneerWorldStateMixin:OnMouseDown()
 end
 
+--- Order Hall mod
+local requiresUpdate
+local ocb
 function VeneerOrderHallMixin:Setup()
   print('|cFFFFFF00'..self:GetName()..':Setup()')
-  self:SetParent(OrderHallCommandBar)
-  self:RegisterEvent("UNIT_AURA");
-  self:RegisterEvent("GARRISON_FOLLOWER_CATEGORIES_UPDATED")
-  self:RegisterEvent("GARRISON_FOLLOWER_ADDED")
-  self:RegisterEvent("GARRISON_FOLLOWER_REMOVED")
+  ocb = OrderHallCommandBar
+  hooksecurefunc(ocb, 'RefreshCategories', function()
+    requiresUpdate = true
+  end)
+  hooksecurefunc(ocb, 'RefreshCurrency',
+    function()
+      requiresUpdate = true
+    end)
+  hooksecurefunc(ocb, 'SetShown', function(isShown)
+    self:SetShown(isShown)
+  end)
+  hooksecurefunc(ocb, 'RefreshAll', function()
+    self:Update()
+  end)
 
-  self:SetShown(true)
+  ocb:ClearAllPoints()
+  ocb:SetAllPoints(self)
+
+
+  ocb.WorldMapButton:Hide()
+  ocb.AreaName:Hide()
+
+  ocb.Currency:SetFontObject(VeneerHeaderFont)
+  ocb.Currency:ClearAllPoints()
+  ocb.Currency:SetPoint('BOTTOMLEFT', ocb.ClassIcon, 'BOTTOMRIGHT', 15, 0)
+
+  ocb.CurrencyIcon:ClearAllPoints()
+  ocb.CurrencyIcon:SetPoint('TOP', ocb.ClassIcon, 'TOPRIGHT')
+  
+  ocb.Background:SetColorTexture(0,0,0,0.5)
+
+  -- frame that calls up the resources tooltip
+  ocb.CurrencyHitTest:SetPoint('LEFT', ocb.CurrencyIcon, 'LEFT')
+  ocb.CurrencyHitTest:SetPoint('RIGHT', ocb.Currency, 'RIGHT')
+  
+  
+  self:SetSize(700, 23)
+  self:SetShown(ocb:IsShown())
+end
+
+function VeneerOrderHallMixin:OnUpdate()
+  if requiresUpdate then
+    self:Update()
+  end
+  
 end
 
 function VeneerOrderHallMixin:OnLoad()
@@ -163,54 +204,45 @@
   self:EnableMouse(false)
 end
 
-function VeneerOrderHallMixin:OnEvent(event, ...)
-
-  print('|cFF00AAFF'..self:GetName()..'|r:'.. event, ...)
-  self:Update()
-end
 
 function VeneerOrderHallMixin:OnShow()
-  if OrderHallCommandBar then
-    print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', OrderHallCommandBar:IsShown(), self:IsShown())
+  if ocb then
+    --self:Print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', ocb:IsShown(), self:IsShown())
     self:Update()
   end
-  Veneer:DynamicReanchor()
-end
-
-function VeneerOrderHallMixin:OnHide()
-  if OrderHallCommandBar then
-    print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', OrderHallCommandBar:IsShown(), self:IsShown())
-  end
-  Veneer:Reanchor()
 end
 
 function VeneerOrderHallMixin:Update()
-  if not OrderHallCommandBar then
-    print('|cFFFF4400'..self:GetName()..' updater called without target')
-    return
-  end
-
-  OrderHallCommandBar:ClearAllPoints()
-  OrderHallCommandBar:SetAllPoints(self)
-
-  OrderHallCommandBar.Background:SetColorTexture(0,0,0,0.5)
-  OrderHallCommandBar.WorldMapButton:Hide()
-  OrderHallCommandBar:EnableMouse(false)
-  self:SetSize(700, 22)
-
+  self:SetShown(ocb:IsShown())
+  local lastFrame
+  local categoriesWidth = 0
   local troops = OrderHallCommandBar.TroopSummary
   if troops then
     for _, category in ipairs(troops) do
-      category.Count:SetFontObject(VeneerNumberFont)
+      category.Count:SetFontObject(VeneerHeaderFont)
+      category.Count:SetTextColor(1,1,1,1)
       category.Count:ClearAllPoints()
       category.Count:SetPoint('BOTTOMRIGHT', category.Icon, 'BOTTOMRIGHT', -1, 1)
+  
+      category:ClearAllPoints()
+      if lastFrame then
+        lastFrame:SetPoint('TOPRIGHT', category, 'TOPLEFT', 0, 0)
+      end
+      category:SetSize(category.TroopPortraitCover:GetSize())
+      
+      lastFrame = category
+      categoriesWidth = categoriesWidth + category:GetWidth()
+      end
+    
+    if lastFrame then
+      lastFrame:SetPoint('TOPRIGHT', ocb, 'TOPRIGHT', 0, 0)
     end
+    
   end
-  
-
-
-  print('|cFF00AAFF'..self:GetName()..'|r:Update()', OrderHallCommandBar:IsVisible(), self:IsShown())
-  print(debugstack(6))
+  self:SetWidth(ocb.ClassIcon:GetWidth() + 15 + ocb.Currency:GetWidth() + ocb.CurrencyIcon:GetWidth() + categoriesWidth)
+  requiresUpdate = nil
+  --print('|cFF00AAFF'..self:GetName()..'|r:Update()', OrderHallCommandBar:IsVisible(), self:IsShown())
+  --print(debugstack(6))
   Veneer:DynamicReanchor()
 end