public void ClearConnectsWith(ConnectionInPoint point) { for (int i = 0; i < Nodes.Count; i++) { ClearList(Nodes[i].OutPoints, point); } }
public static void DrawConnectionPoint(ConnectionInPoint point, int index, float spacing, Action <ConnectionInPoint> onClickPoint, Action <ConnectionInPoint> onRemove) { if (!_setup) { Init(); } var height = (point.Owner.Rect.height * ((index + 1) * spacing)); point.Rect.y = point.Owner.Rect.y + height - point.Rect.height * 0.5f; point.Rect.x = point.Owner.Rect.x - point.Rect.width + 8f; if (GUI.Button(point.Rect, "", _inPointStyle)) { onClickPoint?.Invoke(point); } var labelRect = new Rect(point.Rect); GUI.Label(labelRect, " " + index.ToString(), _nodeTextStyle); var buttonRect = new Rect(point.Rect); if (point.Owner.InPoints.Count <= point.Owner.InputMin) { return; } buttonRect.x += point.Rect.width + 1; if (GUI.Button(buttonRect, "-", _nodeTextStyle)) { onRemove?.Invoke(point); } }
private void ClearList(List <ConnectionOutPoint> points, ConnectionInPoint pnt) { for (int c = 0; c < points.Count; c++) { if (points[c].TargetId == pnt.Id && points[c].Target == pnt.Owner) { points[c].Target = null; points[c].TargetId = -1; } } }
private void RemoveConnectionPoint(ConnectionInPoint point) { _graph.ClearConnectsWith(point); // for (int i = _graph.Connections.Count - 1; i >= 0; i--) { // if (_graph.Connections[i].GetIn() == point || _graph.Connections[i].GetOut() == point) { // _graph.Connections.RemoveAt(i); // } // } point.Owner.InPoints.Remove(point); EditorUtility.SetDirty(point.Owner); }
private void OnClickInPoint(ConnectionInPoint inPoint) { _selectedInPoint = inPoint; if (_selectedOutPoint != null) { if (_selectedOutPoint.Owner != _selectedInPoint.Owner) { CreateConnection(); ClearConnectionSelection(); } else { ClearConnectionSelection(); } } }
private void ClearConnectionSelection() { _selectedInPoint = null; _selectedOutPoint = null; }