当前位置: 首页>>代码示例>>Python>>正文


Python customization.CustomizationHelper类代码示例

本文整理汇总了Python中gui.Scaleform.daapi.view.lobby.customization.CustomizationHelper的典型用法代码示例。如果您正苦于以下问题:Python CustomizationHelper类的具体用法?Python CustomizationHelper怎么用?Python CustomizationHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CustomizationHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: change

 def change(self, vehInvID, section, isAlreadyPurchased):
     if self._newItemID is None:
         message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_INSCRIPTION_NOT_SELECTED)
         self.onCustomizationChangeFailed(message)
         return
     if self._rentalPackageDP.selectedPackage is None:
         message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_INSCRIPTION_DAYS_NOT_SELECTED)
         self.onCustomizationChangeFailed(message)
         return
     cost, isGold = self._itemsDP.getCost(self._newItemID)
     if cost < 0:
         message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_INSCRIPTION_COST_NOT_FOUND)
         self.onCustomizationChangeFailed(message)
         return
     if isAlreadyPurchased:
         daysToWear = 0
         cost = 0
     elif CustomizationHelper.isItemInHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION, self._newItemID, self._nationID, self._itemsDP.position):
         hangarItem = CustomizationHelper.getItemFromHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION_TYPE, self._newItemID)
         daysToWear = 0 if hangarItem.get('isPermanent') else 7
     else:
         daysToWear = self._rentalPackageDP.selectedPackage.get('periodDays')
     newIdToSend = 0
     isNewInDefaultSetup = False
     isCurrIgr = self._itemsDP.isIGRItem(self._currentItemID)
     if isCurrIgr:
         isNewInDefaultSetup = CustomizationHelper.isIdInDefaultSetup(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION, self._newItemID)
     if self._currentItemID is None or not isCurrIgr or isCurrIgr and not isNewInDefaultSetup or isCurrIgr and isNewInDefaultSetup and daysToWear > 0:
         newIdToSend = self._newItemID
     BigWorld.player().inventory.changeVehicleInscription(vehInvID, self.getRealPosition(), newIdToSend, daysToWear, 1, lambda resultID: self.__onChangeVehicleInscription(resultID, (cost, isGold)))
开发者ID:wotmods,项目名称:WOTDecompiled,代码行数:30,代码来源:inscriptioninterface.py

示例2: change

    def change(self, vehInvID, section, isAlreadyPurchased):
        if self._rentalPackageDP.selectedPackage is None:
            message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_DAYS_NOT_SELECTED)
            self.onCustomizationChangeFailed(message)
            return
        else:
            isNewItemFound = False
            for kind, item in self.currentItemsByKind.iteritems():
                newItemID = item.get("newItemID", None)
                currItemId = item.get("id", None)
                if newItemID is None:
                    continue
                elif not isNewItemFound:
                    isNewItemFound = True
                price = self.getItemCost(newItemID, item.get("packageIdx"))
                cost = price.get("cost", 0)
                isGold = price.get("isGold", False)
                if cost < 0:
                    message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_COST_NOT_FOUND)
                    self.onCustomizationChangeFailed(message)
                    return
                localKind = kind
                if CustomizationHelper.isItemInHangar(CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE, newItemID, self._nationID):
                    hangarItem = CustomizationHelper.getItemFromHangar(
                        CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE_TYPE, newItemID, self._nationID
                    )
                    daysToWear = 0 if hangarItem.get("isPermanent") else 7
                else:
                    daysToWear = self._rentalPackageDP.pyRequestItemAt(item.get("packageIdx")).get("periodDays")
                newIdToSend = 0
                isNewInDefaultSetup = False
                isCurrIgr = self._itemsDP.isIGRItem(currItemId)
                if isCurrIgr:
                    isNewInDefaultSetup = CustomizationHelper.isIdInDefaultSetup(
                        CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE, newItemID
                    )
                if (
                    currItemId is None
                    or not isCurrIgr
                    or isCurrIgr
                    and not isNewInDefaultSetup
                    or isCurrIgr
                    and isNewInDefaultSetup
                    and daysToWear > 0
                ):
                    newIdToSend = newItemID
                BigWorld.player().inventory.changeVehicleCamouflage(
                    vehInvID,
                    localKind,
                    newIdToSend,
                    daysToWear,
                    functools.partial(self.__onChangeVehicleCamouflage, (cost, isGold), localKind),
                )

            if not isNewItemFound:
                message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_CAMOUFLAGE_NOT_SELECTED)
                self.onCustomizationChangeFailed(message)
            return
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:58,代码来源:camouflageinterface.py

