class BattleSessionList(PrebattlesListWindow, BattleSessionListMeta):

    def __init__(self):
        super(BattleSessionList, self).__init__(LAZY_CHANNEL.SPECIAL_BATTLES)
        self.__listRequester = AutoInvitesRequester()

    @process
    def requestToJoinTeam(self, prbID, prbType):
        yield self.prbDispatcher.join(context.JoinBattleSessionCtx(prbID, prbType, 'prebattle/join'))

    def getClientID(self):
        return channel_num_gen.getClientID4LazyChannel(LAZY_CHANNEL.SPECIAL_BATTLES)

    def _populate(self):
        super(BattleSessionList, self)._populate()
        self.__listRequester.start(self.__onBSListReceived)
        self.__listRequester.request()

    def _dispose(self):
        self.__listRequester.stop()
        super(BattleSessionList, self)._dispose()

    def __onBSListReceived(self, sessions):
        result = []
        for bs in sessions:
            result.append({'prbID': bs.prbID,
             'prbType': bs.prbType,
             'descr': formatters.getPrebattleFullDescription(bs.description),
             'opponents': formatters.getPrebattleOpponentsString(bs.description),
             'startTime': formatters.getBattleSessionStartTimeString(bs.startTime)})

        self.as_refreshListS(result)
Example #2
0
class BattleSessionList(PrebattlesListWindow, BattleSessionListMeta):

    def __init__(self, ctx = None):
        super(BattleSessionList, self).__init__(LAZY_CHANNEL.SPECIAL_BATTLES)
        self.__listRequester = AutoInvitesRequester()



    def requestToJoinTeam(self, prbID, prbType):
        item = self.__listRequester.getItem(prbID)
        if g_lobbyContext.isAnotherPeriphery(item.peripheryID):
            self.fireEvent(events.LoadViewEvent(PREBATTLE_ALIASES.AUTO_INVITE_WINDOW_PY, ctx={'prbID': prbID}), scope=EVENT_BUS_SCOPE.LOBBY)
        else:
            self.__requestToJoin(prbID, prbType)



    def getClientID(self):
        return channel_num_gen.getClientID4LazyChannel(LAZY_CHANNEL.SPECIAL_BATTLES)



    def onFocusIn(self, alias):
        self.fireEvent(FocusEvent(FocusEvent.COMPONENT_FOCUSED, {'clientID': self.getClientID()}))



    def _populate(self):
        super(BattleSessionList, self)._populate()
        self.__listRequester.start(self.__onBSListReceived)
        self.__listRequester.request()



    def _dispose(self):
        self.__listRequester.stop()
        super(BattleSessionList, self)._dispose()



    @process
    def __requestToJoin(self, prbID, prbType):
        yield self.prbDispatcher.join(prb_ctx.JoinBattleSessionCtx(prbID, prbType, 'prebattle/join'))



    def __onBSListReceived(self, sessions):
        result = []
        for bs in sessions:
            result.append({'prbID': bs.prbID,
             'prbType': bs.prbType,
             'descr': formatters.getPrebattleFullDescription(bs.description),
             'opponents': formatters.getPrebattleOpponentsString(bs.description),
             'startTime': formatters.getBattleSessionStartTimeString(bs.startTime)})

        self.as_refreshListS(result)
Example #3
0
class BattleSessionList(PrebattlesListWindow, BattleSessionListMeta):
    def __init__(self, ctx=None):
        super(BattleSessionList, self).__init__(LAZY_CHANNEL.SPECIAL_BATTLES)
        self.__listRequester = AutoInvitesRequester()

    def requestToJoinTeam(self, prbID, prbType):
        item = self.__listRequester.getItem(prbID)
        if g_lobbyContext.isAnotherPeriphery(item.peripheryID):
            self.fireEvent(events.LoadViewEvent(
                PREBATTLE_ALIASES.AUTO_INVITE_WINDOW_PY, ctx={'prbID': prbID}),
                           scope=EVENT_BUS_SCOPE.LOBBY)
        else:
            self.__requestToJoin(prbID, prbType)

    def getClientID(self):
        return channel_num_gen.getClientID4LazyChannel(
            LAZY_CHANNEL.SPECIAL_BATTLES)

    def onFocusIn(self, alias):
        self.fireEvent(
            FocusEvent(FocusEvent.COMPONENT_FOCUSED,
                       {'clientID': self.getClientID()}))

    def _populate(self):
        super(BattleSessionList, self)._populate()
        self.__listRequester.start(self.__onBSListReceived)
        self.__listRequester.request()

    def _dispose(self):
        self.__listRequester.stop()
        super(BattleSessionList, self)._dispose()

    @process
    def __requestToJoin(self, prbID, prbType):
        yield self.prbDispatcher.join(
            prb_ctx.JoinBattleSessionCtx(prbID, prbType, 'prebattle/join'))

    def __onBSListReceived(self, sessions):
        result = []
        for bs in sessions:
            result.append({
                'prbID':
                bs.prbID,
                'prbType':
                bs.prbType,
                'descr':
                formatters.getPrebattleFullDescription(bs.description),
                'opponents':
                formatters.getPrebattleOpponentsString(bs.description),
                'startTime':
                formatters.getBattleSessionStartTimeString(bs.startTime)
            })

        self.as_refreshListS(result)
class BattleSessionList(PrebattlesListWindow, BattleSessionListMeta):
    def __init__(self):
        super(BattleSessionList, self).__init__(LAZY_CHANNEL.SPECIAL_BATTLES)
        self.__listRequester = AutoInvitesRequester()

    @process
    def requestToJoinTeam(self, prbID, prbType):
        yield self.prbDispatcher.join(
            context.JoinBattleSessionCtx(prbID, prbType, 'prebattle/join'))

    def getClientID(self):
        return channel_num_gen.getClientID4LazyChannel(
            LAZY_CHANNEL.SPECIAL_BATTLES)

    def _populate(self):
        super(BattleSessionList, self)._populate()
        self.__listRequester.start(self.__onBSListReceived)
        self.__listRequester.request()

    def _dispose(self):
        self.__listRequester.stop()
        super(BattleSessionList, self)._dispose()

    def __onBSListReceived(self, sessions):
        result = []
        for bs in sessions:
            result.append({
                'prbID':
                bs.prbID,
                'prbType':
                bs.prbType,
                'descr':
                formatters.getPrebattleFullDescription(bs.description),
                'opponents':
                formatters.getPrebattleOpponentsString(bs.description),
                'startTime':
                formatters.getBattleSessionStartTimeString(bs.startTime)
            })

        self.as_refreshListS(result)