Пример #1
0
    def __getVehicleTypesVO(self):
        result = [{'label': '#menu:carousel_tank_filter/all',
          'data': -1,
          'icon': getVehicleTypeAssetPath('all')}]
        for index, vehicleType in enumerate(VEHICLE_TYPES_ORDER):
            result.append({'label': '#menu:carousel_tank_filter/%s' % vehicleType,
             'data': index,
             'icon': getVehicleTypeAssetPath(vehicleType)})

        return result
Пример #2
0
    def __getVehicleTypesVO(self):
        result = [{
            'label': '#menu:carousel_tank_filter/all',
            'data': -1,
            'icon': getVehicleTypeAssetPath('all')
        }]
        for index, vehicleType in enumerate(VEHICLE_TYPES_ORDER):
            result.append({
                'label': '#menu:carousel_tank_filter/%s' % vehicleType,
                'data': index,
                'icon': getVehicleTypeAssetPath(vehicleType)
            })

        return result
def packIntVehicleTypesFilter(defaultVehType=-1):
    result = [{
        'label': MENU.CAROUSEL_TANK_FILTER_ALL,
        'data': defaultVehType,
        'icon': getVehicleTypeAssetPath('all')
    }]
    for idx, vehicleType in enumerate(VEHICLE_TYPES_ORDER):
        result.append({
            'label': '#menu:carousel_tank_filter/' + vehicleType,
            'data': idx,
            'icon': getVehicleTypeAssetPath(vehicleType)
        })

    return result
Пример #4
0
    def __updateFilterOptions(self, filterType):
        """
        Gets vo class name and filter data from AccountSettings by filterType
        set this data into Flash and call _update
        :param filterType: <str> tab ID
        """
        voClassName, showExtra = self._getTabClass(filterType).getFilterInitData()
        filters = AccountSettings.getFilter('%s_%s' % (self.getName(), filterType))
        data = {'voClassName': voClassName,
         'showExtra': showExtra,
         'voData': filters}
        if filterType in (STORE_CONSTANTS.VEHICLE, STORE_CONSTANTS.RESTORE_VEHICLE, STORE_CONSTANTS.TRADE_IN_VEHICLE):
            vehicleTypes = []
            levels = []
            selectedTypes = filters['selectedTypes']
            selectedLevels = filters['selectedLevels']
            data['voData'].update({'vehicleTypes': vehicleTypes,
             'levels': levels})
            for idx, vehicleType in enumerate(VEHICLE_TYPES_ORDER):
                vehicleTypes.append({'value': getVehicleTypeAssetPath(vehicleType),
                 'tooltip': makeTooltip('#menu:carousel_tank_filter/{}'.format(vehicleType), '#tank_carousel_filter:tooltip/vehicleTypes/body'),
                 'selected': selectedTypes[idx]})

            for level in VEHICLE_LEVELS:
                levels.append({'value': getLevelsAssetPath('level_{}'.format(level)),
                 'selected': selectedLevels[level - 1]})

        self.as_setFilterOptionsS(data)
        self._update()
Пример #5
0
 def _getProviderObject(self, vehicleType):
     assetPath = {
         'label': self._getVehicleTypeLabel(vehicleType),
         'data': vehicleType,
         'icon': getVehicleTypeAssetPath(vehicleType)
     }
     return assetPath
Пример #6
0
    def __prepareAndPassVehiclesData(self):
        values = []
        for vehicleCD in g_itemsCache.items.stats.eliteVehicles:
            try:
                vehicle = g_itemsCache.items.getItemByCD(vehicleCD)
                if not vehicle.xp:
                    continue
                values.append({'id': vehicle.intCD,
                 'vehicleType': getVehicleTypeAssetPath(vehicle.type),
                 'vehicleName': vehicle.shortUserName,
                 'xp': vehicle.xp,
                 'xpStrValue': BigWorld.wg_getIntegralFormat(vehicle.xp),
                 'isSelectCandidate': vehicle.isFullyElite,
                 'vehicleIco': vehicle.iconSmall,
                 'nationIco': getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31)})
            except:
                continue

        labelBuilder = builder().addStyledText('middleTitle', i18n.makeString(MENU.EXCHANGE_RATE))
        if self.__xpForFree is not None:
            labelBuilder.addStyledText(self.__getActionStyle(), i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL))
            labelBuilder.addStyledText('expText', i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE, icon=icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2), forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree)))
        exchangeHeaderData = {'labelText': labelBuilder.render(),
         'rateFromIcon': ICON_TEXT_FRAMES.GOLD,
         'rateToIcon': ICON_TEXT_FRAMES.ELITE_XP,
         'rateFromTextColor': self.app.colorManager.getColorScheme('textColorGold').get('rgb'),
         'rateToTextColor': self.app.colorManager.getColorScheme('textColorCredits').get('rgb')}
        vehicleData = {'isHaveElite': bool(values),
         'vehicleList': values,
         'tableHeader': self._getTableHeader(),
         'xpForFree': self.__xpForFree,
         'exchangeHeaderData': exchangeHeaderData}
        self.as_vehiclesDataChangedS(vehicleData)
        return
