def __getTitleDescrTexts(self, currentElement): if self._slotID == GUI_ITEM_TYPE.STYLE: if not currentElement: titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_ALL else: titleText = currentElement.userName elif self._slotID == GUI_ITEM_TYPE.MODIFICATION: titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_ALL elif self._slotID == GUI_ITEM_TYPE.INSCRIPTION: titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_INSCRIPTION elif self._slotID == GUI_ITEM_TYPE.EMBLEM: titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_EMBLEM else: titleText = VEHICLE_CUSTOMIZATION.getSheetVehPartName( getCustomizationTankPartName(self._areaID, self._regionID)) if not currentElement: itemTypeID = TABS_ITEM_MAPPING.get(self.__ctx.currentTab) itemTypeName = GUI_ITEM_TYPE_NAMES[itemTypeID] descrText = text_styles.neutral( VEHICLE_CUSTOMIZATION.getSheetEmptyDescription(itemTypeName)) elif self._slotID == GUI_ITEM_TYPE.STYLE: descrText = text_styles.main(currentElement.userType) elif self._slotID == GUI_ITEM_TYPE.CAMOUFLAGE: descrText = text_styles.main(currentElement.userName) else: descrText = text_styles.main( _ms(VEHICLE_CUSTOMIZATION.PROPERTYSHEET_DESCRIPTION, itemType=currentElement.userType, itemName=currentElement.userName)) return (text_styles.highTitle(titleText), descrText)
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 __onSysMsgReceived(self, _, message): if message.type == _TOKEN_SYS_MSG_TYPE: if 'completedQuestIDs' in message.data: completedQuestIDs = message.data['completedQuestIDs'] collectionRewardsSet = set(self.__nyCtrl.collectionRewardsBySettingID) passedCollectionRewards = completedQuestIDs.intersection(collectionRewardsSet) if passedCollectionRewards: _ms = i18n.makeString for reward in passedCollectionRewards: settingName = NATIONAL_SETTINGS[self.__nyCtrl.collectionRewardsBySettingID.index(reward)] self.__nyCtrl.proto.serviceChannel.pushClientMessage('', SCH_CLIENT_MSG_TYPE.NY_SETTING_COLLECTED, auxData=makeHtmlString('html_templates:newYear/sysMsgs', 'settingCollectedBody', {'setting': _ms(NY.system_messages_setting_name(settingName)), 'styles': _ms(VEHICLE_CUSTOMIZATION.getStyleName(settingName)), 'titles': _ms(NY.system_messages_setting_collected_titles(settingName)), 'emblem': _ms(NY.system_messages_setting_collected_emblem(settingName))}))
def __makeRemoveRendererVO(self, separatorVisible=True): iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_CROSS if self._slotID == GUI_ITEM_TYPE.STYLE: titleText = '' iconSrc = '' actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVESTYLE else: itemTypeID = TABS_ITEM_MAPPING.get(self.__ctx.currentTab) itemTypeName = GUI_ITEM_TYPE_NAMES[itemTypeID] titleText = VEHICLE_CUSTOMIZATION.getSheetRemoveText(itemTypeName) if self._slotID == GUI_ITEM_TYPE.MODIFICATION: actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_TANK elif self._slotID == GUI_ITEM_TYPE.EMBLEM: actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_EMBLEM elif self._slotID == GUI_ITEM_TYPE.INSCRIPTION: actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_INSCRIPTION else: actionBtnLabel = VEHICLE_CUSTOMIZATION.getSheetBtnRemoveText( getCustomizationTankPartName(self._areaID, self._regionID)) return { 'titleText': text_styles.standard(titleText), 'iconSrc': iconSrc, 'actionBtnLabel': actionBtnLabel, 'actionBtnIconSrc': RES_ICONS.MAPS_ICONS_LIBRARY_ASSET_1, 'isAppliedToAll': False, 'separatorVisible': separatorVisible, 'rendererLnk': CUSTOMIZATION_ALIASES.CUSTOMIZATION_SHEET_BTN_RENDERER_UI, 'actionType': CUSTOMIZATION_ALIASES.CUSTOMIZATION_SHEET_ACTION_REMOVE_ONE }
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 __makeRemoveRendererVO(self): iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_CROSS hoverIcon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_CROSS_HOVER if self._slotID == GUI_ITEM_TYPE.STYLE: actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVESTYLE iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_STYLE_X hoverIcon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_STYLE_X_HOVER else: if self._slotID == GUI_ITEM_TYPE.MODIFICATION: actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_TANK iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_EFFECTS_X hoverIcon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_EFFECTS_X_HOVER elif self._slotID == GUI_ITEM_TYPE.EMBLEM: actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_EMBLEM iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_EMBLEM_X hoverIcon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_EMBLEM_X_HOVER elif self._slotID == GUI_ITEM_TYPE.INSCRIPTION: actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_INSCRIPTION iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_TYPE_X hoverIcon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_TYPE_X_HOVER elif self._slotID == GUI_ITEM_TYPE.PROJECTION_DECAL: actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_REMOVE_PROJECTIONDECAL iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_EFFECTS_X hoverIcon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_EFFECTS_X_HOVER else: actionBtnLabel = VEHICLE_CUSTOMIZATION.getSheetBtnRemoveText( getCustomizationTankPartName(self._areaID, self._regionID)) if self._slotID == GUI_ITEM_TYPE.CAMOUFLAGE: iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_CAMO_X hoverIcon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_CAMO_X_HOVER elif self._slotID == GUI_ITEM_TYPE.PAINT: iconSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_COLORS_X hoverIcon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_REMOVE_COLORS_X_HOVER return { 'iconSrc': iconSrc, 'iconHoverSrc': hoverIcon, 'actionBtnLabel': text_styles.tutorial(actionBtnLabel), 'rendererLnk': CUSTOMIZATION_ALIASES.CUSTOMIZATION_SHEET_BTN_RENDERER_UI, 'actionType': CUSTOMIZATION_ALIASES.CUSTOMIZATION_SHEET_ACTION_REMOVE_ONE }
def __updatePopoverBtnIcon(self): if self.__ctx.modeId == CustomizationModes.STYLED: imgSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_ITEMS_POPOVER_DEFAULT_LIST30X16 else: imgSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_ITEMS_POPOVER_DESERT_LIST30X16 if self.__ctx.season == SeasonType.WINTER: imgSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_ITEMS_POPOVER_WINTER_LIST30X16 elif self.__ctx.season == SeasonType.SUMMER: imgSrc = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_ITEMS_POPOVER_SUMMER_LIST30X16 if self.__ctx.modeId == CustomizationModes.STYLED: tooltip = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMSPOPOVER_BTN_STYLE_DISABLED else: seasonName = SEASON_TYPE_TO_NAME.get(self.__ctx.season) mapName = VEHICLE_CUSTOMIZATION.getMapName(seasonName) tooltip = _ms( VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMSPOPOVER_BTN_DISABLED, mapType=_ms(mapName)) self.as_showPopoverBtnIconS(imgSrc, tooltip)
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 __makeSetOnOtherTankPartsRendererVO(self): if not self._isItemAppliedToAll: currPartName = VEHICLE_CUSTOMIZATION.getSheetVehPartName( getCustomizationTankPartName(self._areaID, self._regionID)) titleText = text_styles.standard( _ms(VEHICLE_CUSTOMIZATION.PROPERTYSHEET_TITLE_APPLIEDTO, elementType=text_styles.neutral(currPartName))) actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_APPLYTOWHOLETANK actionBtnIconSrc = '' extraPriceText = '' extraPriceCurrency = '' else: titleText = text_styles.neutral( VEHICLE_CUSTOMIZATION.PROPERTYSHEET_TITLE_ALLTANKPAINTED) actionBtnLabel = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ACTIONBTN_CANCEL actionBtnIconSrc = RES_ICONS.MAPS_ICONS_LIBRARY_ASSET_1 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))) return { 'titleText': titleText, 'iconSrc': RES_ICONS.MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_TANK, 'actionBtnLabel': actionBtnLabel, 'actionBtnIconSrc': actionBtnIconSrc, 'isAppliedToAll': self._isItemAppliedToAll, 'actionType': CUSTOMIZATION_ALIASES. CUSTOMIZATION_SHEET_ACTION_APPLY_TO_ALL_PARTS, 'rendererLnk': CUSTOMIZATION_ALIASES.CUSTOMIZATION_SHEET_BTN_RENDERER_UI, 'extraPriceText': extraPriceText, 'extraPriceIcon': extraPriceCurrency }
def _buildBlocks(self, setting): collection = _ms( NY. collections_tooltip_progressbar_awards_writings_descr_collection( setting)) styleTitle = _ms(NY.COLLECTIONS_TOOLTIP_PROGRESSBAR_AWARDS_STYLE_TITLE, style=_ms( VEHICLE_CUSTOMIZATION.getStyleName(setting))) headerBlock = [ formatters.packTextBlockData( text_styles.highTitle( NY.COLLECTIONS_TOOLTIP_PROGRESSBAR_HEADER_TITLE), useHtml=True, padding=formatters.packPadding(bottom=5)), self.__makeAwardBlock( RES_ICONS.MAPS_ICONS_NY_REWARDS_NY_STYLE, styleTitle, _ms(NY.COLLECTIONS_TOOLTIP_PROGRESSBAR_AWARDS_STYLE_DESCRIPTION ), setting), self.__makeAwardBlock( RES_ICONS.MAPS_ICONS_NY_REWARDS_INSCRIPTIONS, NY.collections_tooltip_progressbar_awards_writings_title, _ms(NY.COLLECTIONS_TOOLTIP_PROGRESSBAR_AWARDS_WRITINGS_DESCR, collection=collection), setting), self.__makeAwardBlock( RES_ICONS.MAPS_ICONS_NY_REWARDS_EMBLEM, NY.collections_tooltip_progressbar_awards_emblems_title, _ms(NY.COLLECTIONS_TOOLTIP_PROGRESSBAR_AWARDS_EMBLEMS_DESCR, collection=collection), setting) ] return [ formatters.packBuildUpBlockData( headerBlock, padding=formatters.packPadding(left=5)), formatters.packBuildUpBlockData( _makeNationBlock(NY.COLLECTIONS_TOOLTIP_NATIONS_HEADER, setting), linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(left=5)) ]
def shortUserName(self): """ Returns bonus's short name represented as user-readable string. """ return i18n.makeString( VEHICLE_CUSTOMIZATION.getShortBonusName('camouflage'))
def shortUserName(self): return i18n.makeString( VEHICLE_CUSTOMIZATION.getShortBonusName('camouflage'))