示例3: __onIGRTypeChanged

    def __onIGRTypeChanged(self, roomType, xpFactor):
        LOG_DEBUG('__onIGRTypeChanged', roomType, xpFactor)
        if not g_currentVehicle.isPresent():
            return
        self.__steps = len(_VEHICLE_CUSTOMIZATIONS)
        vehType = vehicles.g_cache.vehicle(*g_currentVehicle.item.descriptor.type.id)
        vehDescr = CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor)
        VehicleCustomizationModel.resetVehicleDescriptor(vehDescr)
        for interface in self.__interfaces.itervalues():
            interface.update(CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor))
            interface.refreshViewData(vehType, refresh=True)

        self.as_refreshDataS()
        self.as_onResetNewItemS()
        self.__isIgrChanged = True
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:15,代码来源:vehiclecustomization.py

示例4: buildList

    def buildList(self):
        hiddenEmblems = g_itemsCache.items.shop.getEmblemsGroupHiddens()
        groups, emblems, names = vehicles.g_cache.playerEmblems()
        result = []
        if groups is not None:
            igrRoomType = gui.game_control.g_instance.igr.getRoomType()
            for name, group in groups.iteritems():
                emblemIDs, groupUserString, igrType, nations, allow, deny = group
                isHasNew = self._hasNewItems(CUSTOMIZATION_ITEM_TYPE.EMBLEM_TYPE, emblemIDs)
                isHiddenGroup = name in hiddenEmblems
                hasItemsInHangar = False
                currVehIntD = g_currentVehicle.item.intCD
                canBeUsedOnVehicle = currVehIntD not in deny and (len(allow) == 0 or currVehIntD in allow)
                if isHiddenGroup:
                    hasItemsInHangar = CustomizationHelper.areItemsInHangar(CUSTOMIZATION_ITEM_TYPE.EMBLEM, emblemIDs, self._nationID)
                if canBeUsedOnVehicle and (isHasNew or hasItemsInHangar or not isHiddenGroup) and (gui.GUI_SETTINGS.igrEnabled or not gui.GUI_SETTINGS.igrEnabled and igrType == constants.IGR_TYPE.NONE) and (nations is None or g_currentVehicle.item.nationID in nations):
                    result.append({'name': name,
                     'userString': groupUserString,
                     'hasNew': isHasNew,
                     'isIGR': igrType != constants.IGR_TYPE.NONE,
                     'enabled': igrType == constants.IGR_TYPE.NONE or igrType <= igrRoomType,
                     'tooltip': TOOLTIPS.CUSTOMIZATION_EMBLEM_IGR})

        self._list = sorted(result, cmp=self.__comparator)
        return
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:25,代码来源:data_providers.py

示例5: __onDropVehicleInscription

 def __onDropVehicleInscription(self, resultID):
     if resultID < 0:
         message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_INSCRIPTION_DROP_SERVER_ERROR)
         self.onCustomizationDropFailed(message)
         return
     else:
         newID = None
         newLifeCycle = None
         if gui.game_control.g_instance.igr.getRoomType() != IGR_TYPE.NONE:
             inscriptions = g_currentVehicle.item.descriptor.playerInscriptions
             inscr = inscriptions[self.getRealPosition()]
             if inscr[0] is not None:
                 newID = inscr[0]
                 newLifeCycle = (inscr[1], inscr[2])
         hangarItem = CustomizationHelper.getItemFromHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION_TYPE, self._currentItemID, self._nationID)
         if hangarItem:
             intCD = g_currentVehicle.item.intCD
             vehicle = vehicles.getVehicleType(int(intCD))
             message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_INSCRIPTION_STORED_SUCCESS, vehicle=vehicle.userString)
         else:
             message = i18n.makeString(SYSTEM_MESSAGES.CUSTOMIZATION_INSCRIPTION_DROP_SUCCESS)
         self._currentItemID = newID
         self._currentLifeCycle = newLifeCycle
         self._itemsDP.currentItemID = newID
         self.updateVehicleCustomization(newID)
         self.onCustomizationDropSuccess(message)
         return
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:27,代码来源:inscriptioninterface.py

示例6: _dispose

 def _dispose(self):
     CustomizationHelper.updateVisitedItems(CUSTOMIZATION_ITEM_TYPE.CI_TYPES[self._type], self.__newIds)
     self.__newIds = None
     if self._newItemID is not None:
         self.updateVehicleCustomization(self._currentItemID)
     self._rentalPackageDP.onDataInited -= self._onRentalPackagesDataInited
     self._rentalPackageDP.onRentalPackageChange -= self.__handleRentalPackageChange
     self._rentalPackageDP._dispose()
     self._groupsDP._dispose()
     self._itemsDP._dispose()
     self._rentalPackageDP = None
     self._groupsDP = None
     self._itemsDP = None
     self._eventManager.clear()
     LOG_DEBUG('BaseTimedCustomizationInterface _dispose', self._name)
     super(BaseTimedCustomizationInterface, self)._dispose()
