Esempio n. 1
0
    private void OnOutputDragDroppedTo(SocketInput target)
    {
        //  if sockets connected already
        //  do nothing
        if (_currentDraggingSocket.HasConnection() && target.HasConnection())
        {
            if (_currentDraggingSocket.connection == target.connection)
            {
                _currentDraggingSocket = null;
                drawer.CancelDrag();

                return;
            }
        }

        if (target != null)
        {
            //  check if input allows multiple connection
            if (target.HasConnection())
            {
                //  disconnect old connection
                if (target.connectionType != ConnectionType.Multiple)
                {
                    Disconnect(target.connection);
                }
            }

            Connect(target, _currentDraggingSocket);
        }

        _currentDraggingSocket = null;
        drawer.CancelDrag();
    }
Esempio n. 2
0
    private void OnOutputDragStarted(SocketOutput socketOnDrag)
    {
        _currentDraggingSocket = socketOnDrag;
        drawer.StartDrag(_currentDraggingSocket);

        //  check socket connection type
        if (_currentDraggingSocket.HasConnection())
        {
            //  if single, disconnect
            if (_currentDraggingSocket.connectionType == ConnectionType.Single)
            {
                Disconnect(_currentDraggingSocket.connection);
            }
        }
    }