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


Python NODE_STATE.addIfNot方法代码示例

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


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

示例1: _findNext2UnlockItems

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
    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,代码行数:36,代码来源:techtreedata.py

示例2: _findNext2UnlockItems

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
    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,代码行数:30,代码来源:data.py

示例3: invalidateInventory

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
    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,代码行数:30,代码来源:data.py

示例4: invalidateInventory

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
    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,代码行数:37,代码来源:techtreedata.py

示例5: _checkExpiredRent

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
 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,代码行数:9,代码来源:data.py

示例6: _changeNext2Unlock

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
    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,代码行数:19,代码来源:data.py

示例7: _checkRestoreState

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
 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,代码行数:11,代码来源:techtreedata.py

示例8: invalidatePrbState

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
    def invalidatePrbState(self):
        nodes = self._getNodesToInvalidate()
        canChanged = self._isVehicleCanBeChanged()
        result = []
        for node in nodes:
            nodeCD = node['id']
            state = node['state']
            if getTypeOfCompactDescr(nodeCD) == GUI_ITEM_TYPE.VEHICLE:
                item = self.getItem(nodeCD)
                if not item.isInInventory:
                    continue
                if canChanged:
                    state = NODE_STATE.addIfNot(state, NODE_STATE.VEHICLE_CAN_BE_CHANGED)
                else:
                    state = NODE_STATE.removeIfHas(state, NODE_STATE.VEHICLE_CAN_BE_CHANGED)
                if state > -1:
                    node['state'] = state
                    result.append((nodeCD, state))

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

示例9: invalidatePrbState

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
    def invalidatePrbState(self):
        """
        Finds vehicles that is in inventory,
        :return: [(<int:vehicle compact descriptor>, <new state>), ... ].
        """
        nodes = self._getNodesToInvalidate()
        canChanged = self._isVehicleCanBeChanged()
        result = []
        for node in nodes:
            nodeCD = node['id']
            state = node['state']
            if getTypeOfCD(nodeCD) == GUI_ITEM_TYPE.VEHICLE:
                item = self.getItem(nodeCD)
                if not item.isInInventory:
                    continue
                if canChanged:
                    state = NODE_STATE.addIfNot(state, NODE_STATE_FLAGS.VEHICLE_CAN_BE_CHANGED)
                else:
                    state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.VEHICLE_CAN_BE_CHANGED)
                if state > -1:
                    node['state'] = state
                    result.append((nodeCD, state))

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

示例10: _checkRentableState

# 需要导入模块: from gui.Scaleform.daapi.view.lobby.techtree.settings import NODE_STATE [as 别名]
# 或者: from gui.Scaleform.daapi.view.lobby.techtree.settings.NODE_STATE import addIfNot [as 别名]
 def _checkRentableState(self, state, item):
     state = NODE_STATE.removeIfHas(state, NODE_STATE_FLAGS.RENT_AVAILABLE)
     if not item.isRented and item.isRentable and item.isRentAvailable:
         state = NODE_STATE.addIfNot(state, NODE_STATE_FLAGS.RENT_AVAILABLE)
     return state
开发者ID:aevitas,项目名称:wotsdk,代码行数:7,代码来源:techtreedata.py


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