Exemple #1
0
        public void OnBeginDrag(PointerEventData eventData)
        {
            if (eventData.button != 0)
            {
                return;
            }
            if (draggingLine != null)
            {
                return;
            }
            if (nodeUi && nodeUi.IsSidebarNode)
            {
                return;
            }

            PortUi srcPort = this;

            if (isInput && HasLines)
            {
                //connectedLines should contain exactly 1 entry.
                ConnectionUi entry = connectedLines[0];
                entry.Disconnect();
                srcPort = entry.sourcePortUi;
            }

            draggingLine = Instantiate(connectionPrefab, linesContainer).GetComponent <ConnectionUi>();
            DebugUtils.Assert(draggingLine != null);

            draggingLine.sourcePortUi = srcPort;

            draggingLine.SetVirtualTargetPosition(Center);
            draggingLine.UpdateColors();

            RRCSManager.Instance.selectionManager.SelectionEnabled = false;
        }
Exemple #2
0
        internal ConnectionUi AddConnection(PortUi sourceUi, PortUi targetUi, Connection connection,
                                            ConnectionUi connectionUi)
        {
            if (connectionUi == null)
            {
                connectionUi = Instantiate(connectionPrefab, linesContainer).GetComponent <ConnectionUi>();

                connectionUi.sourcePortUi = sourceUi;
                connectionUi.targetPortUi = targetUi;
                connectionUi.Connection   = connection;
            }

            connectedLines.Add(connectionUi);
            connectionUi.UpdatePositions();
            connectionUi.UpdateColors();
            return(connectionUi);
        }