def _packBlocks(self, *args, **kwargs): items = super(NotRecruitedTooltipData, self)._packBlocks() item = self.context.buildItem(*args) self.item = item blocks = list() blocks.append( formatters.packImageTextBlockData( title=text_styles.highTitle(item.getFullUserName()), desc=text_styles.main(item.getLabel()))) blocks.append( formatters.packImageBlockData( img=item.getBigIcon(), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)) blocks.append(formatters.packSeparatorBlockData()) blocks.append( formatters.packTextBlockData( text_styles.main(item.getDescription()), useHtml=True, padding=formatters.packPadding(top=20, bottom=7))) if item.getLearntSkills(): blocks.append( formatters.packTextBlockData(text_styles.middleTitle( TOOLTIPS.NOTRECRUITEDTANKMAN_SKILLSTITLE), useHtml=True, padding=formatters.packPadding( top=10, bottom=10))) skills = item.getLearntSkills() blocks.append( formatters.packImageListParameterBlockData( listIconSrc=[ Tankman.getSkillIconPath(skillName=skillName, size='big') for skillName in skills ], columnWidth=52, rowHeight=52, verticalGap=10, horizontalGap=10, padding=formatters.packPadding(bottom=10))) expiryTime = item.getExpiryTime() if expiryTime: blocks.append( formatters.packTextBlockData(text_styles.middleTitle( TOOLTIPS.NOTRECRUITEDTANKMAN_EXPIRETITLE), useHtml=True, padding=formatters.packPadding( top=10, bottom=2))) expireDateStr = makeString(TOOLTIPS.NOTRECRUITEDTANKMAN_USEBEFORE, date=expiryTime) blocks.append( formatters.packTextParameterWithIconBlockData( name=text_styles.premiumVehicleName(expireDateStr), value='', icon=ICON_TEXT_FRAMES.RENTALS, padding=formatters.packPadding(left=-60, bottom=-18), iconYOffset=3)) items.append( formatters.packBuildUpBlockData( blocks, padding=formatters.packPadding(bottom=-10))) return items
def _buildVehicle(self, vehicle): result = super(RoyaleCarouselDataProvider, self)._buildVehicle(vehicle) state, _ = vehicle.getState() if vehicle.isOnlyForBattleRoyaleBattles: result.update({ 'label': text_styles.premiumVehicleName(vehicle.userName), 'tooltip': TOOLTIPS_CONSTANTS.BATTLE_ROYALE_VEHICLE, 'level': 0, 'tankType': _UNDEFINED_VEHICLE_TYPE, 'xpImgSource': '', 'isUseRightBtn': False }) iconId = getIconResourceName(vehicle.name) iconResId = R.images.gui.maps.icons.battleRoyale.hangar.vehicles.dyn( iconId) if iconResId.exists(): result['icon'] = backport.image(iconResId()) smallIconResId = R.images.gui.maps.icons.battleRoyale.hangar.vehicles.small.dyn( iconId) if smallIconResId.exists(): result['iconSmall'] = backport.image(smallIconResId()) elif state == Vehicle.VEHICLE_STATE.UNSUITABLE_TO_QUEUE: result['lockedTooltip'] = makeTooltip( backport.text(R.strings.battle_royale.battleRoyaleCarousel. lockedToolTip.header()), backport.text(R.strings.battle_royale.battleRoyaleCarousel. lockedToolTip.body())) result['clickEnabled'] = True return result
def _packBlocks(self, invID, isLocked): items = super(NotRecruitedTooltipData, self)._packBlocks() item = self.context.buildItem(invID) self.item = item blocks = list() blocks.append(formatters.packImageTextBlockData(title=text_styles.highTitle(item.getFullUserName()), desc=text_styles.main(item.getLabel()))) specialIcon = item.getSpecialIcon() blocks.append(formatters.packImageBlockData(img=specialIcon if specialIcon is not None else item.getBigIcon(), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, width=350 if specialIcon is not None else -1, height=238 if specialIcon is not None else -1)) blocks.append(formatters.packSeparatorBlockData(paddings=formatters.packPadding(top=-40))) descrStr = i18n.makeString(item.getDescription()) hasDescr = descrStr != EMPTY_STRING if hasDescr: blocks.append(formatters.packTextBlockData(text_styles.main(descrStr), useHtml=True, padding=formatters.packPadding(top=18))) howToGetStr = i18n.makeString(item.getHowToGetInfo()) hasHowToGetStr = howToGetStr != EMPTY_STRING if hasHowToGetStr: blocks.append(formatters.packTextBlockData(text_styles.middleTitle(backport.text(R.strings.tooltips.notrecruitedtankman.howToGet())), useHtml=True, padding=formatters.packPadding(top=17 if hasDescr else 18, bottom=5))) blocks.append(formatters.packTextBlockData(text_styles.main(howToGetStr), useHtml=True, padding=formatters.packPadding())) skills = item.getLearntSkills(multiplyNew=True) if skills: tankmanSkill = item.getTankmanSkill() blocks.append(formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.NOTRECRUITEDTANKMAN_SKILLSTITLE), useHtml=True, padding=formatters.packPadding(top=17 if hasDescr else 18, bottom=10))) blocks.append(formatters.packImageListParameterBlockData(listIconSrc=[ formatters.packImageListIconData(tankmanSkill(skillName=skillName).bigIconPath) for skillName in skills ], columnWidth=52, rowHeight=52, verticalGap=10, horizontalGap=10)) expiryTime = item.getExpiryTime() if expiryTime: blocks.append(formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.NOTRECRUITEDTANKMAN_EXPIRETITLE), useHtml=True, padding=formatters.packPadding(top=20 if skills else (17 if hasDescr else 16), bottom=2))) expireDateStr = makeString(TOOLTIPS.NOTRECRUITEDTANKMAN_USEBEFORE, date=expiryTime) blocks.append(formatters.packTextParameterWithIconBlockData(name=text_styles.premiumVehicleName(expireDateStr), value='', icon=ICON_TEXT_FRAMES.RENTALS, padding=formatters.packPadding(left=-60, bottom=-18), iconYOffset=3)) if isLocked: alertStr = item.getAdditionalAlert() if alertStr: blocks.append(formatters.packTextBlockData(text_styles.alertBig(alertStr), padding=formatters.packPadding(top=20))) items.append(formatters.packBuildUpBlockData(blocks, padding=formatters.packPadding(bottom=-5))) return items
def _packBlocks(self, *args, **kwargs): items = super(RentVehicleAwardTooltipData, self)._packBlocks() blocks = list() blocks.append(formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.QUESTS_AWARDS_VEHICLERENT_HEADER), padding=formatters.packPadding(top=8))) blocks.append(formatters.packTextParameterWithIconBlockData(name=text_styles.premiumVehicleName(TOOLTIPS.QUESTS_AWARDS_VEHICLERENT_EXPIRE), value='', icon=ICON_TEXT_FRAMES.RENTALS, padding=formatters.packPadding(left=-60), iconYOffset=3)) items.append(formatters.packBuildUpBlockData(blocks, padding=formatters.packPadding(bottom=-19))) blocks = list() vehiclesCount = 0 for rentVehicleData in args: rentVehicleData = flashObject2Dict(rentVehicleData) vehicleName = rentVehicleData.get('vehicleName', '') vehicleType = rentVehicleData.get('vehicleType', '') isPremiumVehicle = rentVehicleData.get('isPremium', True) rentLeftCount = 0 rentTypeName = None for rentType in _RENT_TYPES: rentTypeValue = rentVehicleData.get(rentType, 0) if rentTypeValue > 0: rentTypeName = rentType rentLeftCount = rentTypeValue break if isPremiumVehicle: imgPaddings = formatters.packPadding(right=2) else: imgPaddings = formatters.packPadding(left=5, right=5, top=4) blocks.append(formatters.packImageTextBlockData(title=text_styles.highlightText(vehicleName), img=getTypeSmallIconPath(vehicleType, isPremiumVehicle), imgPadding=imgPaddings, txtPadding=formatters.packPadding(left=2))) if rentTypeName is not None and rentLeftCount > 0: rentCountStr = text_styles.premiumVehicleName(rentLeftCount) rentLeftStr = _ms(TOOLTIPS.getRentLeftTypeLabel(rentTypeName), count=rentCountStr) blocks.append(formatters.packTextBlockData(text_styles.main(rentLeftStr), padding=formatters.packPadding(left=28, top=-8, bottom=5))) vehiclesCount += 1 if vehiclesCount >= _MAX_AWARDS_PER_TOOLTIP: count = len(args) - vehiclesCount if count > 0: blocks.append(formatters.packTextBlockData(text_styles.main(backport.text(R.strings.tooltips.quests.awards.additional.bottom(), count=count)))) break items.append(formatters.packBuildUpBlockData(blocks, padding=formatters.packPadding(bottom=-12))) return items