示例#1
0
 def doAction(self, action=None, dispatcher=None):
     if self.isCreator():
         if self.getRosterKey() != PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1:
             DialogsInterface.showI18nInfoDialog('teamDoesNotHaveCommander',
                                                 lambda result: None)
             return True
         stats = self.getPlayersStateStats()
         creatorWeight = 1 if not self.getPlayerInfo().isReady() else 0
         readyCount = stats.playersCount - stats.notReadyCount
         if readyCount < stats.limitMaxCount - creatorWeight:
             DialogsInterface.showDialog(
                 I18nConfirmDialogMeta('teamHaveNotReadyPlayers',
                                       messageCtx={
                                           'readyCount': readyCount,
                                           'playersCount':
                                           stats.playersCount
                                       }), self.__setCreatorReady)
             return True
         self.__setCreatorReady(True)
     elif self.getPlayerInfo().isReady():
         self.setPlayerState(
             context.SetPlayerStateCtx(
                 False, waitingID='prebattle/player_not_ready'))
     else:
         self.setPlayerState(
             context.SetPlayerStateCtx(True,
                                       waitingID='prebattle/player_ready'))
     return True
示例#2
0
 def doAction(self, action=None, dispatcher=None):
     if self.isCreator():
         stats = self.getPlayersStateStats()
         if stats.haveInBattle:
             DialogsInterface.showI18nInfoDialog('squadHavePlayersInBattle',
                                                 lambda result: None)
             return True
         notReadyCount = stats.notReadyCount
         if not self.getPlayerInfo().isReady():
             notReadyCount -= 1
         if notReadyCount > 0:
             DialogsInterface.showDialog(
                 I18nConfirmDialogMeta('squadHaveNotReadyPlayers',
                                       messageCtx={
                                           'notReadyCount': notReadyCount,
                                           'playersCount':
                                           stats.playersCount
                                       }), self.__setCreatorReady)
             return True
         self.__setCreatorReady(True)
     elif self.getPlayerInfo().isReady():
         self.setPlayerState(
             context.SetPlayerStateCtx(
                 False, waitingID='prebattle/player_not_ready'))
     else:
         self.setPlayerState(
             context.SetPlayerStateCtx(True,
                                       waitingID='prebattle/player_ready'))
     return True
示例#3
0
 def doAction(self, action=None, dispatcher=None):
     if self.getPlayerInfo().isReady():
         self.setPlayerState(
             context.SetPlayerStateCtx(
                 False, waitingID='prebattle/player_not_ready'))
     else:
         self.setPlayerState(
             context.SetPlayerStateCtx(True,
                                       waitingID='prebattle/player_ready'))
     return True
示例#4
0
 def requestToReady(self, value):
     if value:
         waitingID = 'prebattle/player_ready'
     else:
         waitingID = 'prebattle/player_not_ready'
     result = yield self.prbDispatcher.sendPrbRequest(context.SetPlayerStateCtx(value, waitingID=waitingID))
     if result:
         self.as_toggleReadyBtnS(not value)
示例#5
0
 def __setCreatorReady(self, result):
     if not result:
         return
     if self.getPlayerInfo().isReady():
         self.__setTeamReady()
     else:
         self.setPlayerState(context.SetPlayerStateCtx(
             True, waitingID='prebattle/player_ready'),
                             callback=self.__onCreatorReady)
示例#6
0
 def exitFromRandomQueue(self):
     if self.isCreator():
         self.setTeamState(
             context.SetTeamStateCtx(1,
                                     False,
                                     waitingID='prebattle/team_not_ready'))
     else:
         self.setPlayerState(
             context.SetPlayerStateCtx(
                 False, waitingID='prebattle/player_not_ready'))
     return True