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


Python settings.NODE_STATE类代码示例

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


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

示例1: _findNext2UnlockItems

    def _findNext2UnlockItems(self, nodes):
        """
        Finds nodes that statuses changed to "next to unlock".
        :param nodes: list of nodes data.
        :return: [(<int:vehicle compact descriptor>, <new state>,
            <new UnlockProps>), ... ].
        """
        result = []
        topLevelCDs = self._topLevelCDs.keys()
        unlockStats = self.getUnlockStats()
        unlockKwargs = unlockStats._asdict()
        for node in nodes:
            nodeCD = node['id']
            state = node['state']
            itemTypeID, _, _ = vehicles.parseIntCompactDescr(nodeCD)
            if itemTypeID == GUI_ITEM_TYPE.VEHICLE and (nodeCD in topLevelCDs or nodeCD == self.getRootCD()):
                available, unlockProps = g_techTreeDP.isNext2Unlock(nodeCD, **unlockKwargs)
                xp = g_techTreeDP.getAllVehiclePossibleXP(unlockProps.parentID, unlockStats)
            else:
                unlockProps = node['unlockProps']
                required = unlockProps.required
                available = len(required) and unlockStats.isSeqUnlocked(required) and not unlockStats.isUnlocked(nodeCD)
                xp = g_techTreeDP.getAllVehiclePossibleXP(self.getRootCD(), unlockStats)
            if available and state & NODE_STATE_FLAGS.LOCKED > 0:
                state ^= NODE_STATE_FLAGS.LOCKED
                state = NODE_STATE.addIfNot(state, NODE_STATE_FLAGS.NEXT_2_UNLOCK)
                if xp >= unlockProps.xpCost:
                    state = NODE_STATE.addIfNot(state, NODE_STATE_FLAGS.ENOUGH_XP)
                else:
                    state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.ENOUGH_XP)
                node['state'] = state
                result.append((node['id'], state, unlockProps._makeTuple()))

        return result
开发者ID:aevitas,项目名称:wotsdk,代码行数:34,代码来源:techtreedata.py

示例2: _findNext2UnlockItems

    def _findNext2UnlockItems(self, nodes):
        result = []
        topLevelCDs = self._topLevelCDs.keys()
        unlockStats = self.getUnlockStats()
        unlockKwargs = unlockStats._asdict()
        for node in nodes:
            nodeCD = node['id']
            state = node['state']
            itemTypeID, _, _ = vehicles.parseIntCompactDescr(nodeCD)
            if itemTypeID == GUI_ITEM_TYPE.VEHICLE and (nodeCD in topLevelCDs or nodeCD == self.getRootCD()):
                available, unlockProps = g_techTreeDP.isNext2Unlock(nodeCD, **unlockKwargs)
                xp = self._getAllPossibleXP(unlockProps.parentID, unlockStats)
            else:
                unlockProps = node['unlockProps']
                required = unlockProps.required
                available = len(required) and unlockStats.isSeqUnlocked(required) and not unlockStats.isUnlocked(nodeCD)
                xp = self._getAllPossibleXP(self.getRootCD(), unlockStats)
            if available and state & NODE_STATE.LOCKED > 0:
                state ^= NODE_STATE.LOCKED
                state = NODE_STATE.addIfNot(state, NODE_STATE.NEXT_2_UNLOCK)
                if xp >= unlockProps.xpCost:
                    state = NODE_STATE.addIfNot(state, NODE_STATE.ENOUGH_XP)
                else:
                    state = NODE_STATE.removeIfHas(state, NODE_STATE.ENOUGH_XP)
                node['state'] = state
                result.append((node['id'], state, unlockProps._makeTuple()))

        return result
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:28,代码来源:data.py

示例3: _checkExpiredRent

 def _checkExpiredRent(self, state, item):
     state = NODE_STATE.addIfNot(state, NODE_STATE.VEHICLE_IN_RENT)
     if item.rentalIsOver:
         state = NODE_STATE.removeIfHas(state, NODE_STATE.IN_INVENTORY)
         state = NODE_STATE.removeIfHas(state, NODE_STATE.VEHICLE_IN_RENT)
         state |= NODE_STATE.VEHICLE_RENTAL_IS_OVER
     return state