Пример #7
0
    def __prepareAndPassVehiclesData(self):
        values = []
        for vehicleCD in g_itemsCache.items.stats.eliteVehicles:
            try:
                vehicle = g_itemsCache.items.getItemByCD(vehicleCD)
                if not vehicle.xp:
                    continue
                values.append({'id': vehicle.intCD,
                 'vehicleType': getVehicleTypeAssetPath(vehicle.type),
                 'vehicleName': vehicle.shortUserName,
                 'xp': vehicle.xp,
                 'xpStrValue': BigWorld.wg_getIntegralFormat(vehicle.xp),
                 'isSelectCandidate': vehicle.isFullyElite,
                 'vehicleIco': vehicle.iconSmall,
                 'nationIco': getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31)})
            except:
                continue

        labelBuilder = builder().addStyledText('middleTitle', i18n.makeString(MENU.EXCHANGE_RATE))
        if self.__xpForFree is not None:
            labelBuilder.addStyledText(self.__getActionStyle(), i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL))
            labelBuilder.addStyledText('expText', i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE, icon=icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2), forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree)))
        exchangeHeaderData = {'labelText': labelBuilder.render(),
         'rateFromIcon': ICON_TEXT_FRAMES.GOLD,
         'rateToIcon': ICON_TEXT_FRAMES.ELITE_XP,
         'rateFromTextColor': self.app.colorManager.getColorScheme('textColorGold').get('rgb'),
         'rateToTextColor': self.app.colorManager.getColorScheme('textColorCredits').get('rgb')}
        vehicleData = {'isHaveElite': bool(values),
         'vehicleList': values,
         'tableHeader': self._getTableHeader(),
         'xpForFree': self.__xpForFree,
         'exchangeHeaderData': exchangeHeaderData}
        self.as_vehiclesDataChangedS(vehicleData)
        return
Пример #8
0
    def __prepareAndPassVehiclesData(self):
        values = []
        for vehicleCD in g_itemsCache.items.stats.eliteVehicles:
            try:
                vehicle = g_itemsCache.items.getItemByCD(vehicleCD)
                if not vehicle.xp:
                    continue
                values.append({'id': vehicle.intCD,
                 'vehicleType': getVehicleTypeAssetPath(vehicle.type),
                 'vehicleName': vehicle.shortUserName,
                 'xp': vehicle.xp,
                 'isSelectCandidate': vehicle.isFullyElite,
                 'vehicleIco': vehicle.iconSmall,
                 'nationIco': getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31)})
            except:
                continue

        labelBuilder = builder().addStyledText('middleTitle', i18n.makeString(MENU.EXCHANGE_RATE))
        if self.__xpForFree is not None:
            labelBuilder.addStyledText(self.__getActionStyle(), i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL))
            labelBuilder.addStyledText('expText', i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE, icon=icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2), forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree)))
        vehicleData = {'isHaveElite': bool(values),
         'vehicleList': values,
         'tableHeader': self._getTableHeader(),
         'xpForFree': self.__xpForFree,
         'rateLabel': labelBuilder.render(),
         'xpAction': g_itemsCache.items.shop.isXPConversionActionActive}
        self.as_vehiclesDataChangedS(vehicleData)
        return
Пример #9
0
 def _getProviderObject(self, vehicleType):
     assetPath = {
         "label": self._getVehicleTypeLabel(vehicleType),
         "data": vehicleType,
         "icon": getVehicleTypeAssetPath(vehicleType),
     }
     return assetPath
