comparison 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
comparison
equal deleted inserted replaced
233:9b9f5fc84d34 234:0e20f65375d5
111 totemIDsBySlot = newtable() 111 totemIDsBySlot = newtable()
112 for i = 1, slotsPerPage do 112 for i = 1, slotsPerPage do
113 totemIDsBySlot[i] = self:GetAttribute("TOTEM_PRIORITY_"..i) 113 totemIDsBySlot[i] = self:GetAttribute("TOTEM_PRIORITY_"..i)
114 end 114 end
115 115
116 -- these are set up in bar:SetupBarHeader() 116 -- these are set up in bar:SetupBar()
117 flyoutChildren = flyoutChildren or newtable() 117 flyoutChildren = flyoutChildren or newtable()
118 summonSpells = summonSpells or newtable() 118 summonSpells = summonSpells or newtable()
119 ]] 119 ]]
120 120
121 local _onstate_multispellpage = -- function(self, stateid, newstate) 121 local _onstate_multispellpage = -- function(self, stateid, newstate)
321 { __index = Action } ) 321 { __index = Action } )
322 322
323 ReAction.Button.MultiCast = MultiCast 323 ReAction.Button.MultiCast = MultiCast
324 ReAction:RegisterBarType(MultiCast) 324 ReAction:RegisterBarType(MultiCast)
325 325
326 function MultiCast:New( idx, btnConfig, bar ) 326 function MultiCast:New( btnConfig, bar, idx )
327 local maxIndex = bar.nTotemSlots or 0 327 local maxIndex = bar.nTotemSlots or 0
328 if bar.summonSlot then 328 if bar.summonSlot then
329 maxIndex = maxIndex + 1 329 maxIndex = maxIndex + 1
330 end 330 end
331 if bar.recallSlot then 331 if bar.recallSlot then
611 frame.icon:SetTexture(GetSpellTexture(GetSpellInfo(spellID))) 611 frame.icon:SetTexture(GetSpellTexture(GetSpellInfo(spellID)))
612 frame.icon:SetTexCoord(0,1,0,1) 612 frame.icon:SetTexCoord(0,1,0,1)
613 end 613 end
614 end 614 end
615 615
616 function MultiCast.SetupBarHeader( bar ) -- call this as a static method 616 function MultiCast:SetupBar( bar )
617 Super.SetupBar(self,bar)
618
617 local slot = 0 619 local slot = 0
618 local nTotemSlots = 0 620 local nTotemSlots = 0
619 local summonSlot = nil 621 local summonSlot = nil
620 local recallSlot = nil 622 local recallSlot = nil
621 623
755 757
756 function f:UpdateFlyoutTextures(slot) 758 function f:UpdateFlyoutTextures(slot)
757 flyout:UpdateTextures(slot) 759 flyout:UpdateTextures(slot)
758 end 760 end
759 761
762 -- re-execute setup when new spells are loaded
763 if not f.events_registered then
764 f:RegisterEvent("UPDATE_MULTI_CAST_ACTIONBAR")
765 f:RegisterEvent("PLAYER_ENTERING_WORLD")
766 -- Bar.frame does not use OnEvent
767 f:SetScript("OnEvent",
768 function()
769 if not InCombatLockdown() then
770 self:SetupBar(bar)
771 end
772 end)
773 f.events_registered = true
774 end
775
776
760 f:Execute(_bar_init) 777 f:Execute(_bar_init)
761 end 778 end
762 779