def __setTotalData(self, *_):
     cart = getTotalPurchaseInfo(self.__purchaseItems)
     totalPriceVO = getItemPricesVO(cart.totalPrice)
     state = g_currentVehicle.getViewState()
     inFormationAlert = ''
     if not state.isCustomizationEnabled():
         inFormationAlert = text_styles.concatStylesWithSpace(icons.markerBlocked(), text_styles.error(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_FORMATION_ALERT))
     price = cart.totalPrice.price
     money = self.itemsCache.items.stats.money
     exchangeRate = self.itemsCache.items.shop.exchangeRate
     shortage = money.getShortage(price)
     if not shortage:
         self.__moneyState = _MoneyForPurchase.ENOUGH
     else:
         money = money - price + shortage
         price = shortage
         money = money.exchange(Currency.GOLD, Currency.CREDITS, exchangeRate, default=0)
         shortage = money.getShortage(price)
         if not shortage:
             self.__moneyState = _MoneyForPurchase.ENOUGH_WITH_EXCHANGE
         else:
             self.__moneyState = _MoneyForPurchase.NOT_ENOUGH
     validTransaction = self.__moneyState != _MoneyForPurchase.NOT_ENOUGH or Currency.GOLD in shortage.getCurrency() and isIngameShopEnabled()
     self.as_setTotalDataS({'totalLabel': text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST, selected=cart.numSelected, total=cart.numApplying)),
      'enoughMoney': validTransaction,
      'inFormationAlert': inFormationAlert,
      'totalPrice': totalPriceVO[0]})
     self.__setBuyButtonState(validTransaction)
示例#2
0
 def __setTotalData(self, *_):
     cart = getTotalPurchaseInfo(self._purchaseItems)
     totalPriceVO = getItemPricesVO(cart.totalPrice)
     state = g_currentVehicle.getViewState()
     shortage = self.itemsCache.items.stats.money.getShortage(
         cart.totalPrice.price)
     inFormationAlert = ''
     if not state.isCustomizationEnabled():
         inFormationAlert = text_styles.concatStylesWithSpace(
             icons.markerBlocked(),
             text_styles.error(
                 VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_FORMATION_ALERT))
     self.as_setTotalDataS({
         'totalLabel':
         text_styles.highTitle(
             _ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST,
                 selected=cart.numSelected,
                 total=cart.numApplying)),
         'enoughMoney':
         getItemPricesVO(ItemPrice(shortage, shortage))[0],
         'inFormationAlert':
         inFormationAlert,
         'totalPrice':
         totalPriceVO[0]
     })
def isC11nEnabled(lobbyContext=None, hangarSpace=None):
    state = g_currentVehicle.getViewState()
    vehicleEntity = hangarSpace.getVehicleEntity()
    if vehicleEntity is None:
        isVehicleCameraReadyForC11n = False
    else:
        isVehicleCameraReadyForC11n = vehicleEntity.state == CameraMovementStates.ON_OBJECT
    return lobbyContext.getServerSettings().isCustomizationEnabled() and state.isCustomizationEnabled() and not state.isOnlyForEventBattles() and hangarSpace.spaceInited and hangarSpace.isModelLoaded and isVehicleCameraReadyForC11n
示例#4
0
 def __setTotalData(self, *args):
     if self.__controller.cart.processingMultiplePurchase:
         return
     priceGold = self.__controller.cart.totalPriceGold
     priceCredits = self.__controller.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = self.itemsCache.items.stats.gold >= priceGold
     enoughCredits = self.itemsCache.items.stats.credits >= priceCredits
     state = g_currentVehicle.getViewState()
     canBuy = bool(
         priceGold or priceCredits
     ) and enoughGold and enoughCredits and state.isCustomizationEnabled()
     if not enoughGold:
         diff = text_styles.gold(priceGold -
                                 self.itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(priceCredits -
                                    self.itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.credits())))
     inFormationAlert = text_styles.concatStylesWithSpace(
         icons.markerBlocked(),
         text_styles.error(
             VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_FORMATION_ALERT)
     ) if not state.isCustomizationEnabled() else ''
     self.as_setTotalDataS({
         'credits':
         formatPriceCredits(priceCredits),
         'gold':
         formatPriceGold(priceGold),
         'totalLabel':
         text_styles.highTitle(
             _ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST,
                 selected=len(self.__searchDP.selectedItems),
                 total=len(self.__searchDP.items))),
         'enoughGold':
         enoughGold,
         'enoughCredits':
         enoughCredits,
         'notEnoughGoldTooltip':
         notEnoughGoldTooltip,
         'notEnoughCreditsTooltip':
         notEnoughCreditsTooltip,
         'inFormationAlert':
         inFormationAlert
     })
     self.as_setBuyBtnEnabledS(canBuy)