Пример #10
0
    def __prepareAndPassVehiclesData(self):
        eliteVcls = g_itemsCache.items.stats.eliteVehicles
        xps = g_itemsCache.items.stats.vehiclesXPs
        unlocks = g_itemsCache.items.stats.unlocks
        values = []

        def getSmallIcon(vehType):
            return '../maps/icons/vehicle/small/%s.png' % vehType.name.replace(
                ':', '-')

        for vehicleCD in eliteVcls:
            vehicle = g_itemsCache.items.getItemByCD(vehicleCD)
            if vehicle.descriptor.type.compactDescr in eliteVcls:
                xp = xps.get(vehicle.descriptor.type.compactDescr, 0)
                if not xp:
                    continue
                isSelectCandidate = getVehicleEliteState(
                    vehicle, eliteVcls,
                    unlocks) == VEHICLE_ELITE_STATE.FULLY_ELITE
                vehicleInfo = dict(
                    id=vehicle.intCD,
                    vehicleType=getVehicleTypeAssetPath(vehicle.type),
                    vehicleName=vehicle.shortUserName,
                    xp=xp,
                    isSelectCandidate=isSelectCandidate,
                    vehicleIco=getSmallIcon(vehicle.descriptor.type),
                    nationIco=getNationsAssetPath(
                        vehicle.nationID,
                        namePrefix=NATION_ICON_PREFIX_131x31))
                values.append(vehicleInfo)

        self.as_vehiclesDataChangedS(bool(values), values)
def packVehicleTypesFilter(defaultVehType, types=VEHICLE_TYPES_ORDER):
    if types is not VEHICLE_TYPES_ORDER:
        types = sorted(types,
                       key=lambda _type: VEHICLE_TYPES_ORDER_INDICES[_type])
    result = [{
        'label': MENU.CAROUSEL_TANK_FILTER_ALL,
        'data': defaultVehType,
        'icon': getVehicleTypeAssetPath('all')
    }]
    for vehicleType in types:
        result.append({
            'label': '#menu:carousel_tank_filter/' + vehicleType,
            'data': vehicleType,
            'icon': getVehicleTypeAssetPath(vehicleType)
        })

    return result
Пример #12
0
 def __packTypesListBlock(self):
     return formatters.packImageListParameterBlockData(
         listIconSrc=[
             getVehicleTypeAssetPath(v) for v in self._vehicleTypes
         ],
         columnWidth=27,
         rowHeight=20,
         padding=formatters.packPadding(bottom=8, left=7))
Пример #13
0
    def _getInitialFilterVO(self, contexts):
        filtersVO = super(RoyaleTankCarousel,
                          self)._getInitialFilterVO(contexts)
        hotFilters = filtersVO['hotFilters']
        for hotFilter in hotFilters:
            entry = hotFilter['id']
            hotFilter['value'] = getVehicleTypeAssetPath(entry)
            hotFilter['tooltip'] = makeTooltip(
                '#menu:carousel_tank_filter/{}'.format(entry),
                TANK_CAROUSEL_FILTER.TOOLTIP_VEHICLETYPES_BODY)

        return filtersVO
Пример #14
0
def _getInitialVO(filters, mapping, xpRateMultiplier):
    dataVO = {'nationsSectionId': _SECTION.NATIONS,
     'vehicleTypesSectionId': _SECTION.VEHICLE_TYPES,
     'levelsSectionId': _SECTION.LEVELS,
     'specialSectionId': _SECTION.SPECIALS,
     'hiddenSectionId': _SECTION.HIDDEN,
     'titleLabel': text_styles.highTitle('#tank_carousel_filter:popover/title'),
     'nationsLabel': text_styles.standard('#tank_carousel_filter:popover/label/nations'),
     'vehicleTypesLabel': text_styles.standard('#tank_carousel_filter:popover/label/vehicleTypes'),
     'levelsLabel': text_styles.standard('#tank_carousel_filter:popover/label/levels'),
     'specialsLabel': text_styles.standard('#tank_carousel_filter:popover/label/specials'),
     'hiddenLabel': text_styles.standard('#tank_carousel_filter:popover/label/hidden'),
     'defaultButtonLabel': _ms('#tank_carousel_filter:popover/label/defaultButton'),
     'nations': [],
     'vehicleTypes': [],
     'levels': [],
     'specials': [],
     'hidden': [],
     'defaultButtonTooltip': makeTooltip('#tank_carousel_filter:tooltip/defaultButton/header', '#tank_carousel_filter:tooltip/defaultButton/body'),
     'hiddenSectionVisible': True}
    for entry in mapping[_SECTION.NATIONS]:
        dataVO['nations'].append({'value': getNationsFilterAssetPath(entry),
         'tooltip': makeTooltip('#nations:{}'.format(entry), '#tank_carousel_filter:tooltip/nations/body'),
         'selected': filters[entry]})

    for entry in mapping[_SECTION.LEVELS]:
        dataVO['levels'].append({'value': getLevelsAssetPath(entry),
         'selected': filters[entry]})

    for entry in mapping[_SECTION.VEHICLE_TYPES]:
        dataVO['vehicleTypes'].append({'value': getVehicleTypeAssetPath(entry),
         'tooltip': makeTooltip('#menu:carousel_tank_filter/{}'.format(entry), '#tank_carousel_filter:tooltip/vehicleTypes/body'),
         'selected': filters[entry]})

    for entry in mapping[_SECTION.HIDDEN]:
        dataVO['hidden'].append({'label': text_styles.standard('#tank_carousel_filter:popover/checkbox/{}'.format(entry)),
         'tooltip': makeTooltip('#tank_carousel_filter:tooltip/{}/header'.format(entry), '#tank_carousel_filter:tooltip/{}/body'.format(entry)),
         'selected': filters[entry]})

    for entry in mapping[_SECTION.SPECIALS]:
        if entry == 'bonus':
            ctx = {'multiplier': xpRateMultiplier}
        else:
            ctx = {}
        dataVO['specials'].append({'label': makeHtmlString('html_templates:lobby/carousel_filter/popover', entry, ctx),
         'tooltip': makeTooltip('#tank_carousel_filter:tooltip/{}/header'.format(entry), _ms('#tank_carousel_filter:tooltip/{}/body'.format(entry), **ctx)),
         'selected': filters[entry]})

    if not dataVO['hidden']:
        dataVO['hiddenSectionVisible'] = False
    return dataVO
