public void DrawGraphGUI() { if (stateMachineGraphGUI != null) { stateMachineGraphGUI.BeginGraphGUI(this, new Rect(0, 0, this.position.width, this.position.height)); //stateMachineGraphGUI.OnGraphGUI (); stateMachineGraphGUI.EndGraphGUI(); } }
private void OnGUI() { if (_graphGuiEditor == null) { return; } var width = position.width; var height = position.height; // Main graph area _graphGuiEditor.BeginGraphGUI(this, new Rect(0, 0, width, height - _barHeight)); _graphGuiEditor.OnGraphGUI(); _graphGuiEditor.EndGraphGUI(); }
private void OnGUI() { //左側ツールチップ using (new EditorGUILayout.VerticalScope()) { GUILayout.BeginArea(new Rect(0, 0, 200, 500)); if (GUILayout.Button("Save")) { Save(); } if (GUILayout.Button("Load")) { Load(); } if (GUILayout.Button("Export")) { Export(); } if (GUILayout.Button("CreateNode")) { EditorNode editorNode = new EditorNode(); editorNode.nodeDrawer = new SkillTreeEditorNodeDrawer(); nodes.Add(editorNode); } GUILayout.EndArea(); } //右側 ツリー構造 if (window && stateMachineGraphGUI != null) { stateMachineGraphGUI.BeginGraphGUI(window, new Rect(200, 0, window.position.width, window.position.height)); var ev = Event.current; //stateMachineGraphGUI.OnGraphGUI(); BeginWindows(); //データの中にある描画用クラスで描画 for (int i = 0; i < nodes.Count; i++) { Color color = Color.gray; //選択されている場合は色を変更 if (nodes[i] == currentEventTarget) { color = Color.red; } //データは今は仮 nodes[i].nodeDrawer.DrawWindow(i, "aaaaaa", "aaaaa", color); //右クリックイベントでマウスイベントがおきてなければ if (nodes[i].nodeDrawer.mousebutton == 1 && currentMouseEvent == MouseEvent.None) { //選択オブジェクトセット currentEventTarget = nodes[i]; } //メニューイベントを実行 if (ActionMenuEvent(nodes[i], nodes[i].nodeDrawer.mousebutton, ev)) { //trueなら実行なのでcurrent系をリセット currentMenuEvent = MenuEvent.None; currentMouseEvent = MouseEvent.None; currentEventTarget = null; } } //マウスイベント実行 ActionMouseEvent(ev); EndWindows(); //親子関係描画 DrawLine(); stateMachineGraphGUI.EndGraphGUI(); } }