示例#5
0
 def __updateState(self):
     state = g_currentVehicle.getViewState()
     self.as_setCrewEnabledS(state.isCrewOpsEnabled())
     self.__updateCarouselEnabled()
     if state.isOnlyForEventBattles():
         customizationTooltip = makeTooltip(_ms(TOOLTIPS.HANGAR_TUNING_DISABLEDFOREVENTVEHICLE_HEADER), _ms(TOOLTIPS.HANGAR_TUNING_DISABLEDFOREVENTVEHICLE_BODY))
     else:
         customizationTooltip = makeTooltip(_ms(TOOLTIPS.HANGAR_TUNING_HEADER), _ms(TOOLTIPS.HANGAR_TUNING_BODY))
     self.as_setupAmmunitionPanelS(state.isMaintenanceEnabled(), makeTooltip(_ms(TOOLTIPS.HANGAR_MAINTENANCE_HEADER), _ms(TOOLTIPS.HANGAR_MAINTENANCE_BODY)), state.isCustomizationEnabled(), customizationTooltip)
     self.as_setControlsVisibleS(state.isUIShown())
示例#6
0
 def __updateState(self):
     state = g_currentVehicle.getViewState()
     self.as_setCrewEnabledS(state.isCrewOpsEnabled())
     self.__updateCarouselEnabled()
     if state.isOnlyForEventBattles():
         customizationTooltip = makeTooltip(_ms(TOOLTIPS.HANGAR_TUNING_DISABLEDFOREVENTVEHICLE_HEADER), _ms(TOOLTIPS.HANGAR_TUNING_DISABLEDFOREVENTVEHICLE_BODY))
     else:
         customizationTooltip = makeTooltip(_ms(TOOLTIPS.HANGAR_TUNING_HEADER), _ms(TOOLTIPS.HANGAR_TUNING_BODY))
     self.as_setupAmmunitionPanelS(state.isMaintenanceEnabled(), makeTooltip(_ms(TOOLTIPS.HANGAR_MAINTENANCE_HEADER), _ms(TOOLTIPS.HANGAR_MAINTENANCE_BODY)), state.isCustomizationEnabled(), customizationTooltip)
     self.as_setControlsVisibleS(state.isUIShown())
 def __updateState(self):
     state = g_currentVehicle.getViewState()
     self.as_setCrewEnabledS(state.isCrewOpsEnabled())
     isC11nEnabled = self.lobbyContext.getServerSettings().isCustomizationEnabled() and state.isCustomizationEnabled() and not state.isOnlyForEventBattles() and self.__isSpaceReadyForC11n and self.__isVehicleReadyForC11n and self.__isVehicleCameraReadyForC11n
     if isC11nEnabled:
         customizationTooltip = makeTooltip(_ms(TOOLTIPS.HANGAR_TUNING_HEADER), _ms(TOOLTIPS.HANGAR_TUNING_BODY))
     else:
         customizationTooltip = makeTooltip(_ms(TOOLTIPS.HANGAR_TUNING_DISABLED_HEADER), _ms(TOOLTIPS.HANGAR_TUNING_DISABLED_BODY))
     self.as_setupAmmunitionPanelS(state.isMaintenanceEnabled(), TOOLTIPS.HANGAR_MAINTENANCE, isC11nEnabled, customizationTooltip)
     self.as_setControlsVisibleS(state.isUIShown())
