Mercurial > wow > buffalo2
comparison 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 |
comparison
equal
deleted
inserted
replaced
92:d41c7dc3012f | 93:caded2668701 |
---|---|
131 if not self.progress then | 131 if not self.progress then |
132 return | 132 return |
133 end | 133 end |
134 | 134 |
135 region:Hide() | 135 region:Hide() |
136 tprint('|cFF0088FFborder:SetVertexColor|r', r,g,b,a) | 136 --tprint('|cFF0088FFborder:SetVertexColor|r', r,g,b,a) |
137 self.progress.fg:SetColorTexture(r,g,b,a) | 137 self.progress.fg:SetColorTexture(r,g,b,a) |
138 self.border:SetColorTexture(r,g,b,a) | 138 self.border:SetColorTexture(r,g,b,a) |
139 self.border:Show() | 139 self.border:Show() |
140 end, | 140 end, |
141 } | 141 } |
155 region:ClearAllPoints() | 155 region:ClearAllPoints() |
156 callback(veneer, region, ...) | 156 callback(veneer, region, ...) |
157 end) | 157 end) |
158 else | 158 else |
159 hooksecurefunc(region, method, function(self,...) | 159 hooksecurefunc(region, method, function(self,...) |
160 tprint('|cFF0088FF'.. self:GetName().. ':', method) | 160 --tprint('|cFF0088FF'.. self:GetName().. ':', method) |
161 self:ClearAllPoints() | 161 self:ClearAllPoints() |
162 veneer:Show() | 162 veneer:Show() |
163 veneer[method](veneer, ...) | 163 veneer[method](veneer, ...) |
164 | 164 |
165 if self:GetName():match('Debuff.+Count') then | 165 if self:GetName():match('Debuff.+Count') then |
166 | 166 |
167 print('|cFF00FFFF'.. self:GetName().. ':'.. method, '->', veneer:GetName()..':'..method..'(', ...,')') | 167 --print('|cFF00FFFF'.. self:GetName().. ':'.. method, '->', veneer:GetName()..':'..method..'(', ...,')') |
168 print(veneer:IsVisible(),veneer:GetStringWidth(),veneer:GetText()) | 168 --print(veneer:IsVisible(),veneer:GetStringWidth(),veneer:GetText()) |
169 print(veneer:GetTop(), veneer:GetLeft()) | 169 --print(veneer:GetTop(), veneer:GetLeft()) |
170 print(veneer:GetPoint(1)) | 170 --print(veneer:GetPoint(1)) |
171 end | 171 end |
172 | 172 |
173 end) | 173 end) |
174 end | 174 end |
175 end | 175 end |
178 end | 178 end |
179 function VeneerBuffFrameMixin:Acquire(target) | 179 function VeneerBuffFrameMixin:Acquire(target) |
180 | 180 |
181 local frame = self.Buttons[target] | 181 local frame = self.Buttons[target] |
182 if not (self.Buttons[target]) then | 182 if not (self.Buttons[target]) then |
183 | |
183 local name = target:GetName() | 184 local name = target:GetName() |
184 local id = target:GetID() | 185 local id = target:GetID() |
185 print('|cFF88FF00Creating', name,'Veneer') | 186 print('|cFF88FF00Creating', name,'Veneer') |
186 | |
187 frame = vn:Acquire(target, 'VeneerBuffTemplate') | 187 frame = vn:Acquire(target, 'VeneerBuffTemplate') |
188 | |
188 | 189 |
189 frame.progress[OFFSET_PARALLELS[PROGRESS_ANCHOR][3]](frame.progress, BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) | 190 frame.progress[OFFSET_PARALLELS[PROGRESS_ANCHOR][3]](frame.progress, BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) |
190 print(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) | 191 print(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) |
191 | 192 |
192 frame.progress:ClearAllPoints() | 193 frame.progress:ClearAllPoints() |
239 | 240 |
240 function VeneerBuffFrameMixin:Setup() | 241 function VeneerBuffFrameMixin:Setup() |
241 | 242 |
242 | 243 |
243 hooksecurefunc("BuffFrame_Update", function(...) self:OnBuffFrameUpdate(...) end) | 244 hooksecurefunc("BuffFrame_Update", function(...) self:OnBuffFrameUpdate(...) end) |
244 hooksecurefunc("AuraButton_UpdateDuration", function(...) self:OnUpdateDuration(...) end) | 245 --hooksecurefunc("AuraButton_UpdateDuration", function(...) self:OnUpdateDuration(...) end) |
245 hooksecurefunc("AuraButton_Update", function(...) self:OnAuraButton_Update(...) end) | 246 hooksecurefunc("AuraButton_Update", function(...) self:OnAuraButton_Update(...) end) |
246 hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", function(...) self:OnUpdateAllBuffAnchors(...) end) | 247 hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", function(...) self:OnUpdateAllBuffAnchors(...) end) |
247 hooksecurefunc("TemporaryEnchantFrame_Update", function(...) self:OnTemporaryEnchantFrameUpdate(...) end) | 248 hooksecurefunc("TemporaryEnchantFrame_Update", function(...) self:OnTemporaryEnchantFrameUpdate(...) end) |
248 for i = 1, 3 do | 249 for i = 1, 3 do |
249 self:SetupButton('TempEnchant'..i) | 250 self:SetupButton('TempEnchant'..i) |
250 _G['TempEnchant'..i..'Border']:SetVertexColor(0.5,0,1,1) | 251 _G['TempEnchant'..i..'Border']:SetVertexColor(0.5,0,1,1) |
251 end | 252 end |
252 end | 253 end |
253 | 254 |
255 function VeneerBuffFrameMixin:SetHidden(region) | |
256 if not self.hiddenRegions[region] then | |
257 self.hiddenRegions[region] = true | |
258 region:SetShown(false) | |
259 hooksecurefunc(region) | |
260 end | |
261 end | |
254 | 262 |
255 function VeneerBuffFrameMixin:SetupButton (name) | 263 function VeneerBuffFrameMixin:SetupButton (name) |
256 local frame = _G[name ] | 264 local frame = _G[name ] |
257 if self.DetectedFrames[frame] then | 265 if self.DetectedFrames[frame] then |
258 --print('|cFFFF4400Attempting to skin a frame that already went through.|r') | 266 --print('|cFFFF4400Attempting to skin a frame that already went through.|r') |
285 else | 293 else |
286 veneer.border:SetColorTexture(0,0,0,1) | 294 veneer.border:SetColorTexture(0,0,0,1) |
287 veneer.border:Show() | 295 veneer.border:Show() |
288 end | 296 end |
289 | 297 |
290 if count and count:GetText() then | 298 if count then |
291 count:ClearAllPoints() | 299 count:ClearAllPoints() |
292 veneer.count:SetText(count:GetText()) | 300 hooksecurefunc(count, 'Show', function(self) self:Hide() end) |
301 if count:GetText() then | |
302 veneer.count:SetText(count:GetText()) | |
303 end | |
293 end | 304 end |
294 if duration then | 305 if duration then |
295 duration:ClearAllPoints() | 306 duration:ClearAllPoints() |
296 end | 307 end |
297 | 308 |
352 local progress = (t - startTime) / duration | 363 local progress = (t - startTime) / duration |
353 | 364 |
354 local nw = (w - (w * progress)) | 365 local nw = (w - (w * progress)) |
355 if veneer.elapsed >= 0.25 then | 366 if veneer.elapsed >= 0.25 then |
356 | 367 |
357 tprint(t, startTime, floor(progress*100), w * progress, nw, w) | 368 --tprint(t, startTime, floor(progress*100), w * progress, nw, w) |
358 veneer.elapsed = 0.25 - veneer.elapsed | 369 veneer.elapsed = 0.25 - veneer.elapsed |
359 end | 370 end |
360 if (progress >= 1) or not frame:IsVisible() then | 371 if (progress >= 1) or not frame:IsVisible() then |
361 veneer.startTime = nil | 372 veneer.startTime = nil |
362 self:Hide() | 373 self:Hide() |
479 numBuffs = 0 | 490 numBuffs = 0 |
480 for i = 1, DEBUFF_ACTUAL_DISPLAY do | 491 for i = 1, DEBUFF_ACTUAL_DISPLAY do |
481 local debuff = _G['DebuffButton'..i] | 492 local debuff = _G['DebuffButton'..i] |
482 if debuff then | 493 if debuff then |
483 numBuffs = numBuffs + 1 | 494 numBuffs = numBuffs + 1 |
484 if numBuffs == 1 then | 495 if mod(numBuffs, BUFFS_PER_ROW) == 1 then |
485 if topBuff then | 496 |
486 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) | 497 if topBuff then |
487 else | 498 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) |
488 debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) | 499 else |
489 end | 500 debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', BUFF_FRAMES_X, BUFF_FRAMES_Y) |
490 topBuff = debuff | 501 end |
491 elseif mod(numBuffs, BUFFS_PER_ROW) == 1 then | 502 topBuff = debuff |
492 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) | 503 |
493 topBuff = debuff | |
494 else | 504 else |
495 debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) | 505 debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) |
496 end | 506 end |
497 lastBuff = debuff | 507 lastBuff = debuff |
498 end | 508 end |
507 self.Background:SetPoint('BOTTOM', plugin.currentBottom, 'BOTTOM', 0, -4) | 517 self.Background:SetPoint('BOTTOM', plugin.currentBottom, 'BOTTOM', 0, -4) |
508 self.Background:SetPoint('LEFT', plugin.currentLeft, 'LEFT', -4, 0) | 518 self.Background:SetPoint('LEFT', plugin.currentLeft, 'LEFT', -4, 0) |
509 end | 519 end |
510 function VeneerBuffFrameMixin:UpdateConfigLayers (configMode) | 520 function VeneerBuffFrameMixin:UpdateConfigLayers (configMode) |
511 self:SetShown(configMode) | 521 self:SetShown(configMode) |
522 for _, button in pairs(self.Buttons) do | |
523 button:SetShown(configMode) | |
524 end | |
512 end | 525 end |
513 function VeneerBuffFrameMixin:OnUpdateDuration (frame, timeLeft) | 526 function VeneerBuffFrameMixin:OnUpdateDuration (frame, timeLeft) |
514 local veneer = self:Acquire(frame) | 527 local veneer = self:Acquire(frame) |
515 local hours = floor(timeLeft/3600) | 528 local hours = floor(timeLeft/3600) |
516 local minutes = floor(mod(timeLeft, 3600)/60) | 529 local minutes = floor(mod(timeLeft, 3600)/60) |