comparison Modules/BuffFrame.lua @ 95:43303398d1b9

- Pre-load veneer frames for buffs, set their triggers when the appropriate frames have spawned. - Add border frames into the PETBATTLES frame lock table so they are hidden properly. Normal triggers don't work here.
author Nenue
date Sun, 01 Jan 2017 19:56:35 -0500
parents df10cd0ae949
children bb38bc0e787f
comparison
equal deleted inserted replaced
94:df10cd0ae949 95:43303398d1b9
178 end 178 end
179 179
180 180
181 181
182 function Facade:OnShow() 182 function Facade:OnShow()
183 print(self:GetName(), 'OnShow')
183 self.underlay:Show() 184 self.underlay:Show()
184 end 185 end
185 function Facade:OnHide() 186 function Facade:OnHide()
187
188 print(self:GetName(), 'OnHide')
186 self.underlay:Hide() 189 self.underlay:Hide()
190
187 end 191 end
188 192
189 function Facade:OnLoad() 193 function Facade:OnLoad()
190 194
191 self.duration = self.progress.duration 195 self.duration = self.progress.duration
237 self.count:ClearAllPoints() 241 self.count:ClearAllPoints()
238 self.count:SetPoint(COUNT_ANCHOR, COUNT_PARENT or self, COUNT_ANCHOR, 242 self.count:SetPoint(COUNT_ANCHOR, COUNT_PARENT or self, COUNT_ANCHOR,
239 (ANCHOR_INSET_DELTA[COUNT_ANCHOR][1] * COUNT_INSET), 243 (ANCHOR_INSET_DELTA[COUNT_ANCHOR][1] * COUNT_INSET),
240 (ANCHOR_INSET_DELTA[COUNT_ANCHOR][2] * COUNT_INSET)) 244 (ANCHOR_INSET_DELTA[COUNT_ANCHOR][2] * COUNT_INSET))
241 245
242 self.underlay:SetParent(self) 246 self.underlay:SetParent(UIParent)
247
243 self.underlay:SetFrameStrata('BACKGROUND') 248 self.underlay:SetFrameStrata('BACKGROUND')
244 self.border:SetColorTexture(0,0,0,1) 249 self.border:SetColorTexture(0,0,0,1)
245 self.border:SetPoint('TOPLEFT', self, 'TOPLEFT', -BORDER_SIZE_L, BORDER_SIZE_U) 250 self.border:SetPoint('TOPLEFT', self, 'TOPLEFT', -BORDER_SIZE_L, BORDER_SIZE_U)
246 self.border:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', BORDER_SIZE_R, -BORDER_SIZE_D) 251 self.border:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', BORDER_SIZE_R, -BORDER_SIZE_D)
247 self.border:Show() 252 self.border:Show()
253
254 FRAMELOCK_STATES.PETBATTLES[self.underlay:GetName()] = "hidden"
248 end 255 end
249 256
250 function plugin:AcquireConfigButton(name) 257 function plugin:AcquireConfigButton(name)
251 print('|cFF88FF00Creating config dummy', name,'Veneer') 258 print('|cFF88FF00Creating config dummy', name,'Veneer')
252 local button = self.Buttons[name] 259 local button = self.Buttons[name]
298 end 305 end
299 end 306 end
300 307
301 function plugin:SetupButton (name) 308 function plugin:SetupButton (name)
302 local frame = _G[name] 309 local frame = _G[name]
303 --print('|cFFFFFF00Adopting', name) 310 print('|cFFFFFF00Adopting', name)
304 311
305 local icon = _G[name .. 'Icon'] 312 local icon = _G[name .. 'Icon']
306 local border = _G[name .. 'Border'] 313 local border = _G[name .. 'Border']
307 local count = _G[name .. 'Count'] 314 local count = _G[name .. 'Count']
308 local duration = _G[name .. 'Duration'] 315 local duration = _G[name .. 'Duration']
337 end 344 end
338 if duration then 345 if duration then
339 duration:ClearAllPoints() 346 duration:ClearAllPoints()
340 end 347 end
341 348
342 hooksecurefunc(frame, "Hide", function(self) 349 hooksecurefunc(frame, "Hide", function(frame)
343 veneer:Hide() 350 veneer:Hide()
344 end) 351 end)
345 352
346 hooksecurefunc(frame, 'Show', function(self) 353 hooksecurefunc(frame, 'Show', function(frame)
347 veneer:Show() 354 veneer:Show()
348 end) 355 end)
349 356
357 hooksecurefunc(frame, 'SetShown', function(frame, isShown)
358 veneer:SetShown(isShown)
359 end)
360
361
350 veneer:SetParent(UIParent) 362 veneer:SetParent(UIParent)
351 veneer:SetAllPoints(frame) 363 veneer:SetAllPoints(frame)
352 veneer:SetFrameStrata('BACKGROUND') 364 veneer:SetFrameStrata('MEDIUM')
353 end 365 end
354 366
355 367
356 --- Set widgets to reflect the passed parameters 368 --- Set widgets to reflect the passed parameters
357 function plugin:UpdateButton (name, duration, expires) 369 function plugin:UpdateButton (name, duration, expires)