本文整理汇总了Python中items.vehicles.CAMOUFLAGE_KINDS.get方法的典型用法代码示例。如果您正苦于以下问题:Python CAMOUFLAGE_KINDS.get方法的具体用法?Python CAMOUFLAGE_KINDS.get怎么用?Python CAMOUFLAGE_KINDS.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类items.vehicles.CAMOUFLAGE_KINDS
的用法示例。
在下文中一共展示了CAMOUFLAGE_KINDS.get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __onDropVehicleCamouflage
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def __onDropVehicleCamouflage(self, resultID, kind):
if resultID < 0:
message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_DROP_SERVER_ERROR)
self.onCustomizationDropFailed(message)
return
else:
item = self.currentItemsByKind.get(kind)
hangarItem = CustomizationHelper.getItemFromHangar(CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE_TYPE, item.get('id'), self._nationID)
if hangarItem:
intCD = g_currentVehicle.item.intCD
vehicle = vehicles.getVehicleType(int(intCD))
message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_STORED_SUCCESS, vehicle=vehicle.userString)
else:
message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_DROP_SUCCESS)
if g_tankActiveCamouflage.has_key(g_currentVehicle.item.intCD):
del g_tankActiveCamouflage[g_currentVehicle.item.intCD]
newID = None
newLifeCycle = None
if gui.game_control.g_instance.igr.getRoomType() != IGR_TYPE.NONE:
camouflages = g_currentVehicle.item.descriptor.camouflages
camo = camouflages[kind]
if camo[0] is not None:
newID = camo[0]
newLifeCycle = (camo[1], camo[2])
item['id'] = newID
item['lifeCycle'] = newLifeCycle
if CAMOUFLAGE_KINDS.get(self._itemsDP.currentGroup) == kind:
self._itemsDP.currentItemID = newID
self.onCustomizationDropSuccess(message)
return
示例2: onRequestList
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def onRequestList(self, groupName):
self.currentGroup = groupName
customization = vehicles.g_cache.customization(self.nationID)
result = []
if customization is not None:
groups = customization.get('camouflageGroups', {})
group = groups.get(groupName, {})
camouflages = customization.get('camouflages', {})
armorColor = customization.get('armorColor', 0)
ids = group.get('ids', [])
currIntDescr = g_currentVehicle.item.intCD
for id in ids:
camouflageInfo = self._constructCamouflage(id, groups, camouflages, armorColor, isCurrent=self.currentItemID == id, isInHangar=CustomizationHelper.isItemInHangar(CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE, id, self.nationID), withoutCheck=False, currVehIntD=currIntDescr)
if camouflageInfo is not None:
if not self._isIGR and camouflageInfo.get('igrType') == constants.IGR_TYPE.NONE or self._isIGR and camouflageInfo.get('igrType') == constants.IGR_TYPE.PREMIUM:
result.append(camouflageInfo)
if gui.GUI_SETTINGS.igrEnabled:
for name, group in groups.iteritems():
if name not in CAMOUFLAGE_KINDS:
ids = group.get('ids', [])
for cID in ids:
camouflage = camouflages.get(cID, None)
if camouflage.get('kind', 0) == CAMOUFLAGE_KINDS.get(groupName, 0):
camouflageInfo = self._constructCamouflage(cID, groups, camouflages, armorColor, isCurrent=self.currentItemID == cID, isInHangar=CustomizationHelper.isItemInHangar(CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE, cID, self.nationID), withoutCheck=False, currVehIntD=currIntDescr)
if camouflageInfo is not None and camouflageInfo:
if not self._isIGR and camouflageInfo.get('igrType') == constants.IGR_TYPE.NONE or self._isIGR and camouflageInfo.get('igrType') == constants.IGR_TYPE.PREMIUM:
result.append(camouflageInfo)
return sorted(result, cmp=self.__comparator)
示例3: __onChangeVehicleCamouflage
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def __onChangeVehicleCamouflage(self, price, kind, resultID):
if resultID < 0:
message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_CHANGE_SERVER_ERROR)
self.onCustomizationChangeFailed(message)
return
else:
item = self.currentItemsByKind.get(kind)
g_tankActiveCamouflage[g_currentVehicle.item.intCD] = kind
item['id'] = item.get('newItemID')
item['lifeCycle'] = None
item['newItemID'] = None
if CAMOUFLAGE_KINDS.get(self._itemsDP.currentGroup) == kind:
self._itemsDP.currentItemID = item['id']
cost, isGold = price
if cost == 0:
key = SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_CHANGE_SUCCESS_FREE
typeValue = SystemMessages.SM_TYPE.Information
str = i18n.makeString(key)
else:
if isGold:
key = SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_CHANGE_SUCCESS_GOLD
fCost = BigWorld.wg_getGoldFormat(cost)
typeValue = SystemMessages.SM_TYPE.CustomizationForGold
else:
key = SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_CHANGE_SUCCESS_CREDITS
fCost = BigWorld.wg_getIntegralFormat(cost)
typeValue = SystemMessages.SM_TYPE.CustomizationForCredits
str = i18n.makeString(key, fCost)
self.onCustomizationChangeSuccess(str, typeValue)
return
示例4: refreshViewData
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def refreshViewData(self, vehType, refresh=False):
if vehType is not None:
self._groupsDP.buildList()
self._itemsDP.setVehicleTypeParams(
self.getItemPriceFactor(vehType),
self.getItemDefaultPriceFactor(vehType),
self.currentItemsByKind.get(CAMOUFLAGE_KINDS.get(self._itemsDP.currentGroup, 0), {"id": None}).get(
"id"
),
)
self._rentalPackageDP.refreshList()
return
示例5: buildList
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def buildList(self):
customization = vehicles.g_cache.customization(self._nationID)
result = []
if customization is not None:
groups = customization.get('camouflageGroups', {})
for name, info in groups.iteritems():
result.append({'name': name,
'userString': info.get('userString', name),
'hasNew': info.get('hasNew', False),
'kind': CAMOUFLAGE_KINDS.get(name)})
self.__list = sorted(result, cmp=self.__comparator)
return
示例6: __onDropVehicleCamouflage
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def __onDropVehicleCamouflage(self, resultID, kind):
if resultID < 0:
message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_DROP_SERVER_ERROR)
self.onCustomizationDropFailed(message)
return
else:
item = self.currentItemsByKind.get(kind)
if g_tankActiveCamouflage.has_key(g_currentVehicle.item.intCD):
del g_tankActiveCamouflage[g_currentVehicle.item.intCD]
item['id'] = None
item['lifeCycle'] = None
if CAMOUFLAGE_KINDS.get(self._itemsDP.currentGroup) == kind:
self._itemsDP.currentItemID = None
message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_DROP_SUCCESS)
self.onCustomizationDropSuccess(message)
return
示例7: update
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def update(self, vehicleDescr):
camouflages = vehicleDescr.camouflages
isUpdated = False
for index, camouflage in enumerate(camouflages):
camouflageID = camouflage[0] if camouflage is not None else None
item = self.currentItemsByKind[index]
if camouflageID != item.get('id'):
isUpdated = True
item['id'] = camouflageID
if camouflage is not None:
_, startTime, days = camouflage
startTime = time_utils.makeLocalServerTime(startTime)
item['lifeCycle'] = (startTime, days)
else:
item['lifeCycle'] = None
if CAMOUFLAGE_KINDS.get(self._itemsDP.currentGroup) == index:
self._itemsDP.currentItemID = item['id']
if isUpdated:
self.onCurrentItemChange(self._name)
示例8: buildList
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def buildList(self):
customization = vehicles.g_cache.customization(self._nationID)
result = []
compactDescr = g_currentVehicle.item.descriptor.type.compactDescr
activeGroup = g_tankActiveCamouflage['historical'].get(compactDescr)
if activeGroup is None:
activeGroup = g_tankActiveCamouflage.get(compactDescr, 0)
if customization is not None:
groups = customization.get('camouflageGroups', {})
for name, info in groups.iteritems():
isHasNew = self._hasNewItems(CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE_TYPE, info.get('ids', []))
if name in CAMOUFLAGE_KINDS:
groupId = CAMOUFLAGE_KINDS.get(name)
result.append({'name': name,
'userString': info.get('userString', name),
'hasNew': isHasNew,
'kind': groupId,
'enabled': True,
'selected': activeGroup == groupId})
self._list = sorted(result, cmp=self.__comparator)
示例9: __onDropVehicleCamouflage
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def __onDropVehicleCamouflage(self, resultID, kind):
if resultID < 0:
message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_DROP_SERVER_ERROR)
self.onCustomizationDropFailed(message)
return
item = self.currentItemsByKind.get(kind)
if g_tankActiveCamouflage.has_key(g_currentVehicle.item.intCD):
del g_tankActiveCamouflage[g_currentVehicle.item.intCD]
newID = None
newLifeCycle = None
if gui.game_control.g_instance.igr.getRoomType() != IGR_TYPE.NONE:
camouflages = g_currentVehicle.item.descriptor.camouflages
camo = camouflages[kind]
if camo[0] is not None:
newID = camo[0]
newLifeCycle = (camo[1], camo[2])
item['id'] = newID
item['lifeCycle'] = newLifeCycle
if CAMOUFLAGE_KINDS.get(self._itemsDP.currentGroup) == kind:
self._itemsDP.currentItemID = newID
message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_DROP_SUCCESS)
self.onCustomizationDropSuccess(message)
示例10: __readVehicleCamouflageKind
# 需要导入模块: from items.vehicles import CAMOUFLAGE_KINDS [as 别名]
# 或者: from items.vehicles.CAMOUFLAGE_KINDS import get [as 别名]
def __readVehicleCamouflageKind(section):
kindName = section.readString('vehicleCamouflageKind')
kind = CAMOUFLAGE_KINDS.get(kindName)
if kind is None:
raise Exception("missing or wrong section 'vehicleCamouflageKind'")
return kind