コード例 #1
0
ファイル: battlequeue.py プロジェクト: 19colt87/WOTDecompiled
    def onQueueInfoReceived(self, randomsQueueInfo, companiesQueueInfo):
        if prb_control.isCompany():
            data = {'title': '#menu:prebattle/typesCompaniesTitle',
             'data': list()}
            self.flashObject.as_setPlayers(makeString('#menu:prebattle/groupsLabel'), sum(companiesQueueInfo['divisions']))
            vDivisions = companiesQueueInfo['divisions']
            if vDivisions is not None:
                vClassesLen = len(vDivisions)
                for vDivision in BattleQueue.DIVISIONS_ORDERED:
                    data['data'].append(('#menu:prebattle/CompaniesTitle/%s' % constants.PREBATTLE_COMPANY_DIVISION_NAMES[vDivision], vDivisions[vDivision] if vDivision < vClassesLen else 0))

                self.flashObject.as_setListByType(data)
            self.flashObject.as_showStart(constants.IS_DEVELOPMENT)
        else:
            self.flashObject.as_setPlayers(makeString('#menu:prebattle/playersLabel'), sum(randomsQueueInfo['levels']))
            vehLevels = randomsQueueInfo['levels']
            vehLevels = vehLevels[:] if vehLevels is not None else []
            vehLevels.reverse()
            data = {'title': '#menu:prebattle/levelsTitle',
             'data': vehLevels[:-1]}
            self.flashObject.as_setListByLevel(data)
            vClasses = randomsQueueInfo['classes']
            if vClasses is not None:
                data = {'title': '#menu:prebattle/typesTitle',
                 'data': list()}
                vClassesLen = len(vClasses)
                for vClass, message in BattleQueue.TYPES_ORDERED:
                    idx = constants.VEHICLE_CLASS_INDICES[vClass]
                    data['data'].append((message, vClasses[idx] if idx < vClassesLen else 0))

                self.flashObject.as_setListByType(data)
            self.flashObject.as_showStart(constants.IS_DEVELOPMENT and sum(randomsQueueInfo['levels']) > 1)
        if not self.__inited:
            self.__inited = True
        return
コード例 #2
0
ファイル: battlequeue.py プロジェクト: webiumsk/WoT
    def onQueueInfoReceived(self, randomsQueueInfo, companiesQueueInfo, historicalQueueInfo):
        if prb_control.isCompany():
            data = {'title': '#menu:prebattle/typesCompaniesTitle',
             'data': list()}
            self.flashObject.as_setPlayers(makeHtmlString('html_templates:lobby/queue/playersLabel', 'teams', {'count': sum(companiesQueueInfo['divisions'])}))
            vDivisions = companiesQueueInfo['divisions']
            if vDivisions is not None:
                vClassesLen = len(vDivisions)
                for vDivision in BattleQueue.DIVISIONS_ORDERED:
                    data['data'].append(('#menu:prebattle/CompaniesTitle/%s' % constants.PREBATTLE_COMPANY_DIVISION_NAMES[vDivision], vDivisions[vDivision] if vDivision < vClassesLen else 0))

                self.as_setListByTypeS(data)
            self.as_showStartS(constants.IS_DEVELOPMENT)
        elif prb_control.isInHistoricalQueue():
            battleID = self.preQueueFunctional.getSetting(PREQUEUE_SETTING_NAME.BATTLE_ID)
            battleData = historicalQueueInfo[battleID]
            battle = g_eventsCache.getHistoricalBattles(False)[battleID]
            teamA = battleData.get(HistoricalBattle.SIDES.A, {})
            teamB = battleData.get(HistoricalBattle.SIDES.B, {})
            countA = sum(teamA.get('by_class', {}).values())
            countB = sum(teamB.get('by_class', {}).values())
            self.flashObject.as_setPlayers(makeHtmlString('html_templates:lobby/queue/playersLabel', 'twoSides', {'sideA': battle.getSideUserName(HistoricalBattle.SIDES.A),
             'countA': countA,
             'sideB': battle.getSideUserName(HistoricalBattle.SIDES.B),
             'countB': countB}))
            data = {'title': '#menu:prebattle/typesTitle',
             'data': []}
            vClassesData = data['data']
            for vClass, message in BattleQueue.TYPES_ORDERED:
                byClassA = teamA.get('by_class', {}).get(vClass, 0)
                byClassB = teamB.get('by_class', {}).get(vClass, 0)
                vClassesData.append((message, byClassA + byClassB))

            self.as_setListByTypeS(data)
        else:
            info = dict(randomsQueueInfo)
            if 'classes' in info:
                vClasses = info['classes']
                vClassesLen = len(vClasses)
            else:
                vClasses = []
                vClassesLen = 0
            self.flashObject.as_setPlayers(makeHtmlString('html_templates:lobby/queue/playersLabel', 'players', {'count': sum(vClasses)}))
            if vClassesLen:
                data = {'title': '#menu:prebattle/typesTitle',
                 'data': []}
                vClassesData = data['data']
                for vClass, message in BattleQueue.TYPES_ORDERED:
                    idx = constants.VEHICLE_CLASS_INDICES[vClass]
                    vClassesData.append((message, vClasses[idx] if idx < vClassesLen else 0))

                self.as_setListByTypeS(data)
            self.as_showStartS(constants.IS_DEVELOPMENT and sum(vClasses) > 1)
        if not self.__inited:
            self.__inited = True
        return
