void DrawMasterFileHeader() { EditorGUILayout.LabelField("Master File", EditorStyles.boldLabel); if (!InkSettings.Instance.compileAutomatically) { inkFile.compileAutomatically = EditorGUILayout.Toggle("Compile Automatially", inkFile.compileAutomatically); EditorApplication.RepaintProjectWindow(); } EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField("JSON Asset", inkFile.jsonAsset, typeof(TextAsset), false); EditorGUI.EndDisabledGroup(); if (inkFile.jsonAsset != null && inkFile.metaInfo.errors.Count == 0 && GUILayout.Button("Play")) { InkPlayerWindow.LoadAndPlay(inkFile.jsonAsset); } // if(!checkedStoryForErrors) { // if(GUILayout.Button("Check for errors")) { // GetStoryErrors(); // } // } else { // if(exception != null) { // EditorGUILayout.HelpBox("Story is invalid\n"+exception.ToString(), MessageType.Error); // } else { // EditorGUILayout.HelpBox("Story is valid", MessageType.Info); // } // } }
void DrawMasterFileHeader() { if (inkFile.isMaster) { EditorGUILayout.LabelField("Master File", EditorStyles.boldLabel); } if (!inkFile.isMaster) { EditorGUILayout.LabelField("Include treated as Master", EditorStyles.boldLabel); } if (!InkSettings.instance.compileAllFilesAutomatically) { EditorGUI.BeginChangeCheck(); var newCompileAutomatically = EditorGUILayout.Toggle(new GUIContent("Compile Automatially", "If true, this file recompiles automatically when any changes are detected."), InkSettings.instance.ShouldCompileInkFileAutomatically(inkFile)); if (EditorGUI.EndChangeCheck()) { if (newCompileAutomatically) { InkSettings.instance.filesToCompileAutomatically.Add(inkFile.inkAsset); EditorUtility.SetDirty(InkSettings.instance); } else { InkSettings.instance.filesToCompileAutomatically.Remove(inkFile.inkAsset); EditorUtility.SetDirty(InkSettings.instance); } } EditorApplication.RepaintProjectWindow(); } EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField("JSON Asset", inkFile.jsonAsset, typeof(TextAsset), false); EditorGUI.EndDisabledGroup(); if (inkFile.jsonAsset != null && inkFile.errors.Count == 0 && GUILayout.Button("Play")) { InkPlayerWindow.LoadAndPlay(inkFile.jsonAsset); } // if(!checkedStoryForErrors) { // if(GUILayout.Button("Check for errors")) { // GetStoryErrors(); // } // } else { // if(exception != null) { // EditorGUILayout.HelpBox("Story is invalid\n"+exception.ToString(), MessageType.Error); // } else { // EditorGUILayout.HelpBox("Story is valid", MessageType.Info); // } // } }
public override void OnInspectorGUI() { serializedObject.Update(); if (inkFile == null) { return; } InkFile masterInkFile = inkFile; if (inkFile.master == null) { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField("JSON Asset", inkFile.jsonAsset, typeof(TextAsset), false); EditorGUI.EndDisabledGroup(); if (GUILayout.Button("Play")) { InkPlayerWindow.LoadAndPlay(inkFile.jsonAsset); } if (includesFileList != null) { includesFileList.DoLayoutList(); } } else { masterInkFile = inkFile.master; EditorGUILayout.HelpBox("This file is included by a master file.", MessageType.Info); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField("Master Ink File", masterInkFile.inkFile, typeof(Object), false); EditorGUI.EndDisabledGroup(); } DateTime lastEditDate = File.GetLastWriteTime(inkFile.absoluteFilePath); EditorGUILayout.LabelField("Last edit date " + lastEditDate.ToString()); if (masterInkFile.jsonAsset == null) { EditorGUILayout.HelpBox("Ink file has not been compiled", MessageType.Info); if (GUILayout.Button("Compile")) { InkCompiler.CompileInk(masterInkFile); } } else { DateTime lastCompileDate = File.GetLastWriteTime(Path.Combine(Application.dataPath, AssetDatabase.GetAssetPath(masterInkFile.jsonAsset).Substring(7))); EditorGUILayout.LabelField("Last compile date " + lastCompileDate.ToString()); if (lastEditDate > lastCompileDate && GUILayout.Button("Recompile")) { InkCompiler.CompileInk(masterInkFile); } if (exception != null) { EditorGUILayout.HelpBox("Story is invalid\n" + exception.ToString(), MessageType.Error); } } if (todosList != null) { todosList.DoLayoutList(); } DrawFileContents(); serializedObject.ApplyModifiedProperties(); }