开发者ID:kblw,项目名称:wot_client,代码行数:16,代码来源:basetimedcustomizationinterface.py

示例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)
         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
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:30,代码来源:camouflageinterface.py

示例8: onRequestList

    def onRequestList(self, groupName):
        if not groupName:
            return
        else:
            customization = vehicles.g_cache.customization(self.nationID)
            result = []
            hiddenItems = g_itemsCache.items.shop.getInscriptionsGroupHiddens(self.nationID)
            if customization is not None:
                groups = customization.get('inscriptionGroups', {})
                group = groups.get(groupName, {})
                inscriptions = customization.get('inscriptions', {})
                if group is not None:
                    inscriptionIDs, groupUserString, igrType, allow, deny = group
                    isHasNew = self._hasNewItems(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION_TYPE, inscriptionIDs)
                    isHiddenGroup = groupName in hiddenItems
                    hasItemsInHangar = False
                    if isHiddenGroup:
                        hasItemsInHangar = CustomizationHelper.areItemsInHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION, inscriptionIDs, self.nationID)
                    self._isIGR = igrType != constants.IGR_TYPE.NONE
                    if isHasNew or hasItemsInHangar or not isHiddenGroup:
                        for id in inscriptionIDs:
                            itemInfo = self._constructInscription(id, groups, inscriptions, self.currentItemID == id, False if self.isIGRItem(id) else CustomizationHelper.isItemInHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION, id, self.nationID, self.position), False)
                            if itemInfo is not None:
                                if not self._isIGR or self._isIGR and itemInfo.get('igrType') != constants.IGR_TYPE.NONE:
                                    result.append(itemInfo)

            return sorted(result, cmp=self.__comparator)
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:27,代码来源:data_providers.py

示例9: _hasNewItems

 def _hasNewItems(self, type, itemsInGroupIDs):
     newItemsIds = CustomizationHelper.getNewIdsByType(type, self._nationID)
     if type == CUSTOMIZATION_ITEM_TYPE.EMBLEM_TYPE:
         groupIdsSet = set(itemsInGroupIDs)
     else:
         groupIdsSet = set(((self._nationID, id) for id in itemsInGroupIDs))
     result = groupIdsSet.intersection(newItemsIds)
     return len(result) > 0
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:8,代码来源:data_providers.py

示例10: _getPriceFactor

 def _getPriceFactor(self, itemID):
     priceFactor = 0
     groups, emblems, names = vehicles.g_cache.playerEmblems()
     emblem = emblems.get(itemID)
     if emblem is not None:
         groupName, igrType, texture, bumpFile, emblemUserString, isMirrored = emblem[0:6]
         if not CustomizationHelper.isItemInHangar(CUSTOMIZATION_ITEM_TYPE.EMBLEM, itemID, self.nationID, self.position):
             priceFactor = g_itemsCache.items.shop.getEmblemsGroupPriceFactors().get(groupName)
     return priceFactor
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:9,代码来源:data_providers.py

示例11: __refreshData

    def __refreshData(self):
        vehType = vehicles.g_cache.vehicle(*g_currentVehicle.item.descriptor.type.id)
        updatedDescr = CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor)
        for interface in self.__interfaces.itervalues():
            interface.update(updatedDescr)
            interface.fetchCurrentItem(updatedDescr)
            interface.refreshViewData(vehType, refresh=True)

        self.as_refreshDataS()
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:9,代码来源:vehiclecustomization.py

示例12: __init__

 def __init__(self, name, nationId, type, position = -1):
     super(BaseTimedCustomizationInterface, self).__init__(name, nationId, type, position)
     self._currentItemID = None
     self._currentLifeCycle = None
     self._newItemID = None
     self._rentalPackageDP = None
     self._groupsDP = None
     self._itemsDP = None
     self._flashObject = None
     self.__newIds = CustomizationHelper.getNewIdsByType(CUSTOMIZATION_ITEM_TYPE.CI_TYPES[type], nationId)
开发者ID:kblw,项目名称:wot_client,代码行数:10,代码来源:basetimedcustomizationinterface.py

