示例#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 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'))
示例#4
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'))
示例#5
0
 def __get__(self, obj, objType=None):
     """
     Getter for property.
     Args:
         obj: decorated object
         objType: decorated object's class
     
     Returns:
         peripheries handler
     """
     from gui.prb_control.dispatcher import g_prbLoader
     return g_prbLoader.getPeripheriesHandler()
示例#6
0
 def __get__(self, obj, objType = None):
     from gui.prb_control.dispatcher import g_prbLoader
     return g_prbLoader.getPeripheriesHandler()
示例#7
0
 def __get__(self, obj, objType = None):
     return g_prbLoader.getPeripheriesHandler()
示例#8
0
 def __get__(self, obj, objType = None):
     from gui.prb_control.dispatcher import g_prbLoader
     return g_prbLoader.getPeripheriesHandler()