コード例 #1
0
 def _buildVehicle(self, vehicle):
     result = super(RankedCarouselDataProvider, self)._buildVehicle(vehicle)
     result[
         'hasRankedBonus'] = self.__rankedController.hasVehicleRankedBonus(
             vehicle.intCD)
     state, _ = vehicle.getState()
     suitResult = self.__rankedController.isSuitableVehicle(vehicle)
     if suitResult is not None:
         header, body = ('', '')
         resShortCut = R.strings.ranked_battles.rankedBattlesCarousel.lockedTooltip
         if suitResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL:
             levelStr = toRomanRangeString(suitResult.ctx['levels'])
             levelSubStr = backport.text(resShortCut.vehLvl.levelSubStr(),
                                         levels=levelStr)
             header = backport.text(resShortCut.vehLvl.header())
             body = backport.text(resShortCut.vehLvl.body(),
                                  levelSubStr=levelSubStr)
         elif suitResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_TYPE:
             typeSubStr = text_styles.neutral(
                 suitResult.ctx['forbiddenType'])
             header = backport.text(resShortCut.vehType.header())
             body = backport.text(resShortCut.vehType.body(),
                                  forbiddenType=typeSubStr)
         elif suitResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_CLASS:
             classSubStr = text_styles.neutral(
                 getTypeUserName(suitResult.ctx['forbiddenClass'], False))
             header = backport.text(resShortCut.vehClass.header())
             body = backport.text(resShortCut.vehClass.body(),
                                  forbiddenClass=classSubStr)
         if state == Vehicle.VEHICLE_STATE.UNSUITABLE_TO_QUEUE:
             result['lockedTooltip'] = makeTooltip(header, body)
         result['clickEnabled'] = True
         result['hasRankedBonus'] = False
     return result
コード例 #2
0
 def _initialize(self, *args, **kwargs):
     super(BuyVehicleView, self)._initialize()
     self._blur = GUI.WGUIBackgroundBlur()
     self._blur.enable = True
     self.__addListeners()
     isElite = self.__vehicle.isElite
     vehType = self.__vehicle.type.replace('-', '_')
     isRestoreAvailable = self.__vehicle.isRestoreAvailable()
     with self.viewModel.transaction() as model:
         model.setTankType(
             '{}_elite'.format(vehType) if isElite else vehType)
         vehicleTooltip = i18n.makeString(
             getTypeUserName(self.__vehicle.type, isElite))
         noCrewLabelPath = R.strings.store.buyVehicleWindow.checkBox
         model.setVehicleNameTooltip(vehicleTooltip)
         model.setNation(nations.NAMES[self.__vehicle.nationID])
         model.setNoCrewCheckboxLabel(
             noCrewLabelPath.restore.withoutCrew
             if isRestoreAvailable else noCrewLabelPath.buy.withoutCrew)
         model.setTankLvl(int2roman(self.__vehicle.level))
         model.setTankName(self.__vehicle.shortUserName)
         model.setCountCrew(len(self.__vehicle.crew))
         model.setBuyVehicleIntCD(self.__vehicle.intCD)
         model.setIsToggleBtnVisible(self.__isTradeIn()
                                     and self.__vehicle.hasRentPackages)
         model.setIsElite(isElite)
         model.setIsRentVisible(self.__isRentVisible)
         model.setIsInBootcamp(self.__isBootcampBuyVehicle())
         model.setIsMovingTextEnabled(constants.IS_CHINA
                                      and GUI_SETTINGS.movingText.show)
         if self.__vehicle.hasCrew:
             model.setWithoutCommanderAltText(
                 R.strings.store.buyVehicleWindow.crewInVehicle)
         equipmentBlock = model.equipmentBlock
         equipmentBlock.setIsRentVisible(self.__isRentVisible)
         equipmentBlock.setTradeInIsEnabled(self.__isTradeIn())
         emtySlotAvailable = self.itemsCache.items.inventory.getFreeSlots(
             self.__stats.vehicleSlots) > 0
         equipmentBlock.setEmtySlotAvailable(emtySlotAvailable)
         equipmentBlock.setIsRestore(isRestoreAvailable)
         if self.__vehicle.hasRentPackages and not isRestoreAvailable:
             self.__selectedRentIdx = 0
             self.__selectedRentTerm = self.__vehicle.rentPackages[
                 self.__selectedRentIdx]['days']
         tankPriceArray = model.tankPrice.getItems()
         self.__addVMsInActionPriceList(tankPriceArray,
                                        self.__vehicle.buyPrices.itemPrice)
         self.__updateTankPrice()
         self.__updateCommanderCards()
         self.__updateSlotPrice()
         self.__updateAmmoPrice()
         self.__updateTradeInInfo()
         self.__updateRentInfo()
         self.__updateBuyBtnLabel()
         totalPriceArray = equipmentBlock.totalPrice.getItems()
         self.__addVMsInActionPriceList(
             totalPriceArray,
             ItemPrice(price=Money(credits=0, gold=0),
                       defPrice=Money(credits=0, gold=0)))
         self.__updateTotalPrice()