示例13: onVehiclesUpdate

    def onVehiclesUpdate(self, vehicles):
        if vehicles is None or self.__lockUpdate:
            return
        vehCompDescr = vehicles.get(g_currentVehicle.invID)
        if vehCompDescr is not None:
            vehDescr = VehicleDescr(compactDescr=vehCompDescr)
            for interface in self.__interfaces.itervalues():
                interface.update(CustomizationHelper.getUpdatedDescriptor(vehDescr))

            self.as_refreshItemsDataS()
开发者ID:kblw,项目名称:wot_client,代码行数:10,代码来源:vehiclecustomization.py

示例14: _dispose

    def _dispose(self):
        self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.HIDE_HANGAR, False))
        self.__resetPreviewMode()
        for interface in self.__interfaces.itervalues():
            interface.destroy()
            interface.onDataInited -= self.__ci_onDataInited
            interface.onCustomizationChangeSuccess -= self.__ci_onCustomizationChangeSuccess
            interface.onCustomizationChangeFailed -= self.__ci_onCustomizationChangeFailed
            interface.onCustomizationDropSuccess -= self.__ci_onCustomizationDropSuccess
            interface.onCustomizationDropFailed -= self.__ci_onCustomizationDropFailed
            interface.onCurrentItemChange -= self.__ci_onCurrentItemChanged

        self.__interfaces.clear()
        self.__onceDataInited = False
        g_itemsCache.onSyncCompleted -= self.__pe_onShopResync
        game_control.g_instance.igr.onIgrTypeChanged -= self.__onIGRTypeChanged
        g_currentVehicle.onChanged -= self.__cv_onChanged
        g_hangarSpace.onSpaceCreate -= self.__hs_onSpaceCreate
        g_playerEvents.onDossiersResync -= self.__pe_onDossiersResync
        g_clientUpdateManager.removeObjectCallbacks(self)
        CustomizationHelper.clearStoredCustomizationData()
        View._dispose(self)
开发者ID:webiumsk,项目名称:WoT,代码行数:22,代码来源:vehiclecustomization.py

示例15: _populate

    def _populate(self):
        BigWorld.player().resyncDossiers()
        self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.HIDE_HANGAR, True))
        View._populate(self)
        credits, gold = g_itemsCache.items.stats.money
        self.as_setCreditsS(credits)
        self.as_setGoldS(gold)
        g_playerEvents.onDossiersResync += self.__pe_onDossiersResync
        g_clientUpdateManager.addCallbacks({'stats.gold': self.onGoldUpdate,
         'stats.credits': self.onCreditsUpdate,
         'cache.mayConsumeWalletResources': self.onGoldUpdate,
         'account.attrs': self.onCameraUpdate,
         'inventory.1.compDescr': self.onVehiclesUpdate,
         'cache.vehsLock': self.__cv_onChanged})
        g_itemsCache.onSyncCompleted += self.__pe_onShopResync
        game_control.g_instance.igr.onIgrTypeChanged += self.__onIGRTypeChanged
        g_currentVehicle.onChanged += self.__cv_onChanged
        g_hangarSpace.onSpaceCreate += self.__hs_onSpaceCreate
        g_eventsCache.onSyncCompleted += self.__onEventsCacheSyncCompleted
        vehDescr = None
        vehType = None
        if g_currentVehicle.isPresent():
            vehDescr = CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor)
            vehType = vehDescr.type
            VehicleCustomizationModel.setVehicleDescriptor(vehDescr)
        self.__steps = len(_VEHICLE_CUSTOMIZATIONS)
        for customization in _VEHICLE_CUSTOMIZATIONS:
            sectionName = customization['sectionName']
            interface = customization['interface'](sectionName, vehDescr.type.customizationNationID, customization['type'], customization['position'])
            interface.onDataInited += self.__ci_onDataInited
            interface.onCustomizationChangeSuccess += self.__ci_onCustomizationChangeSuccess
            interface.onCustomizationChangeFailed += self.__ci_onCustomizationChangeFailed
            interface.onCustomizationDropSuccess += self.__ci_onCustomizationDropSuccess
            interface.onCustomizationDropFailed += self.__ci_onCustomizationDropFailed
            interface.onCurrentItemChange += self.__ci_onCurrentItemChanged
            self.__interfaces[sectionName] = interface
            interface.updateSlotsPosition(vehDescr)
            interface.setFlashObject(self.flashObject, setScript=False)
            interface.fetchCurrentItem(vehDescr)
            interface.invalidateViewData(vehType)

        if not self.__steps:
            self.__finishInitData()
        self.setupContextHints(TUTORIAL.CUSTOMIZATION)
        return
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:45,代码来源:vehiclecustomization.py


注:本文中的gui.Scaleform.daapi.view.lobby.customization.CustomizationHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。