Mercurial > wow > buffalo2
changeset 86:48182978d1c6
- revert count info to non-hook method; something spam fires Hide making stacking debuffs unintelligible
- implement config variables for position and anchoring of buff sub-regions
author | Nenue |
---|---|
date | Tue, 18 Oct 2016 19:53:24 -0400 |
parents | 1196b8175674 |
children | 27db212af783 |
files | Modules/BuffFrame.lua Modules/BuffFrame.xml |
diffstat | 2 files changed, 157 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/BuffFrame.lua Tue Oct 18 13:16:57 2016 -0400 +++ b/Modules/BuffFrame.lua Tue Oct 18 19:53:24 2016 -0400 @@ -13,18 +13,30 @@ local BUFFS_PER_ROW = 12 local BUFF_BUTTON_SIZE = 48 -local BUFF_BUTTON_SPACING_H = 4 +local BUFF_BUTTON_SPACING_H = 5 local BUFF_BUTTON_SPACING_V = 14 local BUFF_PROGRESS_SIZE = 4 -local BUFF_PROGRESS_INSET = 1 +local BUFF_PROGRESS_INSET = 2 +local PROGRESS_ANCHOR = 'BOTTOM' +local PROGRESS_PARENT +local PROGRESS_OFFSET = 1 + local BUFF_BUTTON_ZOOM = .15 -local BORDER_SIZE_L = 1 -local BORDER_SIZE_R = 1 -local BORDER_SIZE_U = 1 -local BORDER_SIZE_D = 1 +local BORDER_SIZE_L = 2 +local BORDER_SIZE_R = 2 +local BORDER_SIZE_U = 2 +local BORDER_SIZE_D = 2 local BUFF_FRAMES_X = -230 local BUFF_FRAMES_Y = -4 +local COUNT_ANCHOR = 'TOPRIGHT' +local COUNT_INSET = 4 +local COUNT_PARENT + +local DURATION_ANCHOR = 'BOTTOMLEFT' +local DURATION_INSET = 4 +local DURATION_PARENT + VeneerBuffFrameMixin = { moduleName = 'Buff Frames', defaultCluster = 'TOPRIGHT', @@ -75,6 +87,34 @@ } } +local OFFSET_PARALLELS = { + TOP = {'LEFT', 'RIGHT', 'SetHeight'}, + BOTTOM = {'LEFT', 'RIGHT', 'SetHeight'}, + LEFT = {'TOP', 'BOTTOM', 'SetWidth'}, + RIGHT = {'TOP', 'BOTTOM', 'SetWidth'}, +} +local ANCHOR_OFFSET_POINT = { + TOP = 'BOTTOM', + TOPLEFT = 'BOTTOMRIGHT', + TOPRIGHT = 'BOTTOMLEFT', + LEFT = 'RIGHT', + RIGHT = 'LEFT', + CENTER = 'CENTER', + BOTTOM = 'TOP', + BOTTOMRIGHT = 'TOPLEFT', + BOTTOMLEFT = 'TOPRIGHT', +} +local ANCHOR_INSET_DELTA = { + TOP = {0, -1}, + TOPLEFT = {1, -1}, + TOPRIGHT = {-1,-1}, + LEFT = {1, 0}, + BOTTOMLEFT = {1, 1}, + BOTTOM = {0, 1}, + BOTTOMRIGHT = {-1, 1}, + RIGHT = {-1, 0}, + CENTER = {0, 0}, +} function plugin:Acquire(target) @@ -86,13 +126,41 @@ frame = vn:Acquire(target, 'VeneerBuffTemplate') - frame.progress:SetHeight(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) + frame.progress[OFFSET_PARALLELS[PROGRESS_ANCHOR][3]](frame.progress, BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) + print(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) + + frame.progress:ClearAllPoints() + frame.progress:SetPoint(ANCHOR_OFFSET_POINT[PROGRESS_ANCHOR], PROGRESS_PARENT or frame.border, PROGRESS_ANCHOR, + (ANCHOR_INSET_DELTA[PROGRESS_ANCHOR][1] * PROGRESS_OFFSET * -1), + (ANCHOR_INSET_DELTA[PROGRESS_ANCHOR][2] * PROGRESS_OFFSET * -1)) + frame.progress:SetPoint(OFFSET_PARALLELS[PROGRESS_ANCHOR][1], frame.border, OFFSET_PARALLELS[PROGRESS_ANCHOR][1], 0, 0) + frame.progress:SetPoint(OFFSET_PARALLELS[PROGRESS_ANCHOR][2], frame.border, OFFSET_PARALLELS[PROGRESS_ANCHOR][2], 0, 0) + + print(frame.progress:GetPoint(1)) + print(frame.progress:GetPoint(2)) + print(frame.progress:GetPoint(3)) + frame.progress:Show() + + frame.progress.bg:ClearAllPoints() + frame.progress.bg:SetAllPoints(frame.progress) frame.progress.fg:ClearAllPoints() frame.progress.fg:SetPoint('BOTTOMLEFT', BUFF_PROGRESS_INSET,BUFF_PROGRESS_INSET) frame.progress.fg:SetPoint('TOP', 0, -BUFF_PROGRESS_INSET) + --frame.count:ClearAllPoints() + --frame.count:SetPoint('TOPRIGHT', frame,'TOPRIGHT', -3, -3) + frame.duration:ClearAllPoints() + frame.duration:SetPoint(DURATION_ANCHOR, DURATION_PARENT or frame, DURATION_ANCHOR, + (ANCHOR_INSET_DELTA[DURATION_ANCHOR][1] * DURATION_INSET), + (ANCHOR_INSET_DELTA[DURATION_ANCHOR][2] * DURATION_INSET)) + + frame.count:ClearAllPoints() + frame.count:SetPoint(COUNT_ANCHOR, COUNT_PARENT or frame, COUNT_ANCHOR, + (ANCHOR_INSET_DELTA[COUNT_ANCHOR][1] * COUNT_INSET), + (ANCHOR_INSET_DELTA[COUNT_ANCHOR][2] * COUNT_INSET)) + frame.underlay:SetParent(UIParent) frame.underlay:SetFrameStrata('BACKGROUND') frame.border:SetColorTexture(0,0,0,1) @@ -124,39 +192,59 @@ end -- Associates skinning elements with said button local surrogates = { - Show = false, - Hide = false, - SetText = false, - SetVertexColor = function(surrogate, frame, r, g, b, a) - frame:Hide() - print('|cFF0088FFborder:SetVertexColor|r', r,g,b,a) - surrogate.progress.fg:SetColorTexture(r,g,b,a) - surrogate.border:Show() + ['Show'] = false, + ['Hide'] = false, + ['SetText'] = false, + ['SetVertexColor'] = function(self, region, r, g, b, a) + if not self.progress then + return + end + + region:Hide() + 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() end, } local DoRegionHooks = function (veneer, region) if region then - print('hooking', region:GetName()) + --print('hooking', region:GetName()) region:ClearAllPoints() - for method, callback in ipairs(surrogates) do - print(method, callback) - if region[method] then + for method, callback in pairs(surrogates) do + if type(region[method]) == 'function' then + + --print(method, type(callback)) local func if callback then - print('hooking', region:GetName(), method) - func = function(self,...) - print(self:GetName(), ':', method) - self:ClearAllPoints() - veneer[method](...) + func = function(self, ...) + --tprint('|cFF00FFFF'.. region:GetName().. ':', method) + region:ClearAllPoints() + callback(veneer, region, ...) end else - func = function(self, ...) + func = function(self,...) + tprint('|cFF0088FF'.. self:GetName().. ':', method) self:ClearAllPoints() - callback(veneer, region, ...) + 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)) + end + end end - hooksecurefunc(region, method, callback) + if func then + --print('hooking', region:GetName(), method) + hooksecurefunc(region, method, func) + + end end end end @@ -166,10 +254,10 @@ function plugin:SetupButton (name) local frame = _G[name ] if self.DetectedFrames[frame] then - print('|cFFFF4400Attempting to skin a frame that already went through.|r') + --print('|cFFFF4400Attempting to skin a frame that already went through.|r') return end - print('|cFFFFFF00Adopting', name) + --print('|cFFFFFF00Adopting', name) local icon = _G[name .. 'Icon'] local border = _G[name .. 'Border'] @@ -183,9 +271,8 @@ icon:SetTexCoord(offset, 1 - offset, offset, 1 - offset) + DoRegionHooks(veneer, border) - DoRegionHooks(veneer.duration, duration) - DoRegionHooks(veneer.count, count) if border then local color = DebuffTypeColor["none"] if aurasCache[frame] and aurasCache[frame][5] then @@ -199,6 +286,16 @@ veneer.border:Show() end + if count and count:GetText() then + count:ClearAllPoints() + veneer.count:SetText(count:GetText()) + end + if duration then + duration:ClearAllPoints() + end + + + hooksecurefunc(frame, "Hide", function(self) local isVisible = self:IsVisible() @@ -230,6 +327,14 @@ self:SetupButton(frame:GetName()) end + --[[ + if frame.count then + frame.count:SetText('test') + frame.count:Show() + end + --]] + local name, rank, icon, count, _, duration, expires = UnitAura(frame.unit, frame:GetID(), frame.filter) + if expires and duration then if duration ~= 0 then @@ -268,6 +373,15 @@ veneer.progress:Hide() veneer.cooldown:Hide() end + + if count and count >= 1 then + veneer.count:SetText(count) + veneer.count:Show() + else + veneer.count:Hide() + end + + else veneer.progress:Hide() veneer.cooldown:SetCooldown(0,0) @@ -297,18 +411,14 @@ local bName = name..index local frame = _G[bName] if frame and frame:IsVisible() then - local cacheDiff = self:ButtonHasChanged(frame, UnitAura(frame.unit, frame:GetID(), frame.filter)) -- if the name or expirationTime changed - if (cacheDiff >= 1) then - print('|cFFFF4400', frame:GetName(), 'diff:', cacheDiff) + if not skinnedFrames[frame] then tinsert(pendingFrames, frame) end expirationCache[name] = frame.expirationTime - print(unpack(aurasCache[frame])) + self:UpdateButton(frame) - self:UpdateButton(frame, aurasCache[frame][6], aurasCache[frame][7]) - end end end @@ -409,10 +519,8 @@ veneer.duration:SetFontObject(VeneerNumberFont) veneer.duration:SetTextColor(1,1,1,1) end - end - veneer.duration:SetText(timeString) end
--- a/Modules/BuffFrame.xml Tue Oct 18 13:16:57 2016 -0400 +++ b/Modules/BuffFrame.xml Tue Oct 18 19:53:24 2016 -0400 @@ -7,7 +7,7 @@ <Scripts> <OnLoad> self.duration = self.progress.duration - self.count = self.progress.count + self.count = self.overlay.count self.border = self.underlay.bg </OnLoad> </Scripts> @@ -38,10 +38,6 @@ </EdgeTexture> </Cooldown> <Frame name="$parentProgress" parentKey="progress" frameStrata="MEDIUM"> - <Anchors> - <Anchor point="BOTTOMLEFT" x="-1" y="-7" /> - <Anchor point="TOPRIGHT" relativePoint="BOTTOMRIGHT" x="1" y="-2" /> - </Anchors> <Layers> <Layer level="BACKGROUND"> <Texture parentKey="bg" setAllPoints="true"> @@ -56,12 +52,18 @@ <Layer level="OVERLAY"> <FontString name="$parentDuration" parentKey="duration" inherits="VeneerNumberFont"> <Anchors> - <Anchor point="BOTTOM" x="0" y="2" /> + <Anchor point="BOTTOMLEFT" x="5" y="9" /> </Anchors> </FontString> - <FontString name="$parentCount" parentKey="count" inherits="VeneerNumberFont" justifyH="RIGHT"> + </Layer> + </Layers> + </Frame> + <Frame name="$parentOverlay" parentKey="overlay" setAllPoints="true"> + <Layers> + <Layer level="OVERLAY"> + <FontString name="$parentCount" parentKey="count" inherits="VeneerNumberFontLarge"> <Anchors> - <Anchor point="TOPRIGHT" x="-3" y="-3" /> + <Anchor point="TOPRIGHT" x="-2" y="-2" /> </Anchors> </FontString> </Layer>