private void Disconnect() { if (!connected) { return; } LogicCircuitManager logicCircuitManager = Game.Instance.logicCircuitManager; UtilityNetworkManager <LogicCircuitNetwork, LogicWire> logicCircuitSystem = Game.Instance.logicCircuitSystem; connected = false; int outputCellOne = OutputCellOne; logicCircuitSystem.RemoveFromNetworks(outputCellOne, this, true); logicCircuitManager.RemoveVisElem(outputOne); outputOne = null; int inputCellOne = InputCellOne; logicCircuitSystem.RemoveFromNetworks(inputCellOne, inputOne, true); logicCircuitManager.RemoveVisElem((ILogicUIElement)inputOne); inputOne = null; if (RequiresTwoInputs) { int inputCellTwo = InputCellTwo; logicCircuitSystem.RemoveFromNetworks(inputCellTwo, inputTwo, true); logicCircuitManager.RemoveVisElem((ILogicUIElement)inputTwo); inputTwo = null; } RefreshAnimation(); }
private void Connect() { if (connected) { return; } LogicCircuitManager logicCircuitManager = Game.Instance.logicCircuitManager; UtilityNetworkManager <LogicCircuitNetwork, LogicWire> logicCircuitSystem = Game.Instance.logicCircuitSystem; connected = true; int outputCellOne = OutputCellOne; logicCircuitSystem.AddToNetworks(outputCellOne, this, true); outputOne = new LogicPortVisualizer(outputCellOne, LogicPortSpriteType.RibbonOutput); logicCircuitManager.AddVisElem(outputOne); int inputCellOne = InputCellOne; logicCircuitSystem.AddToNetworks(inputCellOne, inputOne, true); logicCircuitManager.AddVisElem((ILogicUIElement)inputOne); if (RequiresTwoInputs) { int inputCellTwo = InputCellTwo; logicCircuitSystem.AddToNetworks(inputCellTwo, inputTwo, true); logicCircuitManager.AddVisElem((ILogicUIElement)inputTwo); } RefreshAnimation(); }
public bool IsPortConnected(HashedString port_id) { int portCell = GetPortCell(port_id); LogicCircuitManager logicCircuitManager = Game.Instance.logicCircuitManager; LogicCircuitNetwork networkForCell = logicCircuitManager.GetNetworkForCell(portCell); return(networkForCell != null); }
private LogicCircuitNetwork GetNetwork() { LogicPorts component = GetComponent <LogicPorts>(); int portCell = component.GetPortCell(PORT_ID); LogicCircuitManager logicCircuitManager = Game.Instance.logicCircuitManager; return(logicCircuitManager.GetNetworkForCell(portCell)); }
private static void Postfix(LogicCircuitManager __instance, ref List <LogicUtilityNetworkLink>[] ___bridgeGroups) { ___bridgeGroups = new List <LogicUtilityNetworkLink> [Mod.MAX_WIRE_TYPES]; for (var i = 0; i < ___bridgeGroups.Length; i++) { ___bridgeGroups[i] = new List <LogicUtilityNetworkLink>(); } }
private void Unregister() { LogicCircuitManager logicCircuitManager = Game.Instance.logicCircuitManager; foreach (IOVisualizer visChild in visChildren) { logicCircuitManager.RemoveVisElem(visChild); } visChildren.Clear(); }
public bool GetPortConnected(PortId port) { if (port == PortId.InputTwo && !base.RequiresTwoInputs) { return(false); } int cell = PortCell(port); LogicCircuitManager logicCircuitManager = Game.Instance.logicCircuitManager; LogicCircuitNetwork networkForCell = logicCircuitManager.GetNetworkForCell(cell); return(networkForCell != null); }
private void Register() { Unregister(); visChildren.Add(new IOVisualizer(OutputCellOne, false, true)); visChildren.Add(new IOVisualizer(InputCellOne, true, true)); if (RequiresTwoInputs) { visChildren.Add(new IOVisualizer(InputCellTwo, true, true)); } LogicCircuitManager logicCircuitManager = Game.Instance.logicCircuitManager; foreach (IOVisualizer visChild in visChildren) { logicCircuitManager.AddVisElem(visChild); } }
private bool ShowMissingWireIcon() { LogicCircuitManager logicCircuitManager = Game.Instance.logicCircuitManager; if (outputPortInfo != null) { for (int i = 0; i < outputPortInfo.Length; i++) { Port port = outputPortInfo[i]; if (port.requiresConnection) { int portCell = GetPortCell(port.id); LogicCircuitNetwork networkForCell = logicCircuitManager.GetNetworkForCell(portCell); if (networkForCell == null) { return(true); } } } } if (inputPortInfo != null) { for (int j = 0; j < inputPortInfo.Length; j++) { Port port2 = inputPortInfo[j]; if (port2.requiresConnection) { int portCell2 = GetPortCell(port2.id); LogicCircuitNetwork networkForCell2 = logicCircuitManager.GetNetworkForCell(portCell2); if (networkForCell2 == null) { return(true); } } } } return(false); }
private void Connect() { if (!connected) { LogicCircuitManager logicCircuitManager = Game.Instance.logicCircuitManager; UtilityNetworkManager <LogicCircuitNetwork, LogicWire> logicCircuitSystem = Game.Instance.logicCircuitSystem; connected = true; int outputCell = base.OutputCell; logicCircuitSystem.AddToNetworks(outputCell, this, true); output = new LogicPortVisualizer(outputCell, LogicPortSpriteType.Output); logicCircuitManager.AddVisElem(output); int inputCellOne = base.InputCellOne; logicCircuitSystem.AddToNetworks(inputCellOne, inputOne, true); logicCircuitManager.AddVisElem(inputOne); if (base.RequiresTwoInputs) { int inputCellTwo = base.InputCellTwo; logicCircuitSystem.AddToNetworks(inputCellTwo, inputTwo, true); logicCircuitManager.AddVisElem(inputTwo); } RefreshAnimation(); } }
private void UpdateMissingWireIcon() { bool show_missing_wire = ShowMissingWireIcon(); LogicCircuitManager.ToggleNoWireConnected(show_missing_wire, base.gameObject); }