def kill(self): GUIView.kill(self) for i in range(2): for sprite in self.cardWidgets[i]: sprite.kill() while len(self.cardWidgets[i]) > 0: wid = self.cardWidgets[i].pop() del wid del self.cardWidgets
def Activate( self, renderGroup, rect, evManager=None ): GUIView.Activate(self, renderGroup, rect, evManager) self.state = StoreScreen.STATE_RUNNING avatar = self.player.avatar card = HealthCard( self.evManager ) buyEvent = BuyItemRequest( avatar, card ) leaveEvent = GoToTownRequest( self.player ) self.buttons = { 'buy': ['Buy', buyEvent], 'leave': ['Leave', leaveEvent], } self.widgets = [ ButtonSprite( self.evManager, self.buttons['buy'][0], container=self, onClickEvent=self.buttons['buy'][1], ), ButtonSprite( self.evManager, self.buttons['leave'][0], container=self, onClickEvent=self.buttons['leave'][1], ) ] self.renderGroup.add( self.widgets ) self.ArrangeWidgets()
def Activate(self, renderGroup, rect, evManager=None): GUIView.Activate(self, renderGroup, rect, evManager) b1 = HomeButton(self.evManager, container=self) b2 = StoreButton(self.evManager, container=self) b3 = ForestButton(self.evManager, container=self) b4 = ArenaButton(self.evManager, container=self) self.widgets = [b1, b2, b3, b4] self.renderGroup.add(self.widgets) self.ArrangeWidgets()
def Notify(self, event): GUIView.Notify(self, event) if isinstance( event, DuelFinishEvent ) \ and event.duel is self.duel: ev = GUIChangeScreenRequest('town') self.evManager.Post(ev) elif isinstance( event, CharactorPlayCardEvent ) \ and event.charactor.player.duel is self.duel: self.CardPlayed(event.charactor, event.card) elif isinstance(event, CharactorPlayCardEvent): print "DUMB STUFF HAPPENS"
def Notify(self, event): GUIView.Notify(self, event) if isinstance( event, TickEvent ) \ and self.state == ExploreScreen.STATE_PREPARING: self.state = ExploreScreen.STATE_RUNNING self.Explore() #if isinstance( event, PlayerExplorationEvent ): #self.Explore( event.player, event.turns ) if isinstance(event, DuelStartEvent): import gui player = gui.playerRef.player if player in event.duel.players: ev = GUIChangeScreenRequest('forest') self.evManager.Post(ev)
def Activate(self, renderGroup, rect, evManager=None): GUIView.Activate(self, renderGroup, rect, evManager) import gui duel = gui.playerRef.player.duel self.duel = duel m1Name = duel.players[0].monster.name m2Name = duel.players[1].monster.name p1N = LabelSprite(self.evManager, m1Name, self) p2N = LabelSprite(self.evManager, m2Name, self) h1 = HealthSprite(self.evManager, duel.players[0].monster, self) h2 = HealthSprite(self.evManager, duel.players[1].monster, self) m1 = MonsterSprite(evManager, duel.players[0].monster, self) m2 = MonsterSprite(evManager, duel.players[1].monster, self) self.widgets = [p1N, p2N, h1, h2, m1, m2] self.cardWidgets = [[], []] self.renderGroup.add(self.widgets) self.ArrangeWidgets()
def __init__(self, evManager, player ): GUIView.__init__(self, evManager) self.state = StoreScreen.STATE_PREPARING self.player = player self.selectedItem = None
def Notify(self, event): GUIView.Notify( self, event ) if isinstance( event, GoToTownEvent ): ev = GUIChangeScreenRequest( 'town' ) self.evManager.Post( ev )
def __init__(self, evManager, player, turns): GUIView.__init__(self, evManager) self.state = ExploreScreen.STATE_PREPARING self.turns = turns self.player = player