public bool OnCallPointSelected(ConnectionCallPoint point) { var e = Event.current; symboleManager.OnMouseOverInputCallPoint(e.mousePosition); switch (e.type) { case EventType.MouseUp: if (symboleManager.selectedInputCallPoint) { if (point.symbole != symboleManager.selectedInputCallPoint.symbole && symboleManager.selectedInputCallPoint.Point.Contains(e.mousePosition)) { point.AddConnection(symboleManager.selectedInputCallPoint); symboleManager.selectedInputCallPoint.AddConnection(point); if (SymboleManager.selections != null && SymboleManager.selections.Count > 0) { SymboleManager.selections.Clear(); } } } symboleManager.selectedInputCallPoint = null; symboleManager.selectedOutputCallPoint = null; break; } if (point.Point.Contains(e.mousePosition) && e.mousePosition.y > 18) { return(true); } return(false); }
public bool OnMouseOverPoint_Symbole(Vector2 mousePosition) { if (OnMouseOverInputCallPoint(mousePosition) && !selectedOutputCallPoint) { selectedInputCallPoint.RemoveConnections(); selectedInputCallPoint = null; } if (OnMouseOverOutputCallPoint(mousePosition)) { return(true); } if (OnMouseOverInputPoint(mousePosition) && !selectedOutputPoint) { selectedInputPoint.RemoveConnections(); selectedInputPoint = null; } if (OnMouseOverOutputPoint(mousePosition)) { return(true); } if (!selectedOutputPoint && !selectedOutputCallPoint) { if (OnMouseOverSymbole(mousePosition)) { return(true); } } return(false); }
private bool OnMouseOverOutputCallPoint(Vector2 mousePosition) { //mousePosition = few.InvGraphToScreenSpace(mousePosition); if (callPoints != null) { selectedInputPoint = null; for (int i = callPoints.Count - 1; i > -1; i--) { if (callPoints[i].connectionType == ConnectionType.Receive) { continue; } var area = callPoints[i].Point; if (area.Contains(mousePosition)) { selectedOutputCallPoint = callPoints[i]; break; } } if (selectedOutputCallPoint) { MoveSelectedTotop(selectedOutputCallPoint.symbole); return(true); } } return(false); }
public void AddCallPoint(ConnectionCallPoint callPoint) { if (callPoints == null) { callPoints = new List <ConnectionCallPoint>(); } callPoints.Add(callPoint); }
public void OnClickRemoveAllNode() { if (selections != null && selections.Count > 0) { selections.Clear(); } selectedSymbole = null; selectedInputPoint = null; selectedOutputPoint = null; selectedInputCallPoint = null; selectedOutputCallPoint = null; if (RemovedCP != null) { foreach (var remove in RemovedCP) { AssetDatabase.RemoveObjectFromAsset(remove); } } if (RemovedCCP != null) { foreach (var remove in RemovedCCP) { AssetDatabase.RemoveObjectFromAsset(remove); } } if (RemovedS != null) { foreach (var remove in RemovedS) { Debug.Log(remove.name); if (remove.shouldCall && remove.Call) { AssetDatabase.RemoveObjectFromAsset(remove.Call); } AssetDatabase.RemoveObjectFromAsset(remove); } } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); RemovedCP = points; RemovedCCP = callPoints; RemovedS = symboles; if (symboles != null) { symboles = null; } if (points != null) { points = null; } if (callPoints != null) { callPoints = null; } Selection.activeObject = null; }
public bool OnMouseOverInputCallPoint(Vector2 mousePosition) { //mousePosition = few.InvGraphToScreenSpace(mousePosition); if (callPoints != null) { selectedInputPoint = null; for (int i = callPoints.Count - 1; i > -1; i--) { if (callPoints[i].connectionType == ConnectionType.Call) { continue; } var area = callPoints[i].Point; if (area.Contains(mousePosition)) { selectedInputCallPoint = callPoints[i]; //callback(symboles[i]); return(true); } } } return(false); }
public void OnClickRestoreAllNodes() { selectedSymbole = null; selectedInputPoint = null; selectedOutputPoint = null; selectedInputCallPoint = null; selectedOutputCallPoint = null; points = RemovedCP; callPoints = RemovedCCP; symboles = RemovedS; if (RemovedS != null) { RemovedS = null; } if (RemovedCP != null) { RemovedCP = null; } if (RemovedCCP != null) { RemovedCCP = null; } Selection.activeObject = null; }
public void InitializeAttributes() { Type type = this.GetType(); if (name == string.Empty) { name = type.Name; } if (type.GetCustomAttribute(typeof(ReceivableAttribute)) != null) { shouldReceive = true; Receive = CreateInstance <ConnectionCallPoint>(); Receive.Init(this, ConnectionType.Receive); Receive.name = name + "Receive"; SymboleManager.AddCallStatic(Receive); } if (type.GetCustomAttribute(typeof(CallableAttribute)) != null) { shouldCall = true; Call = CreateInstance <ConnectionCallPoint>(); Call.Init(this, ConnectionType.Call); Call.name = name + "Receive"; SymboleManager.AddCallStatic(Call); } var fields = type.GetFields(); foreach (var field in fields) { if (field.GetCustomAttribute(typeof(IgnoreAttribute)) != null) { continue; } var attri = field.GetCustomAttribute(typeof(PointAttribute)); if (attri != null) { //var attri = attris[0]; var cp = CreateInstance <ConnectionPoint>(); cp.Init(this, field, (PointAttribute)attri); if (fieldPoints == null) { fieldPoints = new List <ConnectionPoint>(); } if (cp.connectionType == ConnectionType.Output) { NoOutput = false; } fieldPoints.Add(cp); SymboleManager.AddSymboleStatic(cp); } else { if (field.IsPublic && !field.IsStatic && field.Name != "NodeSize" && field.Name != "fieldPoints" && field.Name != "NoOutput" && field.Name != "shouldCall" && field.Name != "shouldReceive") { if (childFields == null) { childFields = new List <Field>(); } if (field.GetCustomAttribute(typeof(VariableEnumAttribute)) != null) { childFields.Add(new Field(field.Name, field, true)); } else if (field.GetCustomAttribute(typeof(EnumLableAttribute)) != null) { childFields.Add(new Field(field.Name, field, isEnumLable: true)); } else { childFields.Add(new Field(field.Name, field, false)); } } } } Init(); }
public bool RemoveConnection(ConnectionCallPoint connectionCallPoint) { return(connections.Remove(connectionCallPoint)); }
public void AddConnection(ConnectionCallPoint connectionCallPoint) { connections.Add(connectionCallPoint); }
public static void AddCallStatic(ConnectionCallPoint callPoint) { actionAddCallPoint(callPoint); }