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


Python PluginsCollection.reset方法代码示例

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


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

示例1: ConsumablesPanel

# 需要导入模块: from gui.shared.utils.plugins import PluginsCollection [as 别名]
# 或者: from gui.shared.utils.plugins.PluginsCollection import reset [as 别名]

#.........这里部分代码省略.........
            quantity = item.getQuantity()
            currentTime = item.getTimeRemaining()
            maxTime = item.getTotalTime()
            if item.isAvatar():
                self.__flashObject.setItemTimeQuantityInSlot(self.__cds.index(intCD), quantity, currentTime, maxTime)
                self.__updateOrderSlot(idx, item)
            else:
                self.__flashObject.setItemTimeQuantityInSlot(idx, quantity, currentTime, maxTime)
                self.onPopUpClosed()
        else:
            LOG_ERROR('Equipment is not found in panel', intCD, self.__cds)

    def __onEquipmentCooldownInPercent(self, intCD, percent):
        if intCD in self.__cds:
            self.__flashObject.setCoolDownPosAsPercent(self.__cds.index(intCD), percent)

    def __addEquipmentSlot(self, intCD, item):
        idx = self.__genNextIdx(EQUIPMENT_FULL_MASK, EQUIPMENT_START_IDX)
        self.__cds[idx] = intCD
        descriptor = item.getDescriptor()
        iconPath = '../maps/icons/artefact/%s.png' % descriptor.icon[0]
        toolTip = TOOLTIP_FORMAT.format(descriptor.userString, descriptor.description)
        tag = item.getTag()
        if tag:
            bwKey, sfKey = self.__genKey(idx)
            if item.isEntityRequired():
                handler = partial(self.__handleEquipmentExpanded, intCD)
            else:
                handler = partial(self.__handleEquipmentPressed, intCD)
            if item.getQuantity() > 0:
                self.__keys[bwKey] = handler
        else:
            bwKey, sfKey = (None, None)
        self.__flashObject.addEquipmentSlot(idx, bwKey, sfKey, tag, item.getQuantity(), item.getTimeRemaining(), iconPath, toolTip)
        return None

    def __addOrderSlot(self, intCD, item):
        idx = self.__genNextIdx(ORDERS_FULL_MASK, ORDERS_START_IDX)
        self.__cds[idx] = intCD
        descriptor = item.getDescriptor()
        iconPath = '../maps/icons/artefact/%s.png' % descriptor.icon[0]
        toolTip = TOOLTIP_FORMAT.format(descriptor.userString, descriptor.description)
        bwKey, sfKey = self.__genKey(idx)
        self.__keys[bwKey] = partial(self.__handleEquipmentPressed, intCD)
        maxTime = item.getTotalTime()
        self.__flashObject.addOrderSlot(idx, bwKey, sfKey, item.getQuantity(), iconPath, toolTip, item.getStage() in (EQUIPMENT_STAGES.READY, EQUIPMENT_STAGES.PREPARING), item.isQuantityUsed(), item.getTimeRemaining(), maxTime)
        self.__updateOrderSlot(idx, item)

    def __updateOrderSlot(self, idx, item):
        if item.getStage() == EQUIPMENT_STAGES.READY:
            self.__flashObject.setOrderAvailable(idx, True)
        elif item.getStage() == EQUIPMENT_STAGES.PREPARING:
            self.__currentOrderIdx = idx
            self.__flashObject.setOrderActivated(idx)
        else:
            self.__flashObject.setOrderAvailable(idx, False)
        if item.getStage() != EQUIPMENT_STAGES.PREPARING and self.__currentOrderIdx == idx:
            self.__currentOrderIdx = -1
            self.__flashObject.setOrderActivated(self.__currentOrderIdx)

    def __onOptionalDeviceAdded(self, intCD, descriptor, isOn):
        idx = self.__genNextIdx(OPT_DEVICE_FULL_MASK, OPT_DEVICE_START_IDX)
        self.__cds[idx] = intCD
        iconPath = descriptor.icon[0]
        toolTip = TOOLTIP_FORMAT.format(descriptor.userString, descriptor.description)
        self.__flashObject.addOptionalDeviceSlot(idx, -1 if isOn else 0, iconPath, toolTip)

    def __onOptionalDeviceUpdated(self, intCD, isOn):
        if intCD in self.__cds:
            self.__flashObject.setCoolDownTime(self.__cds.index(intCD), -1 if isOn else 0)
        else:
            LOG_ERROR('Optional device is not found in panel', intCD, self.__cds)

    def __onPostMortemSwitched(self):
        self.__flashObject.switchToPosmortem()

    def __onRespawnBaseMoving(self):
        self.__cds = [None] * PANEL_MAX_LENGTH
        self.__mask = 0
        self.__keys.clear()
        self.__currentOrderIdx = -1
        self.__flashObject.reset()
        self.__plugins.reset()
        return

    def __onVehicleStateUpdated(self, state, value):
        if state != VEHICLE_VIEW_STATE.DEVICES:
            return
        deviceName, _, actualState = value
        if deviceName in VEHICLE_DEVICE_IN_COMPLEX_ITEM:
            itemName = VEHICLE_DEVICE_IN_COMPLEX_ITEM[deviceName]
        else:
            itemName = deviceName
        idx = int(self.__flashObject.updateEntityState(itemName, actualState))
        if idx and idx < len(self.__cds):
            intCD = self.__cds[idx]
            item = g_sessionProvider.getEquipmentsCtrl().getEquipment(intCD)
            if item and item.isEntityRequired():
                bwKey, _ = self.__genKey(idx)
                self.__keys[bwKey] = partial(self.__handleEquipmentPressed, self.__cds[idx], deviceName)
开发者ID:webiumsk,项目名称:WOT0.10.0,代码行数:104,代码来源:consumablespanel.py


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