Mercurial > wow > buffalo2
changeset 106:6fa74abd83fd
- Fixed config layer inconsistencies
author | Nenue |
---|---|
date | Sun, 29 Jan 2017 09:55:40 -0500 |
parents | 3992b41c637e |
children | ff00679a7817 |
files | Modules/BuffFrame.lua |
diffstat | 1 files changed, 61 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/BuffFrame.lua Sun Jan 29 09:54:14 2017 -0500 +++ b/Modules/BuffFrame.lua Sun Jan 29 09:55:40 2017 -0500 @@ -21,6 +21,8 @@ local PROGRESS_ANCHOR = 'BOTTOM' local PROGRESS_PARENT local PROGRESS_OFFSET = 1 +local BUFF_MAX_DISPLAY = 24 +local DEBUFF_MAX_DISPLAY = 12 local BUFF_BUTTON_ZOOM = .15 local BORDER_SIZE_L = 2 @@ -256,6 +258,11 @@ FRAMELOCK_STATES.PETBATTLES[self.underlay:GetName()] = "hidden" end +plugin.defaultSettings = { + width = 48, + height = 48, +} + function plugin:AcquireConfigButton(name) print('|cFF88FF00Creating config dummy', name,'Veneer') local button = self.Buttons[name] @@ -315,7 +322,7 @@ local border = _G[name .. 'Border'] local count = _G[name .. 'Count'] local duration = _G[name .. 'Duration'] - local veneer = self:Acquire(name) + local facade = self:Acquire(name) local offset = BUFF_BUTTON_ZOOM/2 self.DetectedFrames[frame] = frame @@ -323,25 +330,25 @@ icon:SetTexCoord(offset, 1 - offset, offset, 1 - offset) - DoRegionHooks(veneer, border) + DoRegionHooks(facade, border) if border then local color = DebuffTypeColor["none"] if aurasCache[frame] and aurasCache[frame][5] then color = DebuffTypeColor[aurasCache[frame][5]] end - veneer.progress.fg:SetColorTexture(color.r,color.g,color.b) - veneer.border:SetColorTexture(0,0,0,1) - veneer.border:Show() + facade.progress.fg:SetColorTexture(color.r,color.g,color.b) + facade.border:SetColorTexture(0,0,0,1) + facade.border:Show() else - veneer.border:SetColorTexture(0,0,0,1) - veneer.border:Show() + facade.border:SetColorTexture(0,0,0,1) + facade.border:Show() end if count then count:ClearAllPoints() hooksecurefunc(count, 'Show', function(self) self:Hide() end) if count:GetText() then - veneer.count:SetText(count:GetText()) + facade.count:SetText(count:GetText()) end end if duration then @@ -349,34 +356,34 @@ end hooksecurefunc(frame, "Hide", function(frame) - veneer:Hide() + facade:Hide() end) hooksecurefunc(frame, 'Show', function(frame) - veneer:Show() + facade:Show() end) hooksecurefunc(frame, 'SetShown', function(frame, isShown) - veneer:SetShown(isShown) + facade:SetShown(isShown) end) - - veneer:SetParent(UIParent) - veneer:SetAllPoints(frame) - veneer:SetFrameStrata('MEDIUM') + facade.IsAcquired = true + facade:SetParent(UIParent) + facade:SetAllPoints(frame) + facade:SetFrameStrata('MEDIUM') end --- Set widgets to reflect the passed parameters function plugin:UpdateButton (name, duration, expires) local frame = _G[name] - local veneer = self:Acquire(name) + local facade = self:Acquire(name) -- is it a new button? if not self.DetectedFrames[frame] then print('|cFFFF4400detected', name) self:SetupButton(name) end - print(veneer:GetParent():GetName(), veneer:GetPoint(1)) + print(facade:GetParent():GetName(), facade:GetPoint(1)) --[[ if frame.count then frame.count:SetText('test') @@ -391,23 +398,23 @@ local startTime = (expires - duration) local endTime = expires or 0 print('|cFF0088FF'..frame:GetName()..'|r', duration, expires) - veneer.progress:Show() - veneer.elapsed = 0 - veneer.progress:SetScript('OnUpdate', function(self, elapsed) - veneer.elapsed = veneer.elapsed + elapsed + facade.progress:Show() + facade.elapsed = 0 + facade.progress:SetScript('OnUpdate', function(self, elapsed) + facade.elapsed = facade.elapsed + elapsed - local w = floor(veneer.progress:GetWidth()+.5) - (BUFF_PROGRESS_INSET*2) + local w = floor(facade.progress:GetWidth()+.5) - (BUFF_PROGRESS_INSET*2) local t = GetTime() local progress = (t - startTime) / duration local nw = (w - (w * progress)) - if veneer.elapsed >= 0.25 then + if facade.elapsed >= 0.25 then --tprint(t, startTime, floor(progress*100), w * progress, nw, w) - veneer.elapsed = 0.25 - veneer.elapsed + facade.elapsed = 0.25 - facade.elapsed end if (progress >= 1) or not frame:IsVisible() then - veneer.startTime = nil + facade.startTime = nil self:Hide() self:SetScript('OnUpdate', nil) else @@ -415,31 +422,31 @@ end end) - veneer.cooldown:Show() - veneer.cooldown:SetCooldown(startTime, duration) + facade.cooldown:Show() + facade.cooldown:SetCooldown(startTime, duration) else print('|cFF00FF88'..frame:GetName()..'|r', 'duration zero') - veneer.progress:SetScript('OnUpdate', nil) - veneer.progress:Hide() - veneer.cooldown:Hide() + facade.progress:SetScript('OnUpdate', nil) + facade.progress:Hide() + facade.cooldown:Hide() end if count and count > 1 then - veneer.count:SetText(count) - veneer.count:Show() + facade.count:SetText(count) + facade.count:Show() frame.count:ClearAllPoints() else - veneer.count:Hide() + facade.count:Hide() end else - veneer.progress:Hide() - veneer.cooldown:SetCooldown(0,0) - veneer.cooldown:Hide() + facade.progress:Hide() + facade.cooldown:SetCooldown(0,0) + facade.cooldown:Hide() print('|cFF88FF00'..frame:GetName()..'|r', 'nil duration') end - veneer:Show() + facade:Show() end @@ -492,7 +499,7 @@ for i = 1, limit do local name = 'BuffButton'..i local buff = _G[name] or self.Buttons[name] - print(buff:GetName(), self.configMode) + print(i, name, buff) if buff then numBuffs = numBuffs + 1 buff:ClearAllPoints() @@ -519,24 +526,27 @@ numBuffs = 0 limit = self.configMode and DEBUFF_MAX_DISPLAY or DEBUFF_ACTUAL_DISPLAY - for i = 1, DEBUFF_ACTUAL_DISPLAY do + local lastDebuff + local topDebuff = topBuff + for i = 1, limit do local name = 'DebuffButton'..i local debuff = _G[name] or self.Buttons[name] + print(i, name, debuff) if debuff then numBuffs = numBuffs + 1 if mod(numBuffs, BUFFS_PER_ROW) == 1 then - if topBuff then - debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) + if topDebuff then + debuff:SetPoint('TOPRIGHT', topDebuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) else debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', BUFF_FRAMES_X, BUFF_FRAMES_Y) end - topBuff = debuff + topDebuff = debuff else - debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) + debuff:SetPoint('TOPRIGHT', lastDebuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) end - lastBuff = debuff + lastDebuff = debuff end end @@ -556,11 +566,18 @@ for i = 1, BUFF_MAX_DISPLAY do local name = 'BuffButton' .. i local button = self:AcquireConfigButton(name) + if not button.IsAcquired then + button.underlay.bg:SetColorTexture(0,1,0,0.5) + end end for i = 1, DEBUFF_MAX_DISPLAY do local name = 'DebuffButton' .. i local button = self:AcquireConfigButton(name) + if not button.IsAcquired then + button.underlay.bg:SetColorTexture(1,0,0,0.5) + end end + self:OnUpdateAllBuffAnchors() end function plugin:OnUpdateDuration (frame, timeLeft) local veneer = self:Acquire(frame:GetName())