def join(self, peripheryID, ctx, postActions=None, finishActions=None): if not g_lobbyContext.isAnotherPeriphery(peripheryID): LOG_ERROR('Player is in given periphery', peripheryID) return else: if postActions: if type(postActions) is types.ListType: actionsList = postActions else: LOG_ERROR('Argument "postActions" is invalid', postActions) return else: actionsList = [] actionsList.extend([ actions.DisconnectFromPeriphery(), actions.ConnectToPeriphery(peripheryID), self.__enableAction ]) if finishActions: if type(finishActions) is types.ListType: actionsList.extend(finishActions) else: LOG_ERROR('Argument "finishActions" is invalid', finishActions) return self.__joinCtx = ctx if self.__joinChain is not None: self.__joinChain.onStopped -= self.__onJoinChainStopped self.__joinChain.stop() self.__enableAction.inactivate() self.__joinChain = actions.ActionsChain(actionsList) self.__joinChain.onStopped += self.__onJoinChainStopped self.__joinChain.start() return
def doRelogin(self, peripheryID, onStoppedHandler = None, extraChainSteps = None): from gui.shared import actions LOG_DEBUG('Attempt to relogin to the another periphery', peripheryID) chain = [actions.LeavePrbModalEntity(), actions.DisconnectFromPeriphery(), actions.ConnectToPeriphery(peripheryID)] if extraChainSteps is not None: chain += extraChainSteps self.__reloginStoppedHandler = onStoppedHandler self.__reloginChain = actions.ActionsChain(chain) self.__reloginChain.onStopped += self.__onReloginStopped self.__reloginChain.start() return
def join(self, peripheryID, ctx, postActions=None, finishActions=None): """ Join to prebattle/unit that is on another periphery. Args: peripheryID: periphery identifier ctx: join request context postActions: post actions chain finishActions: finish actions chain """ if not self.lobbyContext.isAnotherPeriphery(peripheryID): LOG_ERROR('Player is in given periphery', peripheryID) return else: if postActions: if isinstance(postActions, types.ListType): actionsList = postActions else: LOG_ERROR('Argument "postActions" is invalid', postActions) return else: actionsList = [] actionsList.extend([ actions.DisconnectFromPeriphery(), actions.ConnectToPeriphery(peripheryID), self.__enableAction ]) if finishActions: if isinstance(finishActions, types.ListType): actionsList.extend(finishActions) else: LOG_ERROR('Argument "finishActions" is invalid', finishActions) return self.__joinCtx = ctx if self.__joinChain is not None: self.__joinChain.onStopped -= self.__onJoinChainStopped self.__joinChain.stop() self.__enableAction.inactivate() self.__joinChain = actions.ActionsChain(actionsList) self.__joinChain.onStopped += self.__onJoinChainStopped self.__joinChain.start() return