Esempio n. 1
0
        /// <summary>
        /// Converts the source into a dialogue database. This method does housekeeping such
        /// as creating the empty asset and saving it at the end, but the main work is
        /// done in the CopySourceToDialogueDatabase() method that you must implement.
        /// </summary>
        protected virtual void Convert()
        {
            DialogueDatabase database = LoadOrCreateDatabase();

            if (database == null)
            {
                Debug.LogError(string.Format("{0}: Couldn't create asset '{1}'.", DialogueDebug.Prefix, prefs.databaseFilename));
            }
            else
            {
                if (template == null)
                {
                    template = TemplateTools.LoadFromEditorPrefs();
                }
                CopySourceToDialogueDatabase(database);
                TouchUpDialogueDatabase(database);
                EditorUtility.SetDirty(database);
                AssetDatabase.SaveAssets();
                Debug.Log(string.Format("{0}: Created database '{1}' containing {2} actors, {3} conversations, {4} items/quests, {5} variables, and {6} locations.",
                                        DialogueDebug.Prefix, prefs.databaseFilename, database.actors.Count, database.conversations.Count, database.items.Count, database.variables.Count, database.locations.Count), database);
                if (prefs.overwrite && DialogueEditor.DialogueEditorWindow.instance != null)
                {
                    DialogueEditor.DialogueEditorWindow.instance.Reset();
                }
            }
        }
Esempio n. 2
0
        public static DialogueDatabase CreateDialogueDatabaseInstance()
        {
            Template template    = TemplateTools.LoadFromEditorPrefs();
            var      wrapperType = TypeUtility.GetWrapperType(typeof(DialogueDatabase)) ?? typeof(DialogueDatabase);
            var      database    = ScriptableObjectUtility.CreateScriptableObject(wrapperType) as DialogueDatabase;

            database.actors.Add(template.CreateActor(1, "Player", true));
            database.variables.Add(template.CreateVariable(1, "Alert", string.Empty));
            database.ResetEmphasisSettings();
            return(database);
        }