Exemplo n.º 1
0
 private void OnOutputSocketClicked(SocketOutput output, PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Right)
     {
         connections.Where(conn => conn.output == output)
         .ToList()
         .ForEach(conn => Disconnect(conn));
     }
 }
Exemplo 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);
                }
            }
        }
Exemplo n.º 3
0
        public void Connect(SocketInput input, SocketOutput output)
        {
            var connection = new Connection()
            {
                connId = CreateId,
                input  = input,
                output = output
            };

            input.Connect(connection);
            output.Connect(connection);

            connections.Add(connection);
            input.parentNode.Connect(input, output);

            drawer.Add(connection.connId, output.handle, input.handle);
        }
Exemplo n.º 4
0
        private void OnOutputDragDroppedTo(SocketInput target)
        {
            if (_currentDraggingSocket == null || target == null)
            {
                _currentDraggingSocket = null;
                drawer.CancelDrag();

                return;
            }
            //  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();
        }
Exemplo n.º 5
0
 public void Disconnect(SocketInput input, SocketOutput output)
 {
     connectedOutputs.Remove(output);
     OnDisconnectEvent?.Invoke(input, output);
 }
Exemplo n.º 6
0
 public void Connect(SocketInput input, SocketOutput output)
 {
     connectedOutputs.Add(output);
     OnConnectionEvent?.Invoke(input, output);
 }
Exemplo n.º 7
0
 public void Register(SocketOutput output)
 {
     output.Init(this);
     outputs.Add(output);
 }
Exemplo n.º 8
0
 public static void InvokeOutputSocketClick(SocketOutput output, PointerEventData eventData)
 {
     OutputSocketClickEvent?.Invoke(output, eventData);
 }
Exemplo n.º 9
0
 public static void InvokeSocketDragFrom(SocketOutput output)
 {
     OutputSocketDragStartEvent?.Invoke(output);
 }