void OnGUI() { // initialize node editor if (nodeEditor == null) { nodeEditor = NodeEditor.GetOrCreateNodeEditor(name); } nodeEditor.DrawBackground(); nodeEditor.DrawGrid(); if (GUILayout.Button("Reload", GUILayout.Width(100))) { nodeEditor.Load(); } showDebug = GUILayout.Toggle(showDebug, "Show debug info"); if (showDebug) { nodeEditor.DrawDebug(); } // draw nodes nodeEditor.DrawNodeWindows(); nodeEditor.DrawMinimap(); }
void OnGUI() { // initialize node editor if (nodeEditor == null) { nodeEditor = NodeEditor.GetOrCreateNodeEditor(GetNodeEditorName(), GetMenuNodeType()); } nodeEditor.DrawBackground(); nodeEditor.DrawGrid(); nodeEditor.DrawDebug(); // editor requires BeginWindows EndWindows to render GUI.Window BeginWindows(); nodeEditor.DrawNodeWindows(); EndWindows(); nodeEditor.DrawMinimap(); // draw load/save GUI GUILayout.BeginArea(new Rect(Screen.width - 220, 10, 200, Screen.height - 50)); string path = Serialization.GetFullResourcesPath(nodeEditor.saveLoadResourcesFolderName); string fileExtension = ".txt"; DirectoryInfo dir = new DirectoryInfo(path); List <string> fileNames = dir.GetFiles("*" + fileExtension) .OrderByDescending(f => f.LastWriteTime) .Select(f => f.Name.Substring(0, f.Name.Length - fileExtension.Length)) .ToList(); saveLoadGUI.currentName = nodeEditor.saveLoadName; saveLoadGUI.fileNames = fileNames; saveLoadGUI.onLoad = (string name) => { nodeEditor.Load(name); nodeEditor.saveLoadName = name; saveLoadGUI.saveLoadName = name; }; saveLoadGUI.onSave = (string name) => { // isShouldSaveDialogue = File.Exists (filePath) != false; nodeEditor.Save(name); nodeEditor.saveLoadName = name; }; saveLoadGUI.OnGUI(); GUILayout.EndArea(); }