本文整理汇总了Python中gui.Scaleform.daapi.view.lobby.customization.CustomizationHelper.getTimeLeftText方法的典型用法代码示例。如果您正苦于以下问题:Python CustomizationHelper.getTimeLeftText方法的具体用法?Python CustomizationHelper.getTimeLeftText怎么用?Python CustomizationHelper.getTimeLeftText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.Scaleform.daapi.view.lobby.customization.CustomizationHelper
的用法示例。
在下文中一共展示了CustomizationHelper.getTimeLeftText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _constructCamouflage
# 需要导入模块: from gui.Scaleform.daapi.view.lobby.customization import CustomizationHelper [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.customization.CustomizationHelper import getTimeLeftText [as 别名]
def _constructCamouflage(self, cID, groups, camouflages, armorColor, lifeCycle = None, isCurrent = False, isInHangar = False, withoutCheck = True, currVehIntD = None):
camouflageInfo = None
camouflage = camouflages.get(cID, None)
hiddenCamos = g_itemsCache.items.shop.getCamouflagesHiddens(self.nationID)
if camouflage is not None and (withoutCheck or cID not in hiddenCamos or isInHangar or camouflage.get('igrType', 0) != constants.IGR_TYPE.NONE and cID not in hiddenCamos):
denyCD = camouflage.get('deny')
allowCD = camouflage.get('allow')
if currVehIntD not in denyCD and (len(allowCD) == 0 or currVehIntD in allowCD) or currVehIntD is None:
invisibilityFactor = camouflage.get('invisibilityFactor', 1)
invisibilityPercent = int(round((invisibilityFactor - 1) * 100))
invisibilityLbl = gui.makeHtmlString('html_templates:lobby/customization', 'camouflage-hint', {'percents': invisibilityPercent}, sourceKey=self.__getKindById(camouflage.get('kind', 0)))
price = self._makeCost(self._cost, self._vehPriceFactor, self._getPriceFactor(cID)) if not isInHangar else 0
defaultPrice = self._makeCost(self._defCost, self._defVehPriceFactor, self._getDefaultCamoPriceFactor(cID)) if not isInHangar else 0
action = None
if price != defaultPrice:
isPremium = self._isGold == 1
newPrice = (0, price) if isPremium else (price, 0)
oldPrice = (0, defaultPrice) if isPremium else (defaultPrice, 0)
state = (None, ACTION_TOOLTIPS_STATE.DISCOUNT) if isPremium else (ACTION_TOOLTIPS_STATE.DISCOUNT, None)
key = 'camouflagePacket7Cost'
if self._period == 0:
key = 'camouflagePacketInfCost'
elif self._period == 30:
key = 'camouflagePacket30Cost'
action = {'type': ACTION_TOOLTIPS_TYPE.CAMOUFLAGE,
'key': cPickle.dumps((currVehIntD, key)),
'isBuying': True,
'state': state,
'newPrice': newPrice,
'oldPrice': oldPrice}
timeLeftStr = ''
days = 0
isPermanent = False
value = 0
timeLeft = 0 if self._isGold else self._period * 86400
if isInHangar:
item = CustomizationHelper.getItemFromHangar(CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE_TYPE, cID, self.nationID)
if item:
isPermanent = item.get('isPermanent')
value = item.get('quantity')
timeLeft = value * 86400 if not item.get('isPermanent') else 0
timeLeftStr = CustomizationHelper.getTimeLeftText(timeLeft)
if isCurrent:
updatedDescr = CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor)
item = updatedDescr.camouflages[camouflage.get('kind', 0)]
_, startTime, days = item
if days:
timeLeft = startTime + days * 86400 - time.time()
timeLeftStr = CustomizationHelper.getTimeLeftText(timeLeft)
camouflageInfo = {'id': cID,
'texturePath': self._makeSmallTextureUrl(camouflage.get('texture'), camouflage.get('colors', (0, 0, 0, 0)), armorColor, lifeCycle),
'description': self._makeDescription(groups, camouflage.get('groupName', ''), camouflage.get('description', '')),
'price': {'cost': price,
'isGold': self._isGold == 1},
'action': action,
'isNew': self.isNewID(cID),
'invisibilityLbl': invisibilityLbl,
'igrType': camouflage.get('igrType', 0),
'current': isCurrent,
'isInHangar': isInHangar,
'timeLeftStr': timeLeftStr,
'type': CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE,
'nationId': self.nationID,
'isSpecialTooltip': True,
'timeLeftValue': timeLeft,
'isPermanent': isPermanent,
'value': value}
return camouflageInfo
示例2: _constructInscription
# 需要导入模块: from gui.Scaleform.daapi.view.lobby.customization import CustomizationHelper [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.customization.CustomizationHelper import getTimeLeftText [as 别名]
def _constructInscription(self, itemID, groups, inscriptions, isCurrent = False, isInHangar = False, withoutCheck = True):
itemInfo = None
inscription = inscriptions.get(itemID, None)
priceFactors = g_itemsCache.items.shop.getInscriptionsGroupPriceFactors(self.nationID)
defPriceFactors = g_itemsCache.items.shop.defaults.getInscriptionsGroupPriceFactors(self.nationID)
hiddens = g_itemsCache.items.shop.getInscriptionsGroupHiddens(self.nationID)
if inscription is not None:
groupName, igrType, texture, bumpMap, inscriptionUserString, isFeatured = inscription[0:6]
inscriptionIDs, groupUserString, igrType, allow, deny = groups.get(groupName)
isNewItem = self.isNewID(itemID)
if withoutCheck or isNewItem or isInHangar or groupName not in hiddens:
price = self._makeCost(self._cost, self._vehPriceFactor, priceFactors.get(groupName)) if not isInHangar else 0
defaultPrice = self._makeCost(self._defCost, self._defVehPriceFactor, defPriceFactors.get(groupName, 1)) if not isInHangar else 0
action = None
if price != defaultPrice:
isPremium = self._isGold == 1
newPrice = (0, price) if isPremium else (price, 0)
oldPrice = (0, defaultPrice) if isPremium else (defaultPrice, 0)
state = (None, ACTION_TOOLTIPS_STATE.DISCOUNT) if isPremium else (ACTION_TOOLTIPS_STATE.DISCOUNT, None)
key = 'inscriptionPacket7Cost'
if self._period == 0:
key = 'inscriptionPacketInfCost'
elif self._period == 30:
key = 'inscriptionPacket30Cost'
action = {'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
'key': key,
'isBuying': True,
'state': state,
'newPrice': newPrice,
'oldPrice': oldPrice}
timeLeftStr = ''
days = 0
isPermanent = False
value = 0
timeLeft = 0 if self._isGold else self._period * 86400
canUse = True
if isInHangar:
item = CustomizationHelper.getItemFromHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION_TYPE, itemID, self.nationID, self.position)
if item:
isPermanent = item.get('isPermanent')
value = item.get('quantity')
timeLeft = value * 86400 if not item.get('isPermanent') else 0
timeLeftStr = CustomizationHelper.getTimeLeftText(timeLeft)
if not isPermanent:
_, selectedInscriptions = VehicleCustomizationModel.getVehicleModel()
for selectedInscription in selectedInscriptions:
if selectedInscriptions.index(selectedInscription) != self.position and selectedInscription[0] == itemID:
canUse = False
if isCurrent:
updatedDescr = CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor)
item = updatedDescr.playerInscriptions[self.position]
_, startTime, days, _ = item
if days:
timeLeft = startTime + days * 86400 - time.time()
timeLeftStr = CustomizationHelper.getTimeLeftText(timeLeft)
itemInfo = {'id': itemID,
'texturePath': self._makeSmallTextureUrl(texture, None, None),
'description': self._makeDescription(groupUserString, inscriptionUserString),
'igrType': igrType,
'price': {'cost': price,
'isGold': days == 0 if isCurrent else self._isGold == 1},
'action': action,
'current': isCurrent,
'position': self.position,
'isInHangar': isInHangar,
'isFeatured': isFeatured,
'isNew': isNewItem,
'timeLeftStr': timeLeftStr,
'type': CUSTOMIZATION_ITEM_TYPE.INSCRIPTION,
'nationId': self.nationID,
'isSpecialTooltip': True,
'timeLeftValue': timeLeft,
'isPermanent': isPermanent,
'value': value,
'canUse': canUse}
return itemInfo