def unitMgr_onUnitJoined(self, unitMgrID, prbType): entity = self.__entity ctx = JoinUnitCtx(unitMgrID, prbType) if entity.isPlayerJoined(ctx): entity.rejoin() else: self.__setUnit(flags=self.__requestCtx.getFlags(), prbType=self.__requestCtx.getEntityType())
def onJoinRally(self, rallyId, slotIndex, peripheryID): ctx = JoinUnitCtx(rallyId, self.prbEntity.getEntityType(), slotIndex, waitingID='prebattle/join') if self.lobbyContext.isAnotherPeriphery(peripheryID): if self.lobbyContext.isPeripheryAvailable(peripheryID): self.__requestToReloginAndJoin(peripheryID, ctx) else: SystemMessages.pushI18nMessage( '#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: self.__requestToJoin(ctx)
def unitMgr_onUnitJoined(self, unitMgrID, prbType): """ Unit manager event listener for unit join. Sets unit entity if we're not already joined to it. Args: unitMgrID: unit manager identifier prbType: unit prebattle type """ entity = self.__entity ctx = JoinUnitCtx(unitMgrID, prbType) if entity.isPlayerJoined(ctx): entity.rejoin() else: self.__setUnit(flags=self.__requestCtx.getFlags(), prbType=self.__requestCtx.getEntityType())
def onJoinRally(self, rallyId, slotIndex, peripheryID): if self.prbEntity.getEntityType() == PREBATTLE_TYPE.CLUBS: if self.clubsState.getStateID() == CLIENT_CLUB_STATE.SENT_APP: if self.clubsState.getClubDbID() == rallyId: self.__requestToCancelClub(rallyId) elif self.clubsState.getStateID() == CLIENT_CLUB_STATE.NO_CLUB: self.__requestToJoinClub(rallyId) else: ctx = JoinUnitCtx(rallyId, self.prbEntity.getEntityType(), slotIndex, waitingID='prebattle/join') if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): self.__requestToReloginAndJoin(peripheryID, ctx) else: SystemMessages.pushI18nMessage('#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: self.__requestToJoin(ctx)