Ejemplo 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();
    }