예제 #1
0
 //  event handlers
 private void OnInputSocketClicked(SocketInput input, PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Right)
     {
         connections.Where(conn => conn.input == input)
         .ToList()
         .ForEach(conn => Disconnect(conn));
     }
 }
예제 #2
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);
        }
예제 #3
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();
        }
예제 #4
0
 public void Connect(SocketInput input, SocketOutput output)
 {
     connectedOutputs.Add(output);
     OnConnectionEvent?.Invoke(input, output);
 }
예제 #5
0
 public void Disconnect(SocketInput input, SocketOutput output)
 {
     connectedOutputs.Remove(output);
     OnDisconnectEvent?.Invoke(input, output);
 }
예제 #6
0
 public void Register(SocketInput input)
 {
     input.Init(this);
     inputs.Add(input);
 }
        public void OnDisconnect(SocketInput input, IOutput output)
        {
            output.ValueUpdated -= OnConnectedValueUpdated;

            OnConnectedValueUpdated();
        }
        public void OnConnection(SocketInput input, IOutput output)
        {
            output.ValueUpdated += OnConnectedValueUpdated;

            OnConnectedValueUpdated();
        }
예제 #9
0
 public static void InvokeInputSocketClick(SocketInput input, PointerEventData eventData)
 {
     InputSocketClickEvent?.Invoke(input, eventData);
 }
예제 #10
0
 public static void InvokeOutputSocketDragDropTo(SocketInput input)
 {
     OutputSocketDragDrop?.Invoke(input);
 }