开发者ID:webiumsk,项目名称:WOT0.10.0,代码行数:7,代码来源:data.py

示例4: _checkRestoreState

 def _checkRestoreState(self, state, item):
     state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.RESTORE_AVAILABLE)
     money = self._stats.money
     exchangeRate = self._items.shop.exchangeRate
     mayRent, rentReason = item.mayRent(money)
     if item.isRestoreAvailable():
         if item.mayRestoreWithExchange(money, exchangeRate) or not mayRent:
             state = NODE_STATE.addIfNot(state, NODE_STATE_FLAGS.RESTORE_AVAILABLE)
     return state
开发者ID:aevitas,项目名称:wotsdk,代码行数:9,代码来源:techtreedata.py

示例5: _generateOptions

 def _generateOptions(self, ctx = None):
     options = [self._makeItem(MODULE.INFO, MENU.contextmenu(MODULE.INFO)), self._makeSeparator(), self._makeItem(MODULE.UNLOCK, MENU.contextmenu(MODULE.UNLOCK), {'enabled': NODE_STATE.isAvailable2Unlock(self._nodeState)})]
     if NODE_STATE.isUnlocked(self._nodeState):
         if NODE_STATE.inInventory(self._nodeState) or NODE_STATE.isInstalled(self._nodeState):
             options.extend([self._makeItem(MODULE.EQUIP, MENU.contextmenu(MODULE.EQUIP), {'enabled': self._isAvailable2Install()}), self._makeSeparator(), self._makeItem(MODULE.SELL, MENU.CONTEXTMENU_SELLFROMINVENTORY, {'enabled': not NODE_STATE.isInstalled(self._nodeState)})])
         else:
             options.extend([self._makeItem(MODULE.BUY_AND_EQUIP, MENU.CONTEXTMENU_BUYANDEQUIP, {'enabled': self._isAvailable2Buy()}), self._makeSeparator(), self._makeItem(MODULE.SELL, MENU.CONTEXTMENU_SELLFROMINVENTORY, {'enabled': NODE_STATE.isAvailable2Sell(self._nodeState)})])
     else:
         options.extend([self._makeItem(MODULE.BUY_AND_EQUIP, MENU.CONTEXTMENU_BUYANDEQUIP, {'enabled': False}), self._makeSeparator(), self._makeItem(MODULE.SELL, MENU.CONTEXTMENU_SELLFROMINVENTORY, {'enabled': False})])
     return options
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:10,代码来源:research_cm_handlers.py

示例6: invalidateInventory

    def invalidateInventory(self, nodeCDs):
        result = []
        nodes = filter(lambda node: node['id'] in nodeCDs, self._getNodesToInvalidate())
        for node in nodes:
            nodeCD = node['id']
            state = node['state']
            item = self.getItem(nodeCD)
            if item.isInInventory:
                state = NODE_STATE.removeIfHas(state, NODE_STATE.ENOUGH_MONEY)
                state = NODE_STATE.addIfNot(state, NODE_STATE.IN_INVENTORY)
                state = NODE_STATE.removeIfHas(state, NODE_STATE.VEHICLE_IN_RENT)
                if item.isRented and not item.isPremiumIGR:
                    state = self._checkExpiredRent(state, item)
                    state = self._checkMoneyForRentOrBuy(state, nodeCD)
                if self._canSell(nodeCD):
                    state = NODE_STATE.addIfNot(state, NODE_STATE.CAN_SELL)
                else:
                    state = NODE_STATE.removeIfHas(state, NODE_STATE.CAN_SELL)
            else:
                state = NODE_STATE.removeIfHas(state, NODE_STATE.IN_INVENTORY)
                state = NODE_STATE.removeIfHas(state, NODE_STATE.VEHICLE_IN_RENT)
                state = NODE_STATE.removeIfHas(state, NODE_STATE.CAN_SELL)
                state = NODE_STATE.removeIfHas(state, NODE_STATE.SELECTED)
                state = self._checkMoneyForRentOrBuy(state, nodeCD)
            node['state'] = state
            result.append((nodeCD, state))

        return result
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:28,代码来源:data.py

