Mercurial > wow > buffalo2
diff Modules/BuffFrame.lua @ 71:6f8661094643
- obtains veneer objects through a common function and track them as a unified table.
author | Nenue |
---|---|
date | Tue, 23 Aug 2016 06:35:08 -0400 |
parents | 1b0d7bcd252e |
children | 95ed343c3a42 |
line wrap: on
line diff
--- a/Modules/BuffFrame.lua Mon Aug 22 20:38:43 2016 -0400 +++ b/Modules/BuffFrame.lua Tue Aug 23 06:35:08 2016 -0400 @@ -12,13 +12,15 @@ --]] local BUFF_BUTTON_SIZE = 48 +local BUFF_BUTTON_SPACING_H = 4 +local BUFF_BUTTON_SPACING_V = 14 local BUFF_PROGRESS_SIZE = 4 local BUFF_PROGRESS_INSET = 1 local BUFF_BUTTON_ZOOM = .15 -local BORDER_SIZE_L = 1 -local BORDER_SIZE_R = 1 +local BORDER_SIZE_L = 0 +local BORDER_SIZE_R = 0 local BORDER_SIZE_U = 4 -local BORDER_SIZE_D = 1 +local BORDER_SIZE_D = 0 local plugin = CreateFrame('Frame', 'VeneerBuffFrame', UIParent) @@ -64,39 +66,14 @@ local expirationCache = {} local visibility = {} -local VeneerButton_OnHide = function(self) - self:SetScript('OnDragStart', self.StartMoving) - self:SetScript('OnDragStop', self.StopMovingOrSizing) - self:SetMovable(false) - self:EnableMouse(false) - self:RegisterForDrag('LeftButton') -end -local VeneerButton_OnShow = function(self) - self:SetScript('OnDragStart', self.StartMoving) - self:SetScript('OnDragStop', self.StopMovingOrSizing) - self:SetMovable(false) - self:EnableMouse(false) - self:RegisterForDrag('LeftButton') -end local GetVeneer = function(frame) local name = frame:GetName() if not (_G[name..'Veneer']) then print('|cFF88FF00Creating', name,'Veneer') - local veneer = CreateFrame('Frame', name..'Veneer', UIParent) + local veneer = vn.GetVeneer(frame) local id = frame:GetID() - veneer:SetAllPoints(frame) - veneer:SetParent(frame) - veneer.bg = veneer:CreateTexture() - veneer.bg:SetColorTexture(1,1,1,0) - veneer.bg:SetAllPoints(veneer) - veneer.bg:Show() - veneer:Hide() - veneer:EnableMouse(false) - - veneer:SetScript('OnShow', VeneerButton_OnShow) - veneer:SetScript('OnHide', VeneerButton_OnHide) local position = tonumber(name:match("%d")) if position == 1 then @@ -105,8 +82,8 @@ veneer.progress = CreateFrame('Frame', name .. 'VeneerProgress', veneer) veneer.progress:Hide() - veneer.progress:SetPoint('BOTTOMLEFT', veneer, 'BOTTOMLEFT', 3, -6) - veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', -3, -1) + veneer.progress:SetPoint('BOTTOMLEFT', veneer, 'BOTTOMLEFT', 0, -6) + veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', 0, -1) veneer.progress:SetHeight(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) veneer.progress.bg = veneer.progress:CreateTexture(nil, 'BACKGROUND') @@ -198,7 +175,7 @@ hooksecurefunc(border, 'SetVertexColor', function(frame, r, g, b, a) frame:Hide() print('|cFF0088FFborder:SetVertexColor|r', r,g,b,a) - veneer.border:SetColorTexture(r,g,b,a) + veneer.progress.fg:SetColorTexture(r,g,b,a) end) local color = DebuffTypeColor["none"] @@ -206,7 +183,7 @@ color = DebuffTypeColor[aurasCache[frame][5]] end - veneer.border:SetColorTexture(color.r,color.g,color.b) + veneer.progress.fg:SetColorTexture(color.r,color.g,color.b) end if duration then duration:ClearAllPoints() @@ -392,14 +369,15 @@ for i = 1, BUFF_ACTUAL_DISPLAY do local buff = _G['BuffButton'..i] if buff then - if i == 1 then - buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) - topBuff = buff - elseif mod(i,12) == 1 then - buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -14) + if mod(i,12) == 1 then + if i == 1 then + buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) + else + buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) + end topBuff = buff else - buff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT') + buff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) end lastBuff = buff end @@ -410,16 +388,16 @@ if debuff then if i == 1 then if topBuff then - debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -14) + debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) else debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) end topBuff = debuff elseif mod(i, 12) == 1 then - debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -14) + debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) topBuff = debuff else - debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT') + debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) end lastBuff = debuff end