本文整理汇总了Python中items.vehicles.CAMOUFLAGE_KINDS类的典型用法代码示例。如果您正苦于以下问题:Python CAMOUFLAGE_KINDS类的具体用法?Python CAMOUFLAGE_KINDS怎么用?Python CAMOUFLAGE_KINDS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAMOUFLAGE_KINDS类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __getKindById
def __getKindById(self, kindId):
kind = 'winter'
for k, v in CAMOUFLAGE_KINDS.iteritems():
if v == kindId:
kind = k
return kind
示例2: onRequestList
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
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: __onDropVehicleCamouflage
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
示例5: refreshViewData
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
示例6: buildList
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
示例7: __onDropVehicleCamouflage
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
示例8: update
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)
示例9: buildList
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)
示例10: __onDropVehicleCamouflage
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)
示例11: __readVehicleCamouflageKind
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
示例12: resetCurrentItems
def resetCurrentItems(self):
for k, v in CAMOUFLAGE_KINDS.iteritems():
self.setCurrentItem(v, None, None, None, None)
self.indexToKind[v] = k
return