예제 #1
0
 public static string[] OnWillSaveAssets(string[] paths)
 {
     //DialogueEditorWindow window = (DialogueEditorWindow)EditorWindow.GetWindow(typeof(DialogueEditorWindow));
     if (EditorWindow.focusedWindow != null)
     {
         if (EditorWindow.focusedWindow.titleContent == new GUIContent("Dialogue Editor") || EditorWindow.focusedWindow.titleContent == new GUIContent("Variable Editor") || EditorWindow.focusedWindow.titleContent == new GUIContent("Theme Editor"))
         {
             DialogueEditorDataManager.save();
             DialoguerEnumGenerator.GenerateDialoguesEnum();
         }
     }
     return(paths);
 }
예제 #2
0
        public static void save(string filename = "")
        {
            if (__data == null)
            {
                Debug.LogWarning("Dialoguer data has not been loaded, not saving.");
                return;
            }

            string outputFolderPath = @DialogueEditorFileStatics.ASSETS_FOLDER_PATH + "/" + DialogueEditorFileStatics.OUTPUT_FOLDER_PATH;

            if (!System.IO.Directory.Exists(outputFolderPath))
            {
                AssetDatabase.CreateFolder(DialogueEditorFileStatics.ASSETS_FOLDER_PATH, DialogueEditorFileStatics.OUTPUT_FOLDER_PATH);
                Debug.Log("Creating Dialoguer Output folder");
            }

            string resourcesFolderPath = @DialogueEditorFileStatics.ASSETS_FOLDER_PATH + "/" + DialogueEditorFileStatics.OUTPUT_FOLDER_PATH + "/" + DialogueEditorFileStatics.OUTPUT_RESOURCES_FOLDER_PATH;

            if (!System.IO.Directory.Exists(resourcesFolderPath))
            {
                AssetDatabase.CreateFolder(DialogueEditorFileStatics.ASSETS_FOLDER_PATH + "/" + DialogueEditorFileStatics.OUTPUT_FOLDER_PATH, DialogueEditorFileStatics.OUTPUT_RESOURCES_FOLDER_PATH);
                Debug.Log("Creating Dialoguer Resources folder");
            }

            //string path = @DialogueEditorFileStatics.PATH + DialogueEditorFileStatics.DIALOGUE_DATA_FILENAME_SO;
            string filePath = Application.dataPath + "/" + DialogueEditorFileStatics.PATH + DialogueEditorFileStatics.DIALOGUE_DATA_FILENAME_SO;

            //Debug.Log(filePath);
            if (!System.IO.File.Exists(filePath))
            {
                AssetDatabase.CreateAsset(__data, DialogueEditorFileStatics.ROOT_PATH + DialogueEditorFileStatics.DIALOGUE_DATA_FILENAME_SO);
            }

            if (data.generateEnum)
            {
                DialoguerEnumGenerator.GenerateDialoguesEnum();
            }

            EditorUtility.SetDirty(__data);
            //AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
    private void drawControls()
    {
        GUILayoutOption[] styles = new GUILayoutOption[1];
        styles[0] = GUILayout.MinHeight(25);

        // Editor
        //GUILayout.BeginArea(new Rect(10,180,(Screen.width*0.5f)-10, 1000));
        GUILayout.BeginArea(new Rect(10, 180, Screen.width - 20, 1000));
        //GUILayout.Label("Editor:", EditorStyles.boldLabel);
        if (GUILayout.Button("Open Dialogue Editor", styles))
        {
            DialogueEditorWindow.Init();
        }
        GUILayout.Space(10);

        if (GUILayout.Button("Force Load Dialogues", styles))
        {
            DialogueEditorDataManager.load();
        }
        GUILayout.Label("Reload the Dialogues object. Forces Dialoguer to reload all Dialoguer info.", EditorStyles.wordWrappedMiniLabel);
        GUILayout.Space(10);


        if (GUILayout.Button("Generate Dialogues Enum", styles))
        {
            DialoguerEnumGenerator.GenerateDialoguesEnum();
        }
        t.data.generateEnum = GUILayout.Toggle(t.data.generateEnum, "Automatically Generate Dialogues Enum", EditorStyles.toggleGroup);
        GUILayout.Label("Generate the DialoguerDialogues enum, used for starting Dialogues by name.", EditorStyles.wordWrappedMiniLabel);

        GUILayout.EndArea();


        // Help
        //GUILayout.BeginArea(new Rect(10 + (Screen.width*0.5f),180,(Screen.width*0.5f)-15, 1000));
        GUILayout.BeginArea(new Rect(10, 400, Screen.width - 20, 1000));
        GUILayout.Label("Help:", EditorStyles.boldLabel);
        if (GUILayout.Button("Dialoguer Website", styles))
        {
            DialogueEditorHelp.Website();
        }
        if (GUILayout.Button("Getting Started", styles))
        {
            DialogueEditorHelp.GettingStarted();
        }
        if (GUILayout.Button("Nodes", styles))
        {
            DialogueEditorHelp.Nodes();
        }
        if (GUILayout.Button("Code Documentation", styles))
        {
            DialogueEditorHelp.Code();
        }
        if (GUILayout.Button("Frequently Asked Questions", styles))
        {
            DialogueEditorHelp.Faq();
        }
        if (GUILayout.Button("Contact/Feedback", styles))
        {
            DialogueEditorHelp.Contact();
        }
        GUILayout.EndArea();
    }