def tryToConnectFortBattle(battleID, peripheryID): from gui.prb_control.dispatcher import g_prbLoader from gui import DialogsInterface, SystemMessages yield lambda callback: callback(None) if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): result = yield DialogsInterface.showDialog( UnitConfirmDialogMeta( PREBATTLE_TYPE.FORT_BATTLE, 'changePeriphery', messageCtx={ 'host': g_lobbyContext.getPeripheryName(peripheryID) })) if result: g_prbLoader.getPeripheriesHandler().join( peripheryID, CreateOrJoinFortBattleCtx( battleID, waitingID='fort/fortBattle/createOrJoin')) else: SystemMessages.pushI18nMessage( '#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: yield g_prbLoader.getDispatcher().join( CreateOrJoinFortBattleCtx( battleID, waitingID='fort/fortBattle/createOrJoin'))
def tryToConnectClubBattle(club, joinTime): from gui import DialogsInterface, SystemMessages from gui.prb_control.dispatcher import g_prbLoader from gui.Scaleform.daapi.view.dialogs.rally_dialog_meta import UnitConfirmDialogMeta yield lambda callback: callback(None) if not club: LOG_ERROR('Invalid club info to join unit', club, joinTime) return clubDbID = club.getClubDbID() if club.hasActiveUnit(): peripheryID = club.getUnitInfo().peripheryID if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): result = yield DialogsInterface.showDialog( UnitConfirmDialogMeta( PREBATTLE_TYPE.CLUBS, 'changePeriphery', messageCtx={ 'host': g_lobbyContext.getPeripheryName(peripheryID) })) if result: g_prbLoader.getPeripheriesHandler().join( peripheryID, JoinClubBattleCtx(clubDbID, joinTime, allowDelay=True, waitingID='clubs/joinClubUnit')) else: SystemMessages.pushI18nMessage( '#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) return yield g_prbLoader.getDispatcher().join( JoinClubBattleCtx(clubDbID, joinTime, waitingID='clubs/joinClubUnit'))
def __handleCreateOrJoinFortBattle(self, peripheryID, battleID, slotIndex = -1): if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): self.__requestToReloginAndCreateOrJoinFortBattle(peripheryID, battleID, slotIndex) else: SystemMessages.pushI18nMessage('#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: self.__requestToCreateOrJoinFortBattle(battleID, slotIndex)
def onJoinRally(self, rallyId, slotIndex, peripheryID): ctx = JoinUnitCtx(rallyId, PREBATTLE_TYPE.SORTIE, slotIndex, waitingID='prebattle/join') if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): self.__requestToReloginAndJoinSortie(peripheryID, ctx) else: SystemMessages.pushI18nMessage('#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: self.__requestToJoinSortie(ctx)
def canAcceptInvite(self, invite): result = True dispatcher = self.__loader.getDispatcher() if dispatcher is not None and dispatcher.getEntity().hasLockedState(): result = False peripheryID = invite.peripheryID if result and g_lobbyContext.isAnotherPeriphery(peripheryID): result = g_lobbyContext.isPeripheryAvailable(peripheryID) return result
def canAcceptInvite(self, invite): result = True dispatcher = self.__loader.getDispatcher() if dispatcher: prbFunctional = dispatcher.getPrbFunctional() unitFunctional = dispatcher.getUnitFunctional() if prbFunctional and prbFunctional.hasLockedState() or unitFunctional and unitFunctional.hasLockedState(): result = False peripheryID = invite.peripheryID if result and g_lobbyContext.isAnotherPeriphery(peripheryID): result = g_lobbyContext.isPeripheryAvailable(peripheryID) return result
def canAcceptInvite(self, invite): result = True dispatcher = self.__loader.getDispatcher() if dispatcher: prbFunctional = dispatcher.getPrbFunctional() unitFunctional = dispatcher.getUnitFunctional() if prbFunctional and prbFunctional.hasLockedState() or unitFunctional and unitFunctional.hasLockedState(): result = False peripheryID = invite.peripheryID if result and g_lobbyContext.isAnotherPeriphery(peripheryID): result = g_lobbyContext.isPeripheryAvailable(peripheryID) return result
def tryToConnectFortBattle(battleID, peripheryID): from gui.prb_control.dispatcher import g_prbLoader yield lambda callback: callback(None) if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): result = yield DialogsInterface.showDialog(UnitConfirmDialogMeta(PREBATTLE_TYPE.FORT_BATTLE, 'changePeriphery', messageCtx={'host': g_lobbyContext.getPeripheryName(peripheryID)})) if result: g_prbLoader.getPeripheriesHandler().join(peripheryID, CreateOrJoinFortBattleCtx(battleID, waitingID='fort/fortBattle/createOrJoin')) else: SystemMessages.pushI18nMessage('#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: yield g_prbLoader.getDispatcher().join(CreateOrJoinFortBattleCtx(battleID, waitingID='fort/fortBattle/createOrJoin'))
def __handleCreateOrJoinFortBattle(self, peripheryID, battleID, slotIndex=-1): if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): self.__requestToReloginAndCreateOrJoinFortBattle( peripheryID, battleID, slotIndex) else: SystemMessages.pushI18nMessage( '#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: self.__requestToCreateOrJoinFortBattle(battleID, slotIndex)
def onJoinRally(self, rallyId, slotIndex, peripheryID): ctx = JoinUnitCtx(rallyId, PREBATTLE_TYPE.SORTIE, slotIndex, waitingID='prebattle/join') if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): self.__requestToReloginAndJoinSortie(peripheryID, ctx) else: SystemMessages.pushI18nMessage( '#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: self.__requestToJoinSortie(ctx)
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)
def onJoinRally(self, rallyId, slotIndex, peripheryID): if self.unitFunctional.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 = unit_ctx.JoinUnitCtx(rallyId, self.getPrbType(), 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)
def tryToConnectClubBattle(club, joinTime): from gui import DialogsInterface, SystemMessages from gui.prb_control.dispatcher import g_prbLoader from gui.Scaleform.daapi.view.dialogs.rally_dialog_meta import UnitConfirmDialogMeta yield lambda callback: callback(None) if not club: LOG_ERROR('Invalid club info to join unit', club, joinTime) return clubDbID = club.getClubDbID() if club.hasActiveUnit(): peripheryID = club.getUnitInfo().peripheryID if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): result = yield DialogsInterface.showDialog(UnitConfirmDialogMeta(PREBATTLE_TYPE.CLUBS, 'changePeriphery', messageCtx={'host': g_lobbyContext.getPeripheryName(peripheryID)})) if result: g_prbLoader.getPeripheriesHandler().join(peripheryID, JoinClubBattleCtx(clubDbID, joinTime, allowDelay=True, waitingID='clubs/joinClubUnit')) else: SystemMessages.pushI18nMessage('#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) return yield g_prbLoader.getDispatcher().join(JoinClubBattleCtx(clubDbID, joinTime, waitingID='clubs/joinClubUnit'))