// Select signal (starts dragging, shows rename field) void SelectSignal(ChipSignal signalToDrag) { // Dragging selectedSignals.Clear(); for (int i = 0; i < signals.Count; i++) { if (signals[i] == signalToDrag || ChipSignal.InSameGroup(signals[i], signalToDrag)) { selectedSignals.Add(signals[i]); } } isDragging = true; dragMouseStartY = InputHelper.MouseWorldPos.y; if (selectedSignals.Count % 2 == 0) { int indexA = Mathf.Max(0, selectedSignals.Count / 2 - 1); int indexB = selectedSignals.Count / 2; dragHandleStartY = (selectedSignals[indexA].transform.position.y + selectedSignals[indexB].transform.position.y) / 2f; } else { dragHandleStartY = selectedSignals[selectedSignals.Count / 2].transform.position.y; } // Name input field nameField.gameObject.SetActive(true); nameField.text = (selectedSignals[0]).signalName; nameField.Select(); // Delete button deleteButton.gameObject.SetActive(true); UpdateButtonAndNameField(); }
// Select signal (starts dragging, shows rename field) void SelectSignal(ChipSignal signalToDrag) { // Dragging selectedSignals.Clear(); for (int i = 0; i < signals.Count; i++) { if (signals[i] == signalToDrag || ChipSignal.InSameGroup(signals[i], signalToDrag)) { selectedSignals.Add(signals[i]); } } bool isGroup = selectedSignals.Count > 1; isDragging = true; var wireType = Pin.WireType.Simple; if (selectedSignals[0] is InputSignal) { var signal = selectedSignals[0]; var pin = signal.outputPins[0]; wireType = pin.wireType; } if (selectedSignals[0] is OutputSignal) { var signal = selectedSignals[0]; var pin = signal.inputPins[0]; wireType = pin.wireType; } dragMouseStartY = InputHelper.MouseWorldPos.y; if (selectedSignals.Count % 2 == 0) { int indexA = Mathf.Max(0, selectedSignals.Count / 2 - 1); int indexB = selectedSignals.Count / 2; dragHandleStartY = (selectedSignals[indexA].transform.position.y + selectedSignals[indexB].transform.position.y) / 2f; } else { dragHandleStartY = selectedSignals[selectedSignals.Count / 2].transform.position.y; } // Enable UI: propertiesUI.gameObject.SetActive(true); propertiesUI.sizeDelta = new Vector2(propertiesUI.sizeDelta.x, (isGroup) ? propertiesHeightMinMax.y : propertiesHeightMinMax.x); nameField.text = selectedSignals[0].signalName; nameField.Select(); nameField.caretPosition = nameField.text.Length; twosComplementToggle.gameObject.SetActive(isGroup); twosComplementToggle.isOn = selectedSignals[0].useTwosComplement; modeDropdown.gameObject.SetActive(!isGroup); deleteButton.interactable = ChipSaver.IsSignalSafeToDelete(currentEditorName, signalToDrag.signalName); UpdateUIProperties(); modeDropdown.SetValueWithoutNotify((int)wireType); UpdateUIProperties(); }
// Select signal (starts dragging, shows rename field) void SelectSignal(ChipSignal signalToDrag) { // Dragging selectedSignals.Clear(); for (int i = 0; i < signals.Count; i++) { if (signals[i] == signalToDrag || ChipSignal.InSameGroup(signals[i], signalToDrag)) { selectedSignals.Add(signals[i]); } } bool isGroup = selectedSignals.Count > 1; isDragging = true; dragMouseStartY = InputHelper.MouseWorldPos.y; if (selectedSignals.Count % 2 == 0) { int indexA = Mathf.Max(0, selectedSignals.Count / 2 - 1); int indexB = selectedSignals.Count / 2; dragHandleStartY = (selectedSignals[indexA].transform.position.y + selectedSignals[indexB].transform.position.y) / 2f; } else { dragHandleStartY = selectedSignals[selectedSignals.Count / 2].transform.position.y; } // Enable UI: propertiesUI.gameObject.SetActive(true); propertiesUI.sizeDelta = new Vector2(propertiesUI.sizeDelta.x, (isGroup) ? propertiesHeightMinMax.y : propertiesHeightMinMax.x); nameField.text = selectedSignals[0].signalName; nameField.Select(); nameField.caretPosition = nameField.text.Length; twosComplementToggle.gameObject.SetActive(isGroup); twosComplementToggle.isOn = selectedSignals[0].useTwosComplement; UpdateUIProperties(); }