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