コード例 #3
0
 def __updateQueueInfo(self):
     self.__queueCallback = None
     currPlayer = BigWorld.player()
     if currPlayer is not None and hasattr(currPlayer, 'requestQueueInfo'):
         if prb_control.isCompany():
             qType = constants.QUEUE_TYPE.COMPANIES
         else:
             qType = constants.QUEUE_TYPE.RANDOMS
         currPlayer.requestQueueInfo(qType)
         self.__queueCallback = BigWorld.callback(5, self.__updateQueueInfo)
     return
コード例 #4
0
ファイル: battlequeue.py プロジェクト: 19colt87/WOTDecompiled
 def __updateQueueInfo(self):
     self.__queueCallback = None
     currPlayer = BigWorld.player()
     if currPlayer is not None and hasattr(currPlayer, 'requestQueueInfo'):
         if prb_control.isCompany():
             qType = constants.QUEUE_TYPE.COMPANIES
         else:
             qType = constants.QUEUE_TYPE.RANDOMS
         currPlayer.requestQueueInfo(qType)
         self.__queueCallback = BigWorld.callback(5, self.__updateQueueInfo)
     return
コード例 #5
0
 def __updateQueueInfo(self):
     self.__queueCallback = None
     currPlayer = BigWorld.player()
     if currPlayer is not None and hasattr(currPlayer, 'requestQueueInfo'):
         if prb_control.isCompany():
             qType = constants.QUEUE_TYPE.COMPANIES
         elif prb_control.isInHistoricalQueue():
             qType = constants.QUEUE_TYPE.HISTORICAL
         elif prb_control.isInEventBattlesQueue():
             qType = constants.QUEUE_TYPE.EVENT_BATTLES
         else:
             qType = constants.QUEUE_TYPE.RANDOMS
         currPlayer.requestQueueInfo(qType)
         self.__queueCallback = BigWorld.callback(5, self.__updateQueueInfo)
コード例 #6
0
    def onQueueInfoReceived(self, randomsQueueInfo, companiesQueueInfo):
        if prb_control.isCompany():
            data = {
                'title': '#menu:prebattle/typesCompaniesTitle',
                'data': list()
            }
            self.flashObject.as_setPlayers(
                makeString('#menu:prebattle/groupsLabel'),
                sum(companiesQueueInfo['divisions']))
            vDivisions = companiesQueueInfo['divisions']
            if vDivisions is not None:
                vClassesLen = len(vDivisions)
                for vDivision in BattleQueue.DIVISIONS_ORDERED:
                    data['data'].append(
                        ('#menu:prebattle/CompaniesTitle/%s' %
                         constants.PREBATTLE_COMPANY_DIVISION_NAMES[vDivision],
                         vDivisions[vDivision]
                         if vDivision < vClassesLen else 0))

                self.flashObject.as_setListByType(data)
            self.flashObject.as_showStart(constants.IS_DEVELOPMENT)
        else:
            self.flashObject.as_setPlayers(
                makeString('#menu:prebattle/playersLabel'),
                sum(randomsQueueInfo['levels']))
            vehLevels = randomsQueueInfo['levels']
            vehLevels = vehLevels[:] if vehLevels is not None else []
            vehLevels.reverse()
            data = {
                'title': '#menu:prebattle/levelsTitle',
                'data': vehLevels[:-1]
            }
            self.flashObject.as_setListByLevel(data)
            vClasses = randomsQueueInfo['classes']
            if vClasses is not None:
                data = {'title': '#menu:prebattle/typesTitle', 'data': list()}
                vClassesLen = len(vClasses)
                for vClass, message in BattleQueue.TYPES_ORDERED:
                    idx = constants.VEHICLE_CLASS_INDICES[vClass]
                    data['data'].append(
                        (message, vClasses[idx] if idx < vClassesLen else 0))

                self.flashObject.as_setListByType(data)
            self.flashObject.as_showStart(
                constants.IS_DEVELOPMENT
                and sum(randomsQueueInfo['levels']) > 1)
        if not self.__inited:
            self.__inited = True
        return