示例7: invalidateInventory

    def invalidateInventory(self, nodeCDs):
        """
        Updates states of nodes that have been purchased.
        :param nodeCDs: list(<int:item compact descriptor>, ...).
        :return: [(<int:vehicle compact descriptor>, <new state>), ... ].
        """
        result = []
        nodes = filter(lambda node: node['id'] in nodeCDs, self._getNodesToInvalidate())
        for node in nodes:
            nodeCD = node['id']
            state = node['state']
            item = self.getItem(nodeCD)
            if item.isInInventory:
                state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.ENOUGH_MONEY)
                state = NODE_STATE.addIfNot(state, NODE_STATE_FLAGS.IN_INVENTORY)
                state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.VEHICLE_IN_RENT)
                if item.isRented and not item.isPremiumIGR:
                    state = self._checkExpiredRent(state, item)
                    state = self._checkMoney(state, nodeCD)
                if self._canSell(nodeCD):
                    state = NODE_STATE.addIfNot(state, NODE_STATE_FLAGS.CAN_SELL)
                else:
                    state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.CAN_SELL)
            else:
                state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.IN_INVENTORY)
                state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.VEHICLE_IN_RENT)
                state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.CAN_SELL)
                state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.SELECTED)
                state = self._checkMoney(state, nodeCD)
            state = self._checkRestoreState(state, item)
            state = self._checkRentableState(state, item)
            node['state'] = state
            result.append((nodeCD, state))

        return result
开发者ID:aevitas,项目名称:wotsdk,代码行数:35,代码来源:techtreedata.py

示例8: _change2Unlocked

 def _change2Unlocked(self, node):
     state = NODE_STATE.change2Unlocked(node['state'])
     if state < 0:
         return node['state']
     node['state'] = state
     if self._canBuy(node['id']):
         state = NODE_STATE.add(state, NODE_STATE.ENOUGH_MONEY)
     else:
         state = NODE_STATE.remove(state, NODE_STATE.ENOUGH_MONEY)
     if state < 0:
         return node['state']
     node['state'] = state
     return state
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:13,代码来源:data.py

示例9: _invalidateMoney

    def _invalidateMoney(self, nodes):
        result = []
        for node in nodes:
            state = node['state']
            nodeID = node['id']
            if self._canRentOrBuy(nodeID):
                state = NODE_STATE.add(state, NODE_STATE.ENOUGH_MONEY)
            else:
                state = NODE_STATE.remove(state, NODE_STATE.ENOUGH_MONEY)
            if state > -1:
                node['state'] = state
                result.append((nodeID, state))

        return result
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:14,代码来源:data.py

示例10: _invalidateXP

    def _invalidateXP(self, nodes):
        result = []
        stats = self.getUnlockStats()
        for node in nodes:
            state = node['state']
            props = node['unlockProps']
            if self._getAllPossibleXP(props.parentID, stats) >= props.xpCost:
                state = NODE_STATE.add(state, NODE_STATE.ENOUGH_XP)
            else:
                state = NODE_STATE.remove(state, NODE_STATE.ENOUGH_XP)
            if state > -1:
                node['state'] = state
                result.append((node['id'], state))

        return result
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:15,代码来源:data.py

示例11: invalidateGold

 def invalidateGold(self):
     """
     Updates states of nodes for which changed their access to buy after
     updates value of gold.
     :return: [(<int:vehicle compact descriptor>, <new state>), ... ]
     """
     return self._invalidateMoney(filter(lambda item: NODE_STATE.isBuyForGold(item['state']), self._getNodesToInvalidate()))
开发者ID:aevitas,项目名称:wotsdk,代码行数:7,代码来源:techtreedata.py

