public override void OnGUI(int WindowID) { GUILayout.BeginVertical(); List <string> fileList = FileManager.LoadFiles(); string selectedFile = ""; GUILayout.Label("Dialogs Menu:"); SelectedDialogIndex = EditorGUILayout.Popup("Select dialog: ", SelectedDialogIndex, fileList.ToArray()); if (fileList.Count != 0) { selectedFile = fileList[SelectedDialogIndex]; } GUILayout.BeginHorizontal(); if (GUILayout.Button("New")) { db.AddNode(db.GetLoadedNodeKey(typeof(NewDialog))); } if (String.IsNullOrEmpty(firstNode) || HasLoadedDialog == false) { GUI.enabled = false; } if (GUILayout.Button("Save")) { db.Save(selectedFile); } GUI.enabled = true; if (String.IsNullOrEmpty(selectedFile)) { GUI.enabled = false; } if (GUILayout.Button("Load")) { db.Load(selectedFile); } GUI.enabled = true; if (selectedFile == "") { GUI.enabled = false; } if (GUILayout.Button("Delete")) { bool unloadDialog = false; if (selectedFile == this.LoadedFile) { unloadDialog = true; } db.Delete(selectedFile, unloadDialog); } GUI.enabled = true; GUILayout.EndHorizontal(); if (HasLoadedDialog == false) { EditorGUILayout.HelpBox("There's no loaded dialog to be saved. Create a new one or load a dialog.", MessageType.Error); } else if (String.IsNullOrEmpty(firstNode)) { EditorGUILayout.HelpBox("You must declare an initial node before saving the dialog.", MessageType.Error); } GUILayout.Label("Add new nodes:"); Dictionary <int, string> publicNodeList = db.GetPublicNodeList(); int[] publicNodeKeyList = publicNodeList.Keys.ToArray(); SelectedNodeType = EditorGUILayout.IntPopup("Select node type: ", SelectedNodeType, publicNodeList.Values.ToArray(), publicNodeKeyList); if (GUILayout.Button("Add Node")) { newNode(SelectedNodeType); } GUILayout.EndVertical(); GUI.DragWindow(); }