コード例 #7
0
    def onQueueInfoReceived(self, randomsQueueInfo, companiesQueueInfo, historicalQueueInfo, eventQueueInfo):
        if prb_control.isCompany():
            data = {'title': '#menu:prebattle/typesCompaniesTitle',
             'data': list()}
            self.flashObject.as_setPlayers(makeHtmlString('html_templates:lobby/queue/playersLabel', 'teams', {'count': sum(companiesQueueInfo['divisions'])}))
            vDivisions = companiesQueueInfo['divisions']
            if vDivisions is not None:
                vClassesLen = len(vDivisions)
                for vDivision in BattleQueue.DIVISIONS_ORDERED:
                    data['data'].append(('#menu:prebattle/CompaniesTitle/%s' % constants.PREBATTLE_COMPANY_DIVISION_NAMES[vDivision], vDivisions[vDivision] if vDivision < vClassesLen else 0))

                self.as_setListByTypeS(data)
            self.as_showStartS(constants.IS_DEVELOPMENT)
        elif prb_control.isInHistoricalQueue():
            battleID = self.preQueueFunctional.getSetting(PREQUEUE_SETTING_NAME.BATTLE_ID)
            battleData = historicalQueueInfo[battleID]
            battle = g_eventsCache.getHistoricalBattles(False)[battleID]
            teamA = battleData.get(HistoricalBattle.SIDES.A, {})
            teamB = battleData.get(HistoricalBattle.SIDES.B, {})
            countA = sum(teamA.get('by_class', {}).values())
            countB = sum(teamB.get('by_class', {}).values())
            self.flashObject.as_setPlayers(makeHtmlString('html_templates:lobby/queue/playersLabel', 'twoSides', {'sideA': battle.getSideUserName(HistoricalBattle.SIDES.A),
             'countA': countA,
             'sideB': battle.getSideUserName(HistoricalBattle.SIDES.B),
             'countB': countB}))
            data = {'title': '#menu:prebattle/typesTitle',
             'data': []}
            vClassesData = data['data']
            for vClass, message in BattleQueue.TYPES_ORDERED:
                byClassA = teamA.get('by_class', {}).get(vClass, 0)
                byClassB = teamB.get('by_class', {}).get(vClass, 0)
                vClassesData.append((message, byClassA + byClassB))

            self.as_setListByTypeS(data)
        elif prb_control.isInEventBattlesQueue():
            info = dict(eventQueueInfo)
            vClasses = info.get('classes', [])
            vClassesLen = len(vClasses)
            totalPlayers = info.get('players', 0)
            self.flashObject.as_setPlayers(makeHtmlString('html_templates:lobby/queue/playersLabel', 'players', {'count': totalPlayers}))
            if vClassesLen:
                data = {'title': '#menu:prebattle/typesTitle',
                 'data': []}
                vClassesData = data['data']
                for vClass, message in BattleQueue.TYPES_ORDERED:
                    idx = constants.VEHICLE_CLASS_INDICES[vClass]
                    vClassesData.append((message, vClasses[idx] if idx < vClassesLen else 0))

                self.as_setListByTypeS(data)
        else:
            info = dict(randomsQueueInfo)
            if 'classes' in info:
                vClasses = info['classes']
                vClassesLen = len(vClasses)
            else:
                vClasses = []
                vClassesLen = 0
            self.flashObject.as_setPlayers(makeHtmlString('html_templates:lobby/queue/playersLabel', 'players', {'count': sum(vClasses)}))
            if vClassesLen:
                data = {'title': '#menu:prebattle/typesTitle',
                 'data': []}
                vClassesData = data['data']
                for vClass, message in BattleQueue.TYPES_ORDERED:
                    idx = constants.VEHICLE_CLASS_INDICES[vClass]
                    vClassesData.append((message, vClasses[idx] if idx < vClassesLen else 0))

                self.as_setListByTypeS(data)
            self.as_showStartS(constants.IS_DEVELOPMENT and sum(vClasses) > 1)
        if not self.__inited:
            self.__inited = True