def __setSeasonData(self, forceAnim=False): seasonRenderersList = [] filledSeasonSlots = 0 for season in SEASONS_ORDER: seasonName = SEASON_TYPE_TO_NAME.get(season) if self.__ctx.mode == C11nMode.CUSTOM: isFilled = self.__ctx.checkSlotsFillingForSeason(season) else: isFilled = self.__ctx.modifiedStyle is not None filledSeasonSlots += int(isFilled) seasonRenderersList.append({ 'nameText': VEHICLE_CUSTOMIZATION.getSeasonName(seasonName), 'nameSelectedText': VEHICLE_CUSTOMIZATION.getSeasonSelectedName(seasonName), 'seasonImageSrc': RES_ICONS.getSeasonImage(seasonName), 'seasonBGImageSrc': RES_ICONS.getSeasonBGImage(seasonName), 'seasonShineImageSrc': RES_ICONS.getSeasonShineImage(seasonName), 'isFilled': isFilled, 'forceAnim': forceAnim, 'tooltip': makeTooltip( body=VEHICLE_CUSTOMIZATION.getSheetSeasonName(seasonName)) }) self.as_setSeasonsBarDataS(seasonRenderersList) self._seasonSoundAnimantion.setFilledSeasonSlots( filledSeasonSlots, forceAnim) return
def _packDescriptionBlock(self, isNonHistoric, isInfo): img = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_NON_HISTORICAL nonHistoricTitle = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMSPOPOVER_HISTORICCHECKBOX_ITEMS nonHistoricDesc = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_DESCRIPTION_HISTORIC_FALSE_DESCRIPTION seasonName = SEASON_TYPE_TO_NAME.get( self.service.getCtx().currentSeason) mapName = _ms(VEHICLE_CUSTOMIZATION.getMapName(seasonName)) title = _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMSPOPOVER_BTN) desc = _ms(VEHICLE_CUSTOMIZATION.SEASON_SELECTION_TOOLTIP, mapName=mapName) blocks = [] if not isInfo: blocks.append( formatters.packTextBlockData( text=text_styles.middleTitle(title))) blocks.append( formatters.packTextBlockData(text=text_styles.main(desc), padding={'top': 10})) if isNonHistoric: blocks.append( formatters.packImageTextBlockData( title=text_styles.middleTitle(nonHistoricTitle), img=img, imgPadding={ 'left': -3, 'top': -4 }, padding={'top': 20 if not isInfo else 0})) blocks.append( formatters.packTextBlockData( text=text_styles.main(nonHistoricDesc))) return formatters.packBuildUpBlockData(blocks, gap=-6, padding={'bottom': -5})
def __setSeasonData(self): seasonRenderersList = [] for season in SEASONS_ORDER: seasonName = SEASON_TYPE_TO_NAME.get(season) seasonRenderersList.append({'seasonName': VEHICLE_CUSTOMIZATION.getSeasonName(seasonName), 'seasonIconSmall': RES_ICONS.getSeasonIcon(seasonName)}) self.as_setSeasonPanelDataS({'seasonRenderersList': seasonRenderersList})
def changeSeason(self, seasonIdx): self._currentSeason = SEASON_IDX_TO_TYPE[seasonIdx] seasonName = SEASON_TYPE_TO_NAME.get(self._currentSeason) self.soundManager.playInstantSound(SOUNDS.SEASON_SELECT.format(seasonName)) self.refreshOutfit() self.refreshCarousel(rebuild=True) self.as_refreshAnchorPropertySheetS() self.__setAnchorsInitData(self._tabIndex, self._tabIndex in C11nTabs.REGIONS, True)
def _getData(self): seasonItemData = [] allUnique = set() if self._item: for season in SEASONS_ORDER: seasonName = SEASON_TYPE_TO_NAME.get(season) seasonUnique = set() outfit = self._item.getOutfit(season) items = [] for item in outfit.items(): if item.intCD not in seasonUnique: items.append({ 'image': item.icon, 'hasBonus': item.bonus is not None, 'isWide': item.isWide(), 'intCD': item.intCD }) allUnique.add(item.intCD) seasonUnique.add(item.intCD) seasonItemData.append({ 'season': text_styles.main( VEHICLE_CUSTOMIZATION.getSeasonName(seasonName)), 'itemRendererVOs': items }) itemText = _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_ITEMS) name = self._name desc = self._desc itemData = self._getItemData() if itemData is None: desc = text_styles.neutral( VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_EMPTYSTYLE_HINT) itemData = { 'intCD': 0, 'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK_POPOVER_SMALL } showProlongationCB = False autoProlongationCBLabel = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_AUTOPROLONGATIONLABEL if self._item is not None and self._item.isRentable: showProlongationCB = True return StyleDataVO(name, desc, self._isEmpty, itemData, seasonItemData, itemText, len(allUnique), showProlongationCB, autoProlongationCBLabel, g_currentVehicle.item.isAutoRentStyle).asDict()
def __makeStyleRendererVO(self): seasonItemData = [] allUnique = set() if self._currentStyle: smallRenderers = True for season in SEASONS_ORDER: seasonName = SEASON_TYPE_TO_NAME.get(season) seasonUnique = set() outfit = self._currentStyle.getOutfit(season) items = [] for item, component in outfit.itemsFull(): if item.intCD not in seasonUnique and not item.isHiddenInUI( ): items.append({ 'image': item.getIconApplied(component), 'specialArgs': item.getSpecialArgs(component), 'isWide': item.isWide(), 'intCD': item.intCD }) allUnique.add(item.intCD) seasonUnique.add(item.intCD) if len(items) > 1 and smallRenderers: smallRenderers = False titleText = VEHICLE_CUSTOMIZATION.getSheetSeasonName( seasonName) seasonItemData.append({ 'titleText': text_styles.standard(titleText), 'itemRendererVOs': items, 'rendererLnk': CUSTOMIZATION_ALIASES.CUSTOMIZATION_SHEET_STYLE_RENDERER_UI }) for item in seasonItemData: item['isSmall'] = smallRenderers return seasonItemData
def __makeSetOnOtherSeasonsRendererVO(self): activeSeason = SEASON_TYPE_TO_NAME.get(self.__ctx.currentSeason) actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_APPLYTOALLMAPS actionBtnIconSrc = '' if self._isItemAppliedToAll: actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_SEASONS actionBtnIconSrc = RES_ICONS.MAPS_ICONS_LIBRARY_ASSET_1 titleText = text_styles.neutral( VEHICLE_CUSTOMIZATION.PROPERTYSHEET_TITLE_ALLMAPS) extraPriceCurrency = '' extraPriceText = '' if self._extraMoney: extraPriceCurrency = self._extraMoney.getCurrency() if self._extraMoney.get(extraPriceCurrency): extraPriceText = '{}{}'.format( currency.getStyle(extraPriceCurrency)('+'), currency.applyAll( extraPriceCurrency, self._extraMoney.get(extraPriceCurrency))) else: titleText = text_styles.standard( _ms(VEHICLE_CUSTOMIZATION.PROPERTYSHEET_TITLE_APPLIEDTOMAP, mapType=text_styles.neutral( VEHICLE_CUSTOMIZATION.getSheetSeasonName( activeSeason)))) extraPriceText = '' extraPriceCurrency = '' return { 'titleText': titleText, 'iconSrc': RES_ICONS.getSeasonIcon(activeSeason), 'actionBtnLabel': actionBtnLabel, 'actionBtnIconSrc': actionBtnIconSrc, 'isAppliedToAll': self._isItemAppliedToAll, 'actionType': CUSTOMIZATION_ALIASES. CUSTOMIZATION_SHEET_ACTION_APPLY_TO_ALL_SEASONS, 'rendererLnk': CUSTOMIZATION_ALIASES.CUSTOMIZATION_SHEET_BTN_RENDERER_UI, 'extraPriceText': extraPriceText, 'extraPriceIcon': extraPriceCurrency }
def buildList(self): self.clear() for season in SEASONS_ORDER: items = [] seasonUnique = set() appliedStyle = self.__ctx.getStyleInfo().modified if appliedStyle: outfit = appliedStyle.getOutfit(season) for item in outfit.items(): if item.intCD not in seasonUnique and not item.isHiddenInUI( ): seasonUnique.add(item.intCD) items.append(item) if items: items.sort(key=lambda i: TYPES_ORDER.index(i.itemTypeID)) itemIcons = list(map(_makeItemIconVO, items)) seasonName = SEASON_TYPE_TO_NAME.get(season) seasonTitle = makeHtmlString( 'html_templates:lobby/customization/PopoverSeasonName', seasonName) self._list.append( _CustomizationPopoverKitRendererVO( seasonTitle, itemIcons)._asdict())
def __getTitleImage(self): if self._slotID == GUI_ITEM_TYPE.STYLE: return '' seasonName = SEASON_TYPE_TO_NAME.get(self.__ctx.currentSeason) return RES_ICONS.getSeasonTopImage(seasonName)
def __onSeasonChanged(self, seasonType): seasonName = SEASON_TYPE_TO_NAME.get(seasonType) self.soundManager.playInstantSound( SOUNDS.SEASON_SELECT.format(seasonName)) self.__setAnchorsInitData(True)