示例#1
0
        public override void UpdateMachine(SegmentEntity targetEntity)
        {
            if (!(targetEntity is QuantumStorageControllerMachine quantumStorageController))
            {
                GenericMachinePanelScript.instance.Hide();
                UIManager.RemoveUIRules("Machine");
                return;
            }

            if (_itemSearch)
            {
                if (ItemSearchWindow.UpdateMachine(this))
                {
                    Dirty = true;
                }
            }
            else
            {
                WindowUpdate(quantumStorageController);
            }
        }
        public override void UpdateMachine(SegmentEntity targetEntity)
        {
            QuantumOutputPortMachine outputPort = targetEntity as QuantumOutputPortMachine;

            if (outputPort == null)
            {
                GenericMachinePanelScript.instance.Hide();
                UIManager.RemoveUIRules("Machine");
                return;
            }

            if (!Dirty)
            {
                return;
            }

            if (_itemSearch)
            {
                if (ItemSearchWindow.UpdateMachine((BaseMachineWindow)this))
                {
                    Dirty = true;
                    return;
                }
            }
            else
            {
                ItemBase exemplar = outputPort.Exemplar;
                if (exemplar != null)
                {
                    string itemName = ItemManager.GetItemName(exemplar);
                    manager.UpdateIcon(OutputItemIcon, ItemManager.GetItemIcon(exemplar), Color.white);
                    manager.UpdateLabel(OutputTitleLabel, itemName, Color.white);
                }

                manager.UpdateLabel(OutputStatusLabel, outputPort.Enabled ? "Output enabled" : "Output disabled", Color.white);
            }

            Dirty = false;
        }