示例#8
0
 def __updateState(self):
     state = g_currentVehicle.getViewState()
     self.as_setCrewEnabledS(state.isCrewOpsEnabled())
     self.__updateFestivityState()
     isBattleRoyaleMode = self.battleRoyaleController.isBattleRoyaleMode()
     isC11nEnabled = self.lobbyContext.getServerSettings().isCustomizationEnabled() and state.isCustomizationEnabled() and not state.isOnlyForEventBattles() and self.__isSpaceReadyForC11n and self.__isVehicleReadyForC11n and self.__isVehicleCameraReadyForC11n and not isBattleRoyaleMode
     if isC11nEnabled:
         customizationTooltip = makeTooltip(_ms(backport.text(R.strings.tooltips.hangar.tuning.header())), _ms(backport.text(R.strings.tooltips.hangar.tuning.body())))
     else:
         customizationTooltip = makeTooltip(_ms(backport.text(R.strings.tooltips.hangar.tuning.disabled.header())), _ms(backport.text(R.strings.tooltips.hangar.tuning.disabled.body())))
     changeNationVisibility = g_currentVehicle.isPresent() and g_currentVehicle.item.hasNationGroup
     isNationChangeAvailable = g_currentVehicle.isPresent() and g_currentVehicle.item.isNationChangeAvailable
     if changeNationVisibility:
         if isNationChangeAvailable:
             changeNationTooltipHeader = R.strings.tooltips.hangar.nationChange.header()
             changeNationTooltipBody = R.strings.tooltips.hangar.nationChange.body()
         else:
             changeNationTooltipHeader = R.strings.tooltips.hangar.nationChange.disabled.header()
             if g_currentVehicle.item.isBroken:
                 changeNationTooltipBody = R.strings.tooltips.hangar.nationChange.disabled.body.destroyed()
             elif g_currentVehicle.item.isInBattle:
                 changeNationTooltipBody = R.strings.tooltips.hangar.nationChange.disabled.body.inBattle()
             elif g_currentVehicle.item.isInUnit:
                 changeNationTooltipBody = R.strings.tooltips.hangar.nationChange.disabled.body.inSquad()
             else:
                 changeNationTooltipBody = ''
         if changeNationTooltipBody == '':
             changeNationTooltip = makeTooltip(_ms(backport.text(changeNationTooltipHeader)), '')
         else:
             changeNationTooltip = makeTooltip(_ms(backport.text(changeNationTooltipHeader)), _ms(backport.text(changeNationTooltipBody)))
     else:
         changeNationTooltip = ''
     changeNationIsNew = not AccountSettings.getSettings(NATION_CHANGE_VIEWED)
     isMaintenanceEnabled = state.isMaintenanceEnabled()
     isEquipmentEnabled = g_currentVehicle.isPresent() and not g_currentVehicle.isEquipmentLocked()
     if isMaintenanceEnabled and isEquipmentEnabled:
         maintenanceTooltip = TOOLTIPS.HANGAR_MAINTENANCE
     else:
         maintenanceTooltip = TOOLTIPS.HANGAR_MAINTENANCE_DISABLED
     self.as_setupAmmunitionPanelS({'maintenanceEnabled': isMaintenanceEnabled,
      'maintenanceTooltip': maintenanceTooltip,
      'customizationEnabled': isC11nEnabled,
      'customizationTooltip': customizationTooltip,
      'changeNationVisible': changeNationVisibility,
      'changeNationEnable': isNationChangeAvailable,
      'changeNationTooltip': changeNationTooltip,
      'changeNationIsNew': changeNationIsNew})
     self.as_setControlsVisibleS(state.isUIShown())
示例#9
0
 def __updateCarouselEnabled(self):
     state = g_currentVehicle.getViewState()
     self.as_setCarouselEnabledS(not state.isLocked())
示例#10
0
 def __updateCarouselEnabled(self):
     state = g_currentVehicle.getViewState()
     self.as_setCarouselEnabledS(not state.isLocked())
示例#11
0
def getCurrentVehicleViewState():
    return g_currentVehicle.getViewState()
示例#12
0
def getCurrentVehicleViewState():
    return g_currentVehicle.getViewState()