public void Draw() { if (points != null) { foreach (var point in points) { if (point.connectionType == ConnectionType.Output) { foreach (var input in point.Connections) { if (input.connectionType == ConnectionType.Input) { //var col = Color.Lerp(point.knobeColor, input.knobeColor, 0.5f); DrawConnectionBezier(FlowchartEditorWindow.GraphToScreenSpace(point.PointPos.center), FlowchartEditorWindow.GraphToScreenSpace(input.PointPos.center), point.knobeColor, input.knobeColor); } } } } } if (callPoints != null) { foreach (var point in callPoints) { if (point.connectionType == ConnectionType.Call) { foreach (var receive in point.connections) { if (receive.connectionType == ConnectionType.Receive) { //var col = Color.Lerp(point.knobeColor, input.knobeColor, 0.5f); DrawBezier(point.Point.center, receive.Point.center, point.knobeColor); } } } } } if (symboles != null) { DrawSymboles(); GUI.changed = true; } if (selectedOutputCallPoint) { DrawBezierPreview(few.InvGraphToScreenSpace(selectedOutputCallPoint.Point.center)); GUI.changed = true; } if (selectedOutputPoint) { DrawBezierPreview(selectedOutputPoint.PointPos.center); GUI.changed = true; } }
public void DrawBezierPreview(Vector2 knobeCenter) { DrawBezier(FlowchartEditorWindow.GraphToScreenSpace(knobeCenter), Event.current.mousePosition, Color.white); }
public void DrawSymboles() { int id = 0; if (selections != null && selections.Count > 0) { id = selections[0]; } for (int i = 0; i < symboles.Count; i++) { var area = symboles[i].NodeSize; area.position = FlowchartEditorWindow.GraphToScreenSpace(area.position); GUI.Box(area, symboles[i].name.AddWordSpace(), background); GUILayout.BeginArea(new Rect(area.position.x - 8, area.position.y + 35, area.width + 16, area.height - 35)); var r = EditorGUILayout.BeginVertical(); var lw = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 80; if (symboles[i].fieldPoints != null) { foreach (var point in symboles[i].fieldPoints) { point.Draw(); } } symboles[i].OnGUI(); EditorGUIUtility.labelWidth = lw; EditorGUILayout.EndVertical(); GUILayout.EndArea(); if (r.height > 0) { symboles[i].NodeSize.height = area.height = 43 + r.height; } if (symboles[i].shouldCall && symboles[i].Call) { symboles[i].Call.Draw(few.pOffset); } if (symboles[i].shouldReceive && symboles[i].Receive) { symboles[i].Receive.Draw(few.pOffset); } if (symboles[i] == selectedSymbole) { GUI.Box(area, "", highlighted); } } if (ShowThread) { time += Time.deltaTime; } for (int i = 0; i < symboles.Count; i++) { var area = symboles[i].NodeSize; area.position = FlowchartEditorWindow.GraphToScreenSpace(area.position); if (symboles[i].GetInstanceID() == id && ShowThread && time > Mathf.Clamp(UpdateTime, 0.4f, 0.6f)) { GUI.Box(area, "", highlighted); selections.Remove(id); time = 0; GUI.changed = true; } } }