Exemplo n.º 1
0
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'))
Exemplo n.º 2
0
 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'))
Exemplo n.º 3
0
 def __requestToCreateOrJoinFortBattle(self, battleID, slotIndex=-1):
     yield self.prbDispatcher.join(
         CreateOrJoinFortBattleCtx(battleID,
                                   slotIndex,
                                   'fort/fortBattle/createOrJoin',
                                   flags=FUNCTIONAL_FLAG.SWITCH))
Exemplo n.º 4
0
 def __requestToCreateOrJoinFortBattle(self, battleID, slotIndex=-1):
     yield self.prbDispatcher.join(
         CreateOrJoinFortBattleCtx(battleID, slotIndex,
                                   'fort/fortBattle/createOrJoin'))