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 __requestToReloginAndJoin(self, peripheryID, ctx): result = yield DialogsInterface.showDialog( UnitConfirmDialogMeta( PREBATTLE_TYPE.UNIT, 'changePeriphery', messageCtx={ 'host': self.lobbyContext.getPeripheryName(peripheryID) })) if result: self.prbPeripheriesHandler.join(peripheryID, ctx)
def __requestToReloginAndCreateOrJoinFortBattle(self, peripheryID, battleID, slotIndex=-1): result = yield DialogsInterface.showDialog( UnitConfirmDialogMeta( PREBATTLE_TYPE.FORT_BATTLE, 'changePeriphery', messageCtx={ 'host': g_lobbyContext.getPeripheryName(peripheryID) })) if result: self.prbPeripheriesHandler.join( peripheryID, CreateOrJoinFortBattleCtx(battleID, slotIndex, 'fort/fortBattle/createOrJoin'))