public override bool ButtonRightClicked(string name, SegmentEntity targetEntity) { if (name != InputRuleAddButton) { return(base.ButtonRightClicked(name, targetEntity)); } _itemSearch = true; ItemSearchWindow.SetupUIRules(); Redraw(targetEntity); return(true); }
public override bool ButtonClicked(string name, SegmentEntity targetEntity) { utils.LogUtils.LogDebug("QuantumOutputPortWindow", "ButtonClicked name: " + name); QuantumOutputPortMachine outputPort = targetEntity as QuantumOutputPortMachine; if (name == OutputItemIcon) { utils.LogUtils.LogDebug("QuantumOutputPortWindow", "ButtonClicked outputitem"); if (outputPort.Exemplar != null) { utils.LogUtils.LogDebug("QuantumOutputPortWindow", "ButtonClicked outputitem - exemplar in outputPort not null"); SetExemplar(WorldScript.mLocalPlayer, outputPort, (ItemBase)null); manager.RedrawWindow(); } return(true); } if (name == ChooseItemButton) { _itemSearch = true; ItemSearchWindow.SetupUIRules(); Redraw(targetEntity); return(true); } if (name == ToggleStatusButton) { ToggleStatus(WorldScript.mLocalPlayer, outputPort); manager.RedrawWindow(); } if (ItemSearchWindow.HandleButtonPress(this, name, out var selectedItem)) { _itemSearch = false; manager.RedrawWindow(); } if (selectedItem == null) { return(false); } SetExemplar(WorldScript.mLocalPlayer, outputPort, selectedItem); return(true); }
public override bool ButtonRightClicked(string name, SegmentEntity targetEntity) { utils.LogUtils.LogDebug("QuantumOutputPortWindow", "ButtonClicked name: " + name); if (name != OutputItemIcon) { return(base.ButtonRightClicked(name, targetEntity)); } QuantumOutputPortMachine outputPort = targetEntity as QuantumOutputPortMachine; if (name == OutputItemIcon) { QuantumOutputPortWindow.SetExemplar(WorldScript.mLocalPlayer, outputPort, (ItemBase)null); manager.RedrawWindow(); return(true); } _itemSearch = true; ItemSearchWindow.SetupUIRules(); Redraw(targetEntity); return(true); }
public override bool ButtonClicked(string name, SegmentEntity targetEntity) { var controller = targetEntity as QuantumStorageControllerMachine; if (controller == null || !controller.IsOperating()) { return(false); } if (name.Equals(InputStatusButton)) { controller.ToggleInput(); if (!WorldScript.mbIsServer) { NetworkManager.instance.SendInterfaceCommand(QuantumStorageMod.QuantumStorageControllerWindowKey, "ToggleInput", null, null, controller, 0.0f); } Dirty = true; return(true); } if (name.Equals(OutputStatusButton)) { controller.ToggleOutput(); if (!WorldScript.mbIsServer) { NetworkManager.instance.SendInterfaceCommand(QuantumStorageMod.QuantumStorageControllerWindowKey, "ToggleOutput", null, null, controller, 0.0f); } Dirty = true; return(true); } if (name.Contains(InputRuleIncreaseButton)) { int.TryParse(name.Replace(InputRuleIncreaseButton, string.Empty), out var itemSlot); if (itemSlot == -1) { return(false); } controller.IncreaseItemInputRuleLimit(controller.GetItemInputRules()[itemSlot]); if (!WorldScript.mbIsServer) { NetworkManager.instance.SendInterfaceCommand(QuantumStorageMod.QuantumStorageControllerWindowKey, "IncreaseItemRule", null, controller.GetItemInputRules()[itemSlot].Item, controller, 0.0f); } Dirty = true; return(true); } if (name.Contains(InputRuleReduceButton)) { int.TryParse(name.Replace(InputRuleReduceButton, string.Empty), out var itemSlot); if (itemSlot == -1) { return(false); } controller.ReduceItemInputRuleLimit(controller.GetItemInputRules()[itemSlot]); if (!WorldScript.mbIsServer) { NetworkManager.instance.SendInterfaceCommand(QuantumStorageMod.QuantumStorageControllerWindowKey, "ReduceItemRule", null, controller.GetItemInputRules()[itemSlot].Item, controller, 0.0f); } Dirty = true; return(true); } if (name.Contains(InputRuleRemoveButton)) { int.TryParse(name.Replace(InputRuleRemoveButton, string.Empty), out var itemSlot); if (itemSlot == -1) { return(false); } controller.RemoveItemInputRule(controller.GetItemInputRules()[itemSlot]); if (!WorldScript.mbIsServer) { NetworkManager.instance.SendInterfaceCommand(QuantumStorageMod.QuantumStorageControllerWindowKey, "RemoveItemRule", controller.GetItemInputRules()[itemSlot].MaxInput.ToString(), controller.GetItemInputRules()[itemSlot].Item, controller, 0.0f); } Redraw(targetEntity); } if (name.Equals(InputRuleAddButton)) { _itemSearch = true; ItemSearchWindow.SetupUIRules(); Redraw(targetEntity); return(true); } if (ItemSearchWindow.HandleButtonPress(this, name, out var selectedItem)) { _itemSearch = false; manager.RedrawWindow(); } if (selectedItem == null) { return(false); } else { var itemInputRule = new ItemInputRule(); itemInputRule.MaxInput = QuantumStorageControllerMachine.DefaultInputRuleStep; itemInputRule.Item = selectedItem; controller.AddItemInputRule(itemInputRule); if (!WorldScript.mbIsServer) { NetworkManager.instance.SendInterfaceCommand(QuantumStorageMod.QuantumStorageControllerWindowKey, "AddItemRule", itemInputRule.MaxInput.ToString(), selectedItem, controller, 0.0f); } Redraw(targetEntity); } return(false); }