def doAction(self, action=None):
     if self.getPlayerInfo().isReady():
         self.setPlayerState(
             SetPlayerStateCtx(False,
                               waitingID='prebattle/player_not_ready'))
     else:
         self.setPlayerState(
             SetPlayerStateCtx(True, waitingID='prebattle/player_ready'))
     return True
Beispiel #2
0
 def requestToReady(self, value):
     if value:
         waitingID = 'prebattle/player_ready'
     else:
         waitingID = 'prebattle/player_not_ready'
     ctx = SetPlayerStateCtx(value, waitingID=waitingID)
     result = yield self.prbDispatcher.sendPrbRequest(ctx)
     if result:
         self.as_toggleReadyBtnS(not value)
     else:
         self._showActionErrorMessage(ctx.getLastErrorString())
Beispiel #3
0
 def __handleViewLoad(self, event):
     if isinstance(
             event,
             LoadGuiImplViewEvent) or event.alias in self.__loadEvents:
         self.setPlayerState(
             SetPlayerStateCtx(False,
                               waitingID='prebattle/player_not_ready'))
 def requestToReady(self, value):
     if value:
         waitingID = 'prebattle/player_ready'
     else:
         waitingID = 'prebattle/player_not_ready'
     result = yield self.prbDispatcher.sendPrbRequest(SetPlayerStateCtx(value, waitingID=waitingID))
     if result:
         self.as_toggleReadyBtnS(not value)
Beispiel #5
0
 def changeUserObserverStatus(self, ctx, callback=None):
     if ctx.isObserver():
         self._setPlayerReady(ctx, callback=callback)
     else:
         self._setPlayerReady(
             SetPlayerStateCtx(ctx.isReadyState(),
                               ctx.isInitial(),
                               waitingID='prebattle/player_ready'),
             self.__onPlayerReady)
     self._cooldown.process(REQUEST_TYPE.CHANGE_USER_STATUS)
Beispiel #6
0
 def __setCreatorReady(self):
     """
     Set creator ready method
     """
     if self.getPlayerInfo().isReady():
         self.__setTeamReady()
     else:
         self.setPlayerState(SetPlayerStateCtx(
             True, waitingID='prebattle/player_ready'),
                             callback=self.__onCreatorReady)
Beispiel #7
0
 def exitFromQueue(self):
     if self.isCommander():
         self.setTeamState(
             SetTeamStateCtx(1, False,
                             waitingID='prebattle/team_not_ready'))
     else:
         self.setPlayerState(
             SetPlayerStateCtx(False,
                               waitingID='prebattle/player_not_ready'))
     return True
 def __currentPlayerEntered(self):
     if self.__currentPlayerIsOut:
         if self.prbEntity.storage.isObserver:
             yield self.prbDispatcher.sendPrbRequest(
                 SetPlayerObserverStateCtx(
                     isObserver=True,
                     isReadyState=True,
                     waitingID='prebattle/change_user_status'))
         else:
             yield self.prbDispatcher.sendPrbRequest(
                 SetPlayerStateCtx(True,
                                   waitingID='prebattle/player_ready'))
         self.as_setObserverS(self.prbEntity.storage.isObserver)
         self.__currentPlayerIsOut = False
Beispiel #9
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)
Beispiel #10
0
 def changeUserObserverStatus(self, ctx, callback=None):
     """
     Sets player as observer/not observer
     Args:
         ctx: observer request context
         callback: operation callback
     """
     if ctx.isObserver():
         self._setPlayerReady(ctx, callback=callback)
     else:
         self._setPlayerReady(
             SetPlayerStateCtx(ctx.isReadyState(),
                               ctx.isInitial(),
                               waitingID='prebattle/player_ready'),
             self.__onPlayerReady)
     self._cooldown.process(REQUEST_TYPE.CHANGE_USER_STATUS)
 def __currentPlayerEntered(self):
     if self.__currentPlayerIsOut:
         yield self.prbDispatcher.sendPrbRequest(
             SetPlayerStateCtx(True, waitingID='prebattle/player_ready'))
Beispiel #12
0
 def __handleViewLoad(self, event):
     if event.alias in self.__loadEvents:
         self.setPlayerState(
             SetPlayerStateCtx(False,
                               waitingID='prebattle/player_not_ready'))
 def __handleViewLoad(self, event):
     self.setPlayerState(SetPlayerStateCtx(False, waitingID='prebattle/player_not_ready'))
Beispiel #14
0
 def __handleViewLoad(self, event):
     """
     Listener for view load event
     """
     self.setPlayerState(
         SetPlayerStateCtx(False, waitingID='prebattle/player_not_ready'))