示例12: _changeNext2Unlock

    def _changeNext2Unlock(self, nodeCD, unlockProps, unlockStats):
        state = NODE_STATE.NEXT_2_UNLOCK
        totalXP = self._getAllPossibleXP(unlockProps.parentID, unlockStats)
        if totalXP >= unlockProps.xpCost:
            state = NODE_STATE.addIfNot(state, NODE_STATE.ENOUGH_XP)
        else:
            state = NODE_STATE.removeIfHas(state, NODE_STATE.ENOUGH_XP)
        if self.getItem(nodeCD).isElite:
            state = NODE_STATE.addIfNot(state, NODE_STATE.ELITE)
        try:
            data = self._nodes[self._nodesIdx[nodeCD]]
            data['state'] = state
            data['unlockProps'] = unlockProps
        except KeyError:
            LOG_CURRENT_EXCEPTION()

        return state
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:17,代码来源:data.py

示例13: _change2Unlocked

 def _change2Unlocked(self, node):
     """
     Changes state of node to 'unlocked'.
     :param node: node data.
     :return: int containing new state of node.
     """
     state = NODE_STATE.change2Unlocked(node['state'])
     if state < 0:
         return node['state']
     node['state'] = state
     if self._mayObtainForMoney(node['id']):
         state = NODE_STATE.add(state, NODE_STATE_FLAGS.ENOUGH_MONEY)
     else:
         state = NODE_STATE.remove(state, NODE_STATE_FLAGS.ENOUGH_MONEY)
     if state < 0:
         return node['state']
     node['state'] = state
     return state
开发者ID:aevitas,项目名称:wotsdk,代码行数:18,代码来源:techtreedata.py

示例14: invalidateInstalled

    def invalidateInstalled(self):
        nodes = self._getNodesToInvalidate()
        rootItem = self.getRootItem()
        result = []
        for node in nodes:
            nodeCD = node['id']
            state = node['state']
            item = self.getItem(nodeCD)
            if rootItem.isInInventory and item.isInstalled(rootItem):
                state = NODE_STATE.add(state, NODE_STATE.INSTALLED)
            else:
                state = NODE_STATE.remove(state, NODE_STATE.INSTALLED)
            if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE and item.isElite:
                state = NODE_STATE.add(state, NODE_STATE.ELITE)
            if state > -1:
                node['state'] = state
                result.append((nodeCD, state))

        return result
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:19,代码来源:data.py

示例15: _generateOptions

 def _generateOptions(self, ctx = None):
     vehicle = g_itemsCache.items.getItemByCD(self._nodeCD)
     options = [self._makeItem(VEHICLE.INFO, MENU.CONTEXTMENU_VEHICLEINFOEX)]
     if vehicle.isPreviewAllowed():
         options.append(self._makeItem(VEHICLE.PREVIEW, MENU.CONTEXTMENU_SHOWVEHICLEPREVIEW))
     if NODE_STATE.isWasInBattle(self._nodeState):
         options.append(self._makeItem(VEHICLE.STATS, MENU.CONTEXTMENU_SHOWVEHICLESTATISTICS))
     options.append(self._makeSeparator())
     if vehicle.isUnlocked:
         if not vehicle.isPremiumIGR and (not vehicle.isInInventory or vehicle.isRented):
             options.append(self._makeItem(VEHICLE.BUY, MENU.CONTEXTMENU_BUY, {'enabled': NODE_STATE.isAvailable2Buy(self._nodeState)}))
     else:
         options.append(self._makeItem(VEHICLE.UNLOCK, MENU.CONTEXTMENU_UNLOCK, {'enabled': NODE_STATE.isAvailable2Unlock(self._nodeState) and not NODE_STATE.isPremium(self._nodeState)}))
     if not vehicle.isPremiumIGR:
         isAvailable2SellOrRemove = NODE_STATE.isAvailable2Sell(self._nodeState)
         if isAvailable2SellOrRemove:
             options.append(self._makeItem(VEHICLE.SELL, MENU.CONTEXTMENU_VEHICLEREMOVE if vehicle.isRented else MENU.CONTEXTMENU_SELL, {'enabled': isAvailable2SellOrRemove}))
     options.extend([self._makeSeparator(), self._makeItem(VEHICLE.SELECT, MENU.CONTEXTMENU_SELECTVEHICLEINHANGAR, {'enabled': (NODE_STATE.inInventory(self._nodeState) or NODE_STATE.isRentalOver(self._nodeState)) and NODE_STATE.isVehicleCanBeChanged(self._nodeState)})])
     return options
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:19,代码来源:research_cm_handlers.py


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