def selectObserver(self, isObserver):
        if not isObserver:
            playersCount = 0
            roster = self.prbEntity.getRosterKey()
            if roster != PREBATTLE_ROSTER.UNKNOWN and roster & PREBATTLE_ROSTER.UNASSIGNED == 0:
                accounts = self.prbEntity.getRosters()[roster]
                for account in accounts:
                    if account.isVehicleSpecified():
                        vehicle = account.getVehicle()
                        if not vehicle.isObserver:
                            playersCount += 1

            playersMaxCount = self.__getPlayersMaxCount()
            if playersCount >= playersMaxCount:
                event = CoolDownEvent()
                self.as_startCoolDownObserverS(event.coolDown)
                self.as_setObserverS(not isObserver)
                self.__showActionErrorMessage(PREBATTLE_ERRORS.PLAYERS_LIMIT)
                return
        result = yield self.prbDispatcher.sendPrbRequest(
            SetPlayerObserverStateCtx(
                isObserver, True, waitingID='prebattle/change_user_status'))
        if not result:
            self.as_setObserverS(False)
            self.__showActionErrorMessage()
Exemple #2
0
 def selectObserver(self, isObserver):
     result = yield self.prbDispatcher.sendPrbRequest(
         SetPlayerObserverStateCtx(
             isObserver, True, waitingID='prebattle/change_user_status'))
     if not result:
         self.as_setObserverS(False)
         self._showActionErrorMessage()
Exemple #3
0
 def __enterTrainingRoom(self, isInitial=False):
     if self.storage.isObserver:
         self.changeUserObserverStatus(
             SetPlayerObserverStateCtx(
                 True,
                 True,
                 isInitial=isInitial,
                 waitingID='prebattle/change_user_status'),
             self.__onPlayerReady)
     else:
         self.setPlayerState(
             SetPlayerStateCtx(True,
                               isInitial=isInitial,
                               waitingID='prebattle/player_ready'),
             self.__onPlayerReady)