Пример #15
0
    def __prepareAndPassVehiclesData(self):
        values = []
        for vehicleCD in g_itemsCache.items.stats.eliteVehicles:
            try:
                vehicle = g_itemsCache.items.getItemByCD(vehicleCD)
                if not vehicle.xp:
                    continue
                values.append({
                    'id':
                    vehicle.intCD,
                    'vehicleType':
                    getVehicleTypeAssetPath(vehicle.type),
                    'vehicleName':
                    vehicle.shortUserName,
                    'xp':
                    vehicle.xp,
                    'isSelectCandidate':
                    vehicle.isFullyElite,
                    'vehicleIco':
                    vehicle.iconSmall,
                    'nationIco':
                    getNationsAssetPath(vehicle.nationID,
                                        namePrefix=NATION_ICON_PREFIX_131x31)
                })
            except:
                continue

        labelBuilder = builder().addStyledText(
            'middleTitle', i18n.makeString(MENU.EXCHANGE_RATE))
        if self.__xpForFree is not None:
            labelBuilder.addStyledText(
                self.__getActionStyle(),
                i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL))
            labelBuilder.addStyledText(
                'expText',
                i18n.makeString(
                    MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE,
                    icon=icons.makeImageTag(
                        RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2),
                    forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree)))
        vehicleData = {
            'isHaveElite': bool(values),
            'vehicleList': values,
            'tableHeader': self._getTableHeader(),
            'xpForFree': self.__xpForFree,
            'rateLabel': labelBuilder.render(),
            'xpAction': g_itemsCache.items.shop.isXPConversionActionActive
        }
        self.as_vehiclesDataChangedS(vehicleData)
Пример #16
0
def _getInitialVO(filters, hasRentedVehicles):
    dataVO = {'nationTypeId': _SECTIONS.NATION,
     'vehicleTypeId': _SECTIONS.VEHICLE_TYPE,
     'specialTypesLeftId': _SECTIONS.SPECIAL_LEFT,
     'specialTypesRightId': _SECTIONS.SPECIAL_RIGHT,
     'levelTypesId': _SECTIONS.LEVELS,
     'rentVehicleId': _SECTIONS.RENT_VEHICLE,
     'titleLabel': text_styles.highTitle('#tank_carousel_filter:filter/popover/title'),
     'nationLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/nation'),
     'vehicleTypeLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicle'),
     'vehicleLevelLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicleLevel'),
     'vehicleEliteTypeLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicleEliteType'),
     'btnDefaultTooltip': makeTooltip('#tank_carousel_filter:filter/popover/tooltip/defaultBtn/header', '#tank_carousel_filter:filter/popover/tooltip/defaultBtn/body'),
     'btnDefaultLabel': _ms('#tank_carousel_filter:filter/popover/label/defaultBtn'),
     'specialTypeLeft': [{'label': text_styles.standard('#tank_carousel_filter:filter/popover/checkBox/Premium'),
                          'tooltip': makeTooltip('#tank_carousel_filter:filter/popover/tooltip/premium/header', '#tank_carousel_filter:filter/popover/tooltip/premium/body'),
                          'selected': filters['premium']}],
     'specialTypeRight': [{'label': text_styles.standard('#tank_carousel_filter:filter/popover/checkBox/Elite'),
                           'tooltip': makeTooltip('#tank_carousel_filter:filter/popover/tooltip/elite/header', '#tank_carousel_filter:filter/popover/tooltip/elite/body'),
                           'selected': filters['elite']}],
     'nationsType': [],
     'vehicleType': [],
     'levelsType': [],
     'hasRentedVehicles': hasRentedVehicles,
     'rentCheckBox': {'label': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicleLease'),
                      'selected': filters['hideRented'],
                      'enabled': not filters['igr'] if constants.IS_KOREA else True}}
    if constants.IS_KOREA:
        dataVO['specialTypeLeft'].append({'label': icons.premiumIgrSmall(),
         'selected': filters['igr']})
    for nation in GUI_NATIONS:
        dataVO['nationsType'].append({'value': getNationsFilterAssetPath(nation),
         'tooltip': makeTooltip(_ms('#nations:%s' % nation), _ms('#tank_carousel_filter:filter/popover/tooltip/nation/body')),
         'selected': filters[nation]})

    for level in VEHICLE_LEVELS:
        dataVO['levelsType'].append({'value': getLevelsAssetPath(level),
         'selected': filters['level_%d' % level]})

    for vehicleType in VEHICLE_TYPES_ORDER:
        dataVO['vehicleType'].append({'value': getVehicleTypeAssetPath(vehicleType),
         'tooltip': makeTooltip(_ms('#menu:carousel_tank_filter/%s' % vehicleType), _ms('#tank_carousel_filter:filter/popover/tooltip/vehicleType/body')),
         'selected': filters[vehicleType]})

    return dataVO