コード例 #3
0
 def _buildVehicle(self, vehicle):
     result = super(MapboxCarouselDataProvider, self)._buildVehicle(vehicle)
     state, _ = vehicle.getState()
     if state == Vehicle.VEHICLE_STATE.UNSUITABLE_TO_QUEUE:
         validationResult = MapboxVehicleValidator.validateForMapbox(
             vehicle)
         if validationResult is not None:
             header, body = ('', '')
             resPath = R.strings.mapbox.mapboxCarousel.lockedTooltip
             if validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL:
                 levelStr = toRomanRangeString(
                     validationResult.ctx['levels'])
                 levelSubStr = backport.text(resPath.vehLvl.levelSubStr(),
                                             levels=levelStr)
                 header = backport.text(resPath.vehLvl.header())
                 body = backport.text(resPath.vehLvl.body(),
                                      levelSubStr=levelSubStr)
             elif validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_TYPE:
                 typeSubStr = text_styles.neutral(
                     validationResult.ctx['forbiddenType'])
                 header = backport.text(resPath.vehType.header())
                 body = backport.text(resPath.vehType.body(),
                                      forbiddenType=typeSubStr)
             elif validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_CLASS:
                 classSubStr = text_styles.neutral(
                     getTypeUserName(validationResult.ctx['forbiddenClass'],
                                     False))
                 header = backport.text(resPath.vehClass.header())
                 body = backport.text(resPath.vehClass.body(),
                                      forbiddenClass=classSubStr)
             result['lockedTooltip'] = makeTooltip(header, body)
     return result
コード例 #4
0
 def _initialize(self, *args, **kwargs):
     super(BuyVehicleView, self)._initialize()
     self._blur = CachedBlur(enabled=True)
     self.__addListeners()
     isElite = self.__vehicle.isElite
     vehType = self.__vehicle.type.replace('-', '_')
     isRestore = self.__vehicle.isRestoreAvailable()
     if self.__showOnlyCongrats:
         self.viewModel.setIsContentHidden(True)
     with self.viewModel.transaction() as vm:
         vm.setIsRestore(isRestore)
         vm.setBgSource(
             R.images.gui.maps.icons.store.shop_2_background_arsenal())
         vm.setTankType('{}_elite'.format(vehType) if isElite else vehType)
         vehicleTooltip = i18n.makeString(
             getTypeUserName(self.__vehicle.type, isElite))
         noCrewLabelPath = R.strings.store.buyVehicleWindow.checkBox
         vm.setVehicleNameTooltip(vehicleTooltip)
         vm.setNation(nations.NAMES[self.__vehicle.nationID])
         vm.setNoCrewCheckboxLabel(noCrewLabelPath.restore.withoutCrew(
         ) if isRestore else noCrewLabelPath.buy.withoutCrew())
         vm.setTankLvl(int2roman(self.__vehicle.level))
         vm.setTankName(self.__vehicle.shortUserName)
         vm.setCountCrew(len(self.__vehicle.crew))
         vm.setBuyVehicleIntCD(self.__vehicle.intCD)
         vm.setIsElite(isElite)
         if self.__vehicle.hasCrew:
             vm.setWithoutCommanderAltText(
                 R.strings.store.buyVehicleWindow.crewInVehicle())
         equipmentBlock = vm.equipmentBlock
         equipmentBlock.setIsRentVisible(self.__isRentVisible)
         equipmentBlock.setTradeInIsEnabled(self.__isTradeIn())
         emtySlotAvailable = self.__itemsCache.items.inventory.getFreeSlots(
             self.__stats.vehicleSlots) > 0
         equipmentBlock.setEmtySlotAvailable(emtySlotAvailable)
         equipmentBlock.setIsRestore(isRestore)
         if self.__vehicle.hasRentPackages and (
                 not isRestore
                 or self.__actionType == VehicleBuyActionTypes.RENT
         ) and self.__actionType != VehicleBuyActionTypes.BUY:
             self.__selectedRentIdx = 0
             self.__selectedRentID = self.__vehicle.rentPackages[
                 self.__selectedRentIdx]['rentID']
         self.__updateCommanderCards()
         self.__updateSlotPrice()
         self.__updateAmmoPrice()
         self.__updateTradeInInfo()
         self.__updateRentInfo()
         self.__updateBuyBtnLabel()
         totalPriceArray = equipmentBlock.totalPrice.getItems()
         self.__addVMsInActionPriceList(
             totalPriceArray,
             ItemPrice(price=Money(credits=0, gold=0),
                       defPrice=Money(credits=0, gold=0)))
         self.__updateTotalPrice()
コード例 #5
0
def getUnsuitable2queueTooltip(validationResult, resPath):
    header, body = ('', '')
    if validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL:
        levelStr = toRomanRangeString(validationResult.ctx['levels'])
        levelSubStr = backport.text(resPath.vehLvl.levelSubStr(),
                                    levels=levelStr)
        header = backport.text(resPath.vehLvl.header())
        body = backport.text(resPath.vehLvl.body(), levelSubStr=levelSubStr)
    elif validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_TYPE:
        typeSubStr = text_styles.neutral(validationResult.ctx['forbiddenType'])
        header = backport.text(resPath.vehType.header())
        body = backport.text(resPath.vehType.body(), forbiddenType=typeSubStr)
    elif validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_CLASS:
        classSubStr = text_styles.neutral(
            getTypeUserName(validationResult.ctx['forbiddenClass'], False))
        header = backport.text(resPath.vehClass.header())
        body = backport.text(resPath.vehClass.body(),
                             forbiddenClass=classSubStr)
    return makeTooltip(header, body)
コード例 #6
0
def getVehicleName(vehicle):
    return ' '.join(
        (getTypeUserName(vehicle.type, False),
         text_styles.neutral(int2roman(vehicle.level)), vehicle.shortUserName))
コード例 #7
0
 def getOfferName(self):
     return ' '.join([
         getTypeUserName(self.displayedItem.type, False),
         tagText(int2roman(self.displayedItem.level), 'neutral'),
         self.displayedItem.shortUserName
     ])