diff Modules/BuffFrame.lua @ 93:caded2668701

Curseforge migration and source tree cleaning
author Nenue
date Sun, 01 Jan 2017 18:25:26 -0500
parents 6e2cb847c3c6
children df10cd0ae949
line wrap: on
line diff
--- a/Modules/BuffFrame.lua	Tue Oct 25 12:33:20 2016 -0400
+++ b/Modules/BuffFrame.lua	Sun Jan 01 18:25:26 2017 -0500
@@ -133,7 +133,7 @@
     end
 
     region:Hide()
-    tprint('|cFF0088FFborder:SetVertexColor|r', r,g,b,a)
+    --tprint('|cFF0088FFborder:SetVertexColor|r', r,g,b,a)
     self.progress.fg:SetColorTexture(r,g,b,a)
     self.border:SetColorTexture(r,g,b,a)
     self.border:Show()
@@ -157,17 +157,17 @@
           end)
         else
           hooksecurefunc(region, method, function(self,...)
-            tprint('|cFF0088FF'.. self:GetName().. ':', method)
+            --tprint('|cFF0088FF'.. self:GetName().. ':', method)
             self:ClearAllPoints()
             veneer:Show()
             veneer[method](veneer, ...)
 
             if self:GetName():match('Debuff.+Count') then
 
-              print('|cFF00FFFF'.. self:GetName().. ':'.. method, '->', veneer:GetName()..':'..method..'(', ...,')')
-              print(veneer:IsVisible(),veneer:GetStringWidth(),veneer:GetText())
-              print(veneer:GetTop(), veneer:GetLeft())
-              print(veneer:GetPoint(1))
+              --print('|cFF00FFFF'.. self:GetName().. ':'.. method, '->', veneer:GetName()..':'..method..'(', ...,')')
+              --print(veneer:IsVisible(),veneer:GetStringWidth(),veneer:GetText())
+              --print(veneer:GetTop(), veneer:GetLeft())
+              --print(veneer:GetPoint(1))
             end
 
           end)
@@ -180,11 +180,12 @@
 
   local frame = self.Buttons[target]
   if not (self.Buttons[target]) then
+
     local name = target:GetName()
     local id = target:GetID()
     print('|cFF88FF00Creating', name,'Veneer')
+    frame = vn:Acquire(target, 'VeneerBuffTemplate')
 
-    frame = vn:Acquire(target, 'VeneerBuffTemplate')
 
     frame.progress[OFFSET_PARALLELS[PROGRESS_ANCHOR][3]](frame.progress, BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2))
     print(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2))
@@ -241,7 +242,7 @@
 
 
   hooksecurefunc("BuffFrame_Update", function(...) self:OnBuffFrameUpdate(...) end)
-  hooksecurefunc("AuraButton_UpdateDuration", function(...) self:OnUpdateDuration(...) end)
+  --hooksecurefunc("AuraButton_UpdateDuration", function(...) self:OnUpdateDuration(...) end)
   hooksecurefunc("AuraButton_Update", function(...) self:OnAuraButton_Update(...) end)
   hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", function(...) self:OnUpdateAllBuffAnchors(...) end)
   hooksecurefunc("TemporaryEnchantFrame_Update", function(...) self:OnTemporaryEnchantFrameUpdate(...) end)
@@ -251,6 +252,13 @@
   end
 end
 
+function VeneerBuffFrameMixin:SetHidden(region)
+  if not self.hiddenRegions[region] then
+    self.hiddenRegions[region] = true
+    region:SetShown(false)
+    hooksecurefunc(region)
+  end
+end
 
 function VeneerBuffFrameMixin:SetupButton (name)
   local frame = _G[name ]
@@ -287,9 +295,12 @@
     veneer.border:Show()
   end
 
-  if count and count:GetText() then
+  if count then
     count:ClearAllPoints()
-    veneer.count:SetText(count:GetText())
+    hooksecurefunc(count, 'Show', function(self) self:Hide() end)
+    if count:GetText() then
+      veneer.count:SetText(count:GetText())
+    end
   end
   if duration then
     duration:ClearAllPoints()
@@ -354,7 +365,7 @@
         local nw = (w - (w * progress))
         if veneer.elapsed >= 0.25 then
 
-          tprint(t, startTime, floor(progress*100), w * progress, nw, w)
+          --tprint(t, startTime, floor(progress*100), w * progress, nw, w)
           veneer.elapsed = 0.25 - veneer.elapsed
         end
         if (progress >= 1) or not frame:IsVisible() then
@@ -481,16 +492,15 @@
     local debuff = _G['DebuffButton'..i]
     if debuff then
       numBuffs = numBuffs + 1
-      if numBuffs == 1 then
-        if topBuff then
-          debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT',  0, -BUFF_BUTTON_SPACING_V)
-        else
-          debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6)
-        end
-        topBuff = debuff
-      elseif mod(numBuffs, BUFFS_PER_ROW) == 1 then
-        debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT',  0, -BUFF_BUTTON_SPACING_V)
-        topBuff = debuff
+      if mod(numBuffs, BUFFS_PER_ROW) == 1 then
+
+          if topBuff then
+            debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT',  0, -BUFF_BUTTON_SPACING_V)
+          else
+            debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', BUFF_FRAMES_X, BUFF_FRAMES_Y)
+          end
+          topBuff = debuff
+
       else
         debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0)
       end
@@ -509,6 +519,9 @@
 end
 function VeneerBuffFrameMixin:UpdateConfigLayers (configMode)
   self:SetShown(configMode)
+  for _, button in pairs(self.Buttons) do
+    button:SetShown(configMode)
+  end
 end
 function VeneerBuffFrameMixin:OnUpdateDuration (frame, timeLeft)
   local veneer = self:Acquire(frame)