Пример #17
0
    def __prepareAndPassVehiclesData(self):
        values = []
        for vehicleCD in g_itemsCache.items.stats.eliteVehicles:
            try:
                vehicle = g_itemsCache.items.getItemByCD(vehicleCD)
                if not vehicle.xp:
                    continue
                values.append({'id': vehicle.intCD,
                 'vehicleType': getVehicleTypeAssetPath(vehicle.type),
                 'vehicleName': vehicle.shortUserName,
                 'xp': vehicle.xp,
                 'isSelectCandidate': vehicle.isFullyElite,
                 'vehicleIco': vehicle.iconSmall,
                 'nationIco': getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31)})
            except:
                continue

        self.as_vehiclesDataChangedS(bool(values), values)
Пример #18
0
    def __prepareAndPassVehiclesData(self):
        values = []
        for vehicleCD in g_itemsCache.items.stats.eliteVehicles:
            try:
                vehicle = g_itemsCache.items.getItemByCD(vehicleCD)
                if not vehicle.xp:
                    continue
                values.append(
                    {
                        "id": vehicle.intCD,
                        "vehicleType": getVehicleTypeAssetPath(vehicle.type),
                        "vehicleName": vehicle.shortUserName,
                        "xp": vehicle.xp,
                        "isSelectCandidate": vehicle.isFullyElite,
                        "vehicleIco": vehicle.iconSmall,
                        "nationIco": getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31),
                    }
                )
            except:
                continue

        labelBuilder = builder().addStyledText("middleTitle", i18n.makeString(MENU.EXCHANGE_RATE))
        if self.__xpForFree is not None:
            labelBuilder.addStyledText(
                self.__getActionStyle(), i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL)
            )
            labelBuilder.addStyledText(
                "expText",
                i18n.makeString(
                    MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE,
                    icon=icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2),
                    forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree),
                ),
            )
        vehicleData = {
            "isHaveElite": bool(values),
            "vehicleList": values,
            "tableHeader": self._getTableHeader(),
            "xpForFree": self.__xpForFree,
            "rateLabel": labelBuilder.render(),
        }
        self.as_vehiclesDataChangedS(vehicleData)
        return
Пример #19
0
    def __prepareAndPassVehiclesData(self):
        eliteVcls = g_itemsCache.items.stats.eliteVehicles
        xps = g_itemsCache.items.stats.vehiclesXPs
        unlocks = g_itemsCache.items.stats.unlocks
        values = []

        def getSmallIcon(vehType):
            return '../maps/icons/vehicle/small/%s.png' % vehType.name.replace(':', '-')

        for vehicleCD in eliteVcls:
            vehicle = g_itemsCache.items.getItemByCD(vehicleCD)
            if vehicle.descriptor.type.compactDescr in eliteVcls:
                xp = xps.get(vehicle.descriptor.type.compactDescr, 0)
                if not xp:
                    continue
                isSelectCandidate = getVehicleEliteState(vehicle, eliteVcls, unlocks) == VEHICLE_ELITE_STATE.FULLY_ELITE
                vehicleInfo = dict(id=vehicle.intCD, vehicleType=getVehicleTypeAssetPath(vehicle.type), vehicleName=vehicle.shortUserName, xp=xp, isSelectCandidate=isSelectCandidate, vehicleIco=getSmallIcon(vehicle.descriptor.type), nationIco=getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31))
                values.append(vehicleInfo)

        self.as_vehiclesDataChangedS(bool(values), values)
