Пример #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'))
Пример #2
0
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'))
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
 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
Пример #6
0
 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
Пример #7
0
 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
Пример #8
0
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'))
Пример #9
0
 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)
Пример #10
0
 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)
Пример #11
0
 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)
Пример #12
0
 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)
Пример #13
0
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'))