// 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)); } }
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); }
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(); }
public void Connect(SocketInput input, SocketOutput output) { connectedOutputs.Add(output); OnConnectionEvent?.Invoke(input, output); }
public void Disconnect(SocketInput input, SocketOutput output) { connectedOutputs.Remove(output); OnDisconnectEvent?.Invoke(input, output); }
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(); }
public static void InvokeInputSocketClick(SocketInput input, PointerEventData eventData) { InputSocketClickEvent?.Invoke(input, eventData); }
public static void InvokeOutputSocketDragDropTo(SocketInput input) { OutputSocketDragDrop?.Invoke(input); }