Пример #20
0
 def __packTypesListBlock(self):
     return formatters.packImageListParameterBlockData(listIconSrc=[ getVehicleTypeAssetPath(v) for v in self._vehicleTypes ], columnWidth=27, rowHeight=20, padding=formatters.packPadding(bottom=8, left=7))
Пример #21
0
 def __getProviderObject(self, vehicleType):
     assetPath = {'label': self.__getVehicleTypeLabel(vehicleType),
      'data': vehicleType,
      'icon': getVehicleTypeAssetPath(vehicleType)}
     return assetPath
Пример #22
0
    def _getInitialVO(self, filters, xpRateMultiplier):
        mapping = self.__mapping
        vehType = self.__getSelectedVehType(filters)
        dataVO = {
            'nationsSectionId':
            _SECTION.NATIONS,
            'vehicleTypesSectionId':
            _SECTION.VEHICLE_TYPES,
            'levelsSectionId':
            _SECTION.LEVELS,
            'specialSectionId':
            _SECTION.SPECIALS,
            'hiddenSectionId':
            _SECTION.HIDDEN,
            'progressionsSectionId':
            _SECTION.PROGRESSIONS,
            'rolesSectionId':
            _SECTION.ROLES_WITH_EXTRA,
            'titleLabel':
            text_styles.highTitle('#tank_carousel_filter:popover/title'),
            'nationsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/nations'),
            'vehicleTypesLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/vehicleTypes'),
            'levelsLabel':
            text_styles.standard('#tank_carousel_filter:popover/label/levels'),
            'specialsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/specials'),
            'hiddenLabel':
            text_styles.standard('#tank_carousel_filter:popover/label/hidden'),
            'progressionsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/progressions'),
            'rolesLabel':
            self.__getRolesLabel(vehType),
            'searchInputLabel':
            backport.text(R.strings.tank_carousel_filter.popover.label.
                          searchNameVehicle()),
            'searchInputName':
            filters.get('searchNameVehicle') or '',
            'searchInputTooltip':
            makeTooltip(
                '#tank_carousel_filter:tooltip/searchInput/header',
                backport.text(
                    R.strings.tank_carousel_filter.tooltip.searchInput.body(),
                    count=50)),
            'searchInputMaxChars':
            50,
            'nations': [],
            'vehicleTypes': [],
            'levels': [],
            'specials': [],
            'hidden': [],
            'progressions': [],
            'roles': {},
            'hiddenSectionVisible':
            True,
            'specialSectionVisible':
            True,
            'tankTierSectionVisible':
            True,
            'searchSectionVisible':
            True,
            'progressionsSectionVisible':
            False,
            'rolesSectionVisible':
            False,
            'changeableArrowDirection':
            False
        }

        def isSelected(entry):
            return filters.get(entry, False)

        for entry in mapping[_SECTION.NATIONS]:
            dataVO['nations'].append({
                'value':
                getNationsFilterAssetPath(entry),
                'tooltip':
                makeTooltip('#nations:{}'.format(entry),
                            '#tank_carousel_filter:tooltip/nations/body'),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.LEVELS]:
            dataVO['levels'].append({
                'value': getLevelsAssetPath(entry),
                'selected': isSelected(entry)
            })

        for entry in mapping[_SECTION.VEHICLE_TYPES]:
            dataVO['vehicleTypes'].append({
                'value':
                getVehicleTypeAssetPath(entry),
                'tooltip':
                makeTooltip('#menu:carousel_tank_filter/{}'.format(entry),
                            '#tank_carousel_filter:tooltip/vehicleTypes/body'),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.HIDDEN]:
            dataVO['hidden'].append({
                'label':
                text_styles.standard(
                    '#tank_carousel_filter:popover/checkbox/{}'.format(entry)),
                'tooltip':
                makeTooltip(
                    '#tank_carousel_filter:tooltip/{}/header'.format(entry),
                    '#tank_carousel_filter:tooltip/{}/body'.format(entry)),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.SPECIALS]:
            contexts = getFilterPopoverSetupContexts(xpRateMultiplier)
            filterCtx = contexts.get(entry, FilterSetupContext())
            tooltipRes = R.strings.tank_carousel_filter.tooltip.dyn(entry)
            dataVO['specials'].append({
                'value':
                getButtonsAssetPath(filterCtx.asset or entry),
                'tooltip':
                makeTooltip(
                    backport.text(tooltipRes.header()) if tooltipRes else '',
                    backport.text(tooltipRes.body(), **filterCtx.ctx))
                if tooltipRes else '',
                'selected':
                isSelected(entry),
                'enabled':
                not (entry == 'bonus' and self._isFrontline)
            })

        for entry in mapping[_SECTION.PROGRESSIONS]:
            contexts = getFilterPopoverSetupContexts(xpRateMultiplier)
            filterCtx = contexts.get(entry, FilterSetupContext())
            tooltipRes = R.strings.tank_carousel_filter.tooltip.dyn(entry)
            dataVO['progressions'].append({
                'value':
                getButtonsAssetPath(filterCtx.asset or entry),
                'tooltip':
                makeTooltip(
                    backport.text(tooltipRes.header()) if tooltipRes else '',
                    backport.text(tooltipRes.body(), **filterCtx.ctx))
                if tooltipRes else '',
                'selected':
                isSelected(entry)
            })

        for vType in mapping[_SECTION.VEHICLE_TYPES]:
            if vType != VEHICLE_CLASS_NAME.SPG:
                dataVO['roles'][vType] = [
                    self.__getRoleVO(entry, filters)
                    for entry in mapping[_SECTION.ROLES].get(vType, [])
                    if entry is not None
                ]

        if not dataVO['hidden']:
            dataVO['hiddenSectionVisible'] = False
        if not dataVO['specials']:
            dataVO['specialSectionVisible'] = False
        if self._withRoles and vehType is not None and vehType is not VEHICLE_CLASS_NAME.SPG:
            dataVO['rolesSectionVisible'] = True
        return dataVO
Пример #23
0
def _getInitialVO(filters, hasRentedVehicles):
    dataVO = {
        'nationTypeId':
        _SECTIONS.NATION,
        'vehicleTypeId':
        _SECTIONS.VEHICLE_TYPE,
        'specialTypesLeftId':
        _SECTIONS.SPECIAL_LEFT,
        'specialTypesRightId':
        _SECTIONS.SPECIAL_RIGHT,
        'levelTypesId':
        _SECTIONS.LEVELS,
        'rentVehicleId':
        _SECTIONS.RENT_VEHICLE,
        'titleLabel':
        text_styles.highTitle('#tank_carousel_filter:filter/popover/title'),
        'nationLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/nation'),
        'vehicleTypeLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/vehicle'),
        'vehicleLevelLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/vehicleLevel'),
        'vehicleEliteTypeLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/vehicleEliteType'),
        'btnDefaultTooltip':
        makeTooltip(
            '#tank_carousel_filter:filter/popover/tooltip/defaultBtn/header',
            '#tank_carousel_filter:filter/popover/tooltip/defaultBtn/body'),
        'btnDefaultLabel':
        _ms('#tank_carousel_filter:filter/popover/label/defaultBtn'),
        'specialTypeLeft': [{
            'label':
            text_styles.standard(
                '#tank_carousel_filter:filter/popover/checkBox/Premium'),
            'tooltip':
            makeTooltip(
                '#tank_carousel_filter:filter/popover/tooltip/premium/header',
                '#tank_carousel_filter:filter/popover/tooltip/premium/body'),
            'selected':
            filters['premium']
        }],
        'specialTypeRight': [{
            'label':
            text_styles.standard(
                '#tank_carousel_filter:filter/popover/checkBox/Elite'),
            'tooltip':
            makeTooltip(
                '#tank_carousel_filter:filter/popover/tooltip/elite/header',
                '#tank_carousel_filter:filter/popover/tooltip/elite/body'),
            'selected':
            filters['elite']
        }],
        'nationsType': [],
        'vehicleType': [],
        'levelsType': [],
        'hasRentedVehicles':
        hasRentedVehicles,
        'rentCheckBox': {
            'label':
            text_styles.standard(
                '#tank_carousel_filter:filter/popover/label/vehicleLease'),
            'selected':
            filters['hideRented'],
            'enabled':
            not filters['igr'] if constants.IS_KOREA else True
        }
    }
    if constants.IS_KOREA:
        dataVO['specialTypeLeft'].append({
            'label': icons.premiumIgrSmall(),
            'selected': filters['igr']
        })
    for nation in GUI_NATIONS:
        dataVO['nationsType'].append({
            'value':
            getNationsFilterAssetPath(nation),
            'tooltip':
            makeTooltip(
                _ms('#nations:%s' % nation),
                _ms('#tank_carousel_filter:filter/popover/tooltip/nation/body')
            ),
            'selected':
            filters[nation]
        })

    for level in VEHICLE_LEVELS:
        dataVO['levelsType'].append({
            'value': getLevelsAssetPath(level),
            'selected': filters['level_%d' % level]
        })

    for vehicleType in VEHICLE_TYPES_ORDER:
        dataVO['vehicleType'].append({
            'value':
            getVehicleTypeAssetPath(vehicleType),
            'tooltip':
            makeTooltip(
                _ms('#menu:carousel_tank_filter/%s' % vehicleType),
                _ms('#tank_carousel_filter:filter/popover/tooltip/vehicleType/body'
                    )),
            'selected':
            filters[vehicleType]
        })

    return dataVO
Пример #24
0
    def _getInitialVO(self, filters, xpRateMultiplier):
        mapping = self.__mapping
        dataVO = {
            'nationsSectionId':
            _SECTION.NATIONS,
            'vehicleTypesSectionId':
            _SECTION.VEHICLE_TYPES,
            'levelsSectionId':
            _SECTION.LEVELS,
            'specialSectionId':
            _SECTION.SPECIALS,
            'hiddenSectionId':
            _SECTION.HIDDEN,
            'titleLabel':
            text_styles.highTitle('#tank_carousel_filter:popover/title'),
            'nationsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/nations'),
            'vehicleTypesLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/vehicleTypes'),
            'levelsLabel':
            text_styles.standard('#tank_carousel_filter:popover/label/levels'),
            'specialsLabel':
            text_styles.standard(
                '#tank_carousel_filter:popover/label/specials'),
            'hiddenLabel':
            text_styles.standard('#tank_carousel_filter:popover/label/hidden'),
            'searchInputLabel':
            _ms('#tank_carousel_filter:popover/label/searchNameVehicle'),
            'searchInputName':
            filters.get('searchNameVehicle') or '',
            'searchInputTooltip':
            makeTooltip(
                '#tank_carousel_filter:tooltip/searchInput/header',
                _ms('#tank_carousel_filter:tooltip/searchInput/body',
                    count=50)),
            'searchInputMaxChars':
            50,
            'nations': [],
            'vehicleTypes': [],
            'levels': [],
            'specials': [],
            'hidden': [],
            'hiddenSectionVisible':
            True,
            'specialSectionVisible':
            True
        }

        def isSelected(entry):
            return filters.get(entry, False)

        for entry in mapping[_SECTION.NATIONS]:
            dataVO['nations'].append({
                'value':
                getNationsFilterAssetPath(entry),
                'tooltip':
                makeTooltip('#nations:{}'.format(entry),
                            '#tank_carousel_filter:tooltip/nations/body'),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.LEVELS]:
            dataVO['levels'].append({
                'value': getLevelsAssetPath(entry),
                'selected': isSelected(entry)
            })

        for entry in mapping[_SECTION.VEHICLE_TYPES]:
            dataVO['vehicleTypes'].append({
                'value':
                getVehicleTypeAssetPath(entry),
                'tooltip':
                makeTooltip('#menu:carousel_tank_filter/{}'.format(entry),
                            '#tank_carousel_filter:tooltip/vehicleTypes/body'),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.HIDDEN]:
            dataVO['hidden'].append({
                'label':
                text_styles.standard(
                    '#tank_carousel_filter:popover/checkbox/{}'.format(entry)),
                'tooltip':
                makeTooltip(
                    '#tank_carousel_filter:tooltip/{}/header'.format(entry),
                    '#tank_carousel_filter:tooltip/{}/body'.format(entry)),
                'selected':
                isSelected(entry)
            })

        for entry in mapping[_SECTION.SPECIALS]:
            contexts = getFilterPopoverSetupContexts(xpRateMultiplier)
            filterCtx = contexts.get(entry, FilterSetupContext())
            dataVO['specials'].append({
                'value':
                getButtonsAssetPath(filterCtx.asset or entry),
                'tooltip':
                makeTooltip(
                    '#tank_carousel_filter:tooltip/{}/header'.format(entry),
                    _ms('#tank_carousel_filter:tooltip/{}/body'.format(entry),
                        **filterCtx.ctx)),
                'selected':
                isSelected(entry)
            })

        if not dataVO['hidden']:
            dataVO['hiddenSectionVisible'] = False
        if not dataVO['specials']:
            dataVO['specialSectionVisible'] = False
        return dataVO