本文整理汇总了Python中cart.Cart.setInitialSlotsData方法的典型用法代码示例。如果您正苦于以下问题:Python Cart.setInitialSlotsData方法的具体用法?Python Cart.setInitialSlotsData怎么用?Python Cart.setInitialSlotsData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cart.Cart
的用法示例。
在下文中一共展示了Cart.setInitialSlotsData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Slots
# 需要导入模块: from cart import Cart [as 别名]
# 或者: from cart.Cart import setInitialSlotsData [as 别名]
#.........这里部分代码省略.........
return initialIndex
return initialIndex
def __setSlotAndUpdateView(self, cType, slotIdx, itemToSet):
self.__data['data'][cType]['data'][slotIdx] = itemToSet
self.cart.update(self.__data)
self.bonusPanel.update(self.__data)
self.updated({'type': cType,
'idx': slotIdx,
'data': itemToSet})
def __updateViewModel(self, cType, slotIdx, newSlotItem):
if cType != CUSTOMIZATION_TYPE.CAMOUFLAGE:
viewModelItem = [None if newSlotItem['itemID'] < 0 else newSlotItem['itemID'], time.time(), 0]
if cType == CUSTOMIZATION_TYPE.INSCRIPTION:
viewModelItem.append(0)
self.__aData.viewModel[cType][newSlotItem['spot'] + self.calculateVehicleIndex(slotIdx, cType)] = viewModelItem
g_hangarSpace.space.updateVehicleSticker(self.__aData.viewModel[1:3])
return
def __updateSlotsData(self, resetSlots):
newSlotsData = {'data': [{'header': self.__setSlotsHeader(CUSTOMIZATION_TYPE.CAMOUFLAGE),
'data': self.__setSlotsData(CUSTOMIZATION_TYPE.CAMOUFLAGE)}, {'header': self.__setSlotsHeader(CUSTOMIZATION_TYPE.EMBLEM),
'data': self.__setSlotsData(CUSTOMIZATION_TYPE.EMBLEM)}, {'header': self.__setSlotsHeader(CUSTOMIZATION_TYPE.INSCRIPTION),
'data': self.__setSlotsData(CUSTOMIZATION_TYPE.INSCRIPTION)}]}
if self.__initialData is not None and not resetSlots:
self.__handleServerChange(newSlotsData)
self.__initialData = newSlotsData
else:
self.__data = newSlotsData
self.__initialData = copy.deepcopy(self.__data)
if resetSlots:
self.__resetSlots()
self.cart.setInitialSlotsData(self.__initialData)
self.cart.update(self.__data)
self.bonusPanel.setInitialSlotsData(self.__initialData)
self.bonusPanel.update(self.__data)
return
def __setSlotsData(self, cType):
selectorSlotsData = []
for slotIdx in range(0, len(self.__aData.installed[cType])):
installedItem = self.__aData.installed[cType][slotIdx]
itemID = installedItem.getID()
if itemID is None or self.__aData.available[cType][itemID].getGroup() == 'auto':
itemID = -1
slotData = {'itemID': itemID,
'slotTooltip': makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_SLOT_HEADER, groupName=_ms(_SLOT_TOOLTIP_MAPPING[cType])), TOOLTIPS.CUSTOMIZATION_SLOT_BODY),
'removeBtnTooltip': makeTooltip(TOOLTIPS.CUSTOMIZATION_SLOTREMOVE_HEADER, TOOLTIPS.CUSTOMIZATION_SLOTREMOVE_BODY),
'spot': installedItem.getSpot(),
'isInDossier': itemID >= 0}
if itemID < 0:
if cType == CUSTOMIZATION_TYPE.CAMOUFLAGE:
slotData['img'] = _EMPTY_SLOTS_MAP[cType][slotIdx]
else:
slotData['img'] = _EMPTY_SLOTS_MAP[cType]
else:
availableItem = self.__aData.available[cType][itemID]
slotData['img'] = availableItem.getTexturePath()
slotData['bonus'] = self.__getSlotBonusString(availableItem.qualifier, True)
if self.__aData.available[cType][itemID].isInDossier:
purchaseTypeIcon = RES_ICONS.MAPS_ICONS_LIBRARY_GOLDICON_2
else:
purchaseTypeIcon = RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2
slotData['purchaseTypeIcon'] = purchaseTypeIcon
slotData['duration'] = installedItem.duration