public override void DrawView(Rect editorRect, Rect PercentRect, Event e, NodeGraph graph) { base.DrawView(editorRect, PercentRect, e, graph); // reposition to fit on screen float dy = window.position.height - (body.height + body.y); if (dy < 0) { body.y += dy; } float dx = window.position.width - (body.width + body.x); if (dx < 0) { body.x += dx; } ProcessEvents(e); Vector2 margin = new Vector2(6, 12); size = new Vector2(200, 100); //Rect viewRect = new Rect(0, 0, body.width, body.height); //Rect ctrlRect = new Rect(x,y, ctrlWidth, ctrlHeight); try { GUI.Box(body, "", skin.GetStyle("NodeCreationBackground")); GUILayout.BeginArea(new Rect(body.x + margin.x, body.y + margin.y, body.width - 2 * margin.x, body.height - 2 * margin.y)); scrollPos = GUILayout.BeginScrollView(scrollPos, false, true); EditorGUILayout.BeginVertical(); { if (showDialogues = EditorGUILayout.Foldout(showDialogues, "Dialogue")) { //Debug.Log("In my sack"); foreach (ControlNode.ControlType cT in ControlNode.dialogControls) { if (size.y < 400) { size.y += 10; } if (GUILayout.Button(cT.ToString(), skin.GetStyle("NodeCreationButton"))) { CreateNode(graph, NodeType.Control, VarType.Exec, cT); } } } if (showControls = EditorGUILayout.Foldout(showControls, "Controls")) { foreach (ControlNode.ControlType cT in cTypes) { if (ControlNode.dialogControls.Contains(cT)) { continue; } if (size.y < 400) { size.y += 10; } if (cT != ControlNode.ControlType.Custom && GUILayout.Button(cT.ToString(), skin.GetStyle("NodeCreationButton"))) { if (cT == ControlNode.ControlType.Cast) { NodeCreatePopup.Init(NodeType.Control, cT, pinToAttach, mouseLoc); Destroy(true); } else { CreateNode(graph, NodeType.Control, VarType.Exec, cT); } } } if (GUILayout.Button("Sub Start", skin.GetStyle("NodeCreationButton"))) { CreateNode(graph, NodeType.Event, VarType.Object, "New SubStart"); } //if (GUILayout.Button("End", skin.GetStyle("NodeCreationButton"))) { // CreateNode(graph, NodeType.Event, VarType.Object, true); //} } if (showMath = EditorGUILayout.Foldout(showMath, "Math")) { foreach (MathNode.OpType op in ops) { if (size.y < 400) { size.y += 10; } if (GUILayout.Button(op.ToString(), skin.GetStyle("NodeCreationButton"))) { // create math FunctionNode MathNode mn = new MathNode(); mn.Initialize(); mn.Construct(op, VarType.Float, 2); NodeCreatePopup.Init(NodeType.Math, op, pinToAttach, mouseLoc, mn.multiplePins ? -1 : 2); Destroy(true); } } } if (showFunc = EditorGUILayout.Foldout(showFunc, "Functions")) { foreach (FunctionNode.FunctionType cT in fTypes) { if (size.y < 400) { size.y += 10; } if (GUILayout.Button(cT.ToString(), skin.GetStyle("NodeCreationButton"))) { CreateNode(graph, NodeType.Function, VarType.Object, cT); } } } } EditorGUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); } catch { GUILayout.EndArea(); } }