Mercurial > wow > reaction
diff classes/MultiCastButton.lua @ 234:0e20f65375d5
Reworked button creation to not use goofy event driven semantics.
author | Flick |
---|---|
date | Tue, 22 Mar 2011 17:05:51 -0700 |
parents | 158c9299185b |
children |
line wrap: on
line diff
--- a/classes/MultiCastButton.lua Tue Mar 22 11:48:09 2011 -0700 +++ b/classes/MultiCastButton.lua Tue Mar 22 17:05:51 2011 -0700 @@ -113,7 +113,7 @@ totemIDsBySlot[i] = self:GetAttribute("TOTEM_PRIORITY_"..i) end - -- these are set up in bar:SetupBarHeader() + -- these are set up in bar:SetupBar() flyoutChildren = flyoutChildren or newtable() summonSpells = summonSpells or newtable() ]] @@ -323,7 +323,7 @@ ReAction.Button.MultiCast = MultiCast ReAction:RegisterBarType(MultiCast) -function MultiCast:New( idx, btnConfig, bar ) +function MultiCast:New( btnConfig, bar, idx ) local maxIndex = bar.nTotemSlots or 0 if bar.summonSlot then maxIndex = maxIndex + 1 @@ -613,7 +613,9 @@ end end -function MultiCast.SetupBarHeader( bar ) -- call this as a static method +function MultiCast:SetupBar( bar ) + Super.SetupBar(self,bar) + local slot = 0 local nTotemSlots = 0 local summonSlot = nil @@ -757,6 +759,21 @@ flyout:UpdateTextures(slot) end + -- re-execute setup when new spells are loaded + if not f.events_registered then + f:RegisterEvent("UPDATE_MULTI_CAST_ACTIONBAR") + f:RegisterEvent("PLAYER_ENTERING_WORLD") + -- Bar.frame does not use OnEvent + f:SetScript("OnEvent", + function() + if not InCombatLockdown() then + self:SetupBar(bar) + end + end) + f.events_registered = true + end + + f:Execute(_bar_init) end