public override void SpawnWindow(SegmentEntity targetEntity)
        {
            if (!(targetEntity is QuantumOutputPortMachine))
            {
                UIManager.RemoveUIRules("Machine");
            }
            else
            {
                manager.SetTitle("Quantum Output Port");
                if (!_itemSearch)
                {
                    manager.AddIcon(OutputItemIcon, "empty", Color.white, 10, 0);
                    manager.AddBigLabel(OutputTitleLabel, PersistentSettings.GetString("Choose_output"), Color.white, 70, 0);
                    manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, OutputStatusLabel,
                                     string.Empty, Color.white, false, 10, TextHeight * 2);
                    manager.AddButton(ChooseItemButton, PersistentSettings.GetString("Choose_Item"), 100,
                                      ButtonsRowStart + QuantumStorageModSettings.ButtonHeight * 2);
                    manager.AddButton(ToggleStatusButton, "Toggle item output", 100,
                                      ButtonsRowStart + QuantumStorageModSettings.ButtonHeight * 3);
                }
                else
                {
                    ItemSearchWindow.SpawnWindow((BaseMachineWindow)this);
                }

                Dirty = true;
            }
        }
示例#2
0
        public override void SpawnWindow(SegmentEntity targetEntity)
        {
            if (!(targetEntity is QuantumStorageControllerMachine controller))
            {
                GenericMachinePanelScript.instance.Hide();
                UIManager.RemoveUIRules("Machine");
                return;
            }

            if (_itemSearch)
            {
                ItemSearchWindow.SpawnWindow(this);
                Dirty = true;
                return;
            }

            var textHeight       = 30;
            var buttonHeight     = 35;
            var itemWidth        = 60;
            var itemHeight       = 80;
            var buttonWidth      = 120;
            var buttonRowStart   = textHeight * 4 + buttonHeight;
            var itemRuleRowStart = buttonRowStart + buttonHeight * 2 + itemHeight;

            manager.SetTitle(QuantumStorageControllerMachine.MachineName);

            manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, StorageSizeLabel,
                             string.Empty, Color.white,
                             false, 10, textHeight);

            manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, StatusLabel,
                             string.Empty, Color.white,
                             false, 10, textHeight * 2);

            manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, InputStatusLabel,
                             string.Empty, Color.white,
                             false, 10, textHeight * 3);

            manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, OutputStatusLabel,
                             string.Empty, Color.white,
                             false, 10, textHeight * 4);

            manager.AddButton(InputStatusButton, "Toggle item input", 100, buttonRowStart);
            manager.AddButton(OutputStatusButton, "Toggle item output", 100, buttonRowStart + QuantumStorageModSettings.ButtonHeight);
            manager.AddButton(InputRuleAddButton, "Add input item rule", 100, buttonRowStart + QuantumStorageModSettings.ButtonHeight * 2);

            for (int i = 0; i < controller.GetItemInputRules().Count; i++)
            {
                manager.AddIcon(InputRuleItemIcon + i, "empty", Color.white, 10, itemRuleRowStart + itemHeight * i);
                manager.AddLabel(GenericMachineManager.LabelType.OneLineHalfWidth, InputRuleItemLabel + i, string.Empty, Color.white, false, 28, itemRuleRowStart + itemHeight * i + 17);
                manager.AddButton(InputRuleReduceButton + i, "-" + QuantumStorageControllerMachine.DefaultInputRuleStep, itemWidth + 10, itemRuleRowStart + itemHeight * i);
                manager.AddButton(InputRuleIncreaseButton + i, "+" + QuantumStorageControllerMachine.DefaultInputRuleStep, buttonWidth + itemWidth + 10, itemRuleRowStart + itemHeight * i);
                manager.AddButton(InputRuleRemoveButton + i, "X", buttonWidth / 2 + itemWidth + 10, itemRuleRowStart + itemHeight * i + buttonHeight);
            }

            Dirty = true;
        }