private DialogueDatabase LoadOrCreateDatabase(string filename) { if (prefs.outputFolder.EndsWith("/")) { prefs.outputFolder = prefs.outputFolder.Substring(0, prefs.outputFolder.Length - 1); } string assetPath = string.Format("{0}/{1}.asset", prefs.outputFolder, filename); DialogueDatabase database = null; if (prefs.overwrite) { database = AssetDatabase.LoadAssetAtPath(assetPath, typeof(DialogueDatabase)) as DialogueDatabase; if (database != null) { database.Clear(); } } if (database == null) { assetPath = AssetDatabase.GenerateUniqueAssetPath(string.Format("{0}/{1}.asset", prefs.outputFolder, filename)); database = DatabaseUtility.CreateDialogueDatabaseInstance(); AssetDatabase.CreateAsset(database, assetPath); } return(database); }
private DialogueDatabase LoadOrCreateDatabase(string filename) { string assetPath = string.Format("{0}/{1}.asset", prefs.outputFolder, filename); DialogueDatabase database = null; if (prefs.overwrite) { database = AssetDatabase.LoadAssetAtPath(assetPath, typeof(DialogueDatabase)) as DialogueDatabase; if (database != null) { database.Clear(); } } if (database == null) { assetPath = AssetDatabase.GenerateUniqueAssetPath(string.Format("{0}/{1}.asset", prefs.outputFolder, filename)); database = ScriptableObject.CreateInstance <DialogueDatabase>(); AssetDatabase.CreateAsset(database, assetPath); } return(database); }
/// <summary> /// Loads the dialogue database if it already exists and overwrite is ticked; otherwise creates a new one. /// </summary> /// <returns> /// The database. /// </returns> /// <param name='filename'> /// Asset filename. /// </param> protected virtual DialogueDatabase LoadOrCreateDatabase() { string assetPath = string.Format("{0}/{1}.asset", prefs.outputFolder, prefs.databaseFilename); DialogueDatabase database = null; if (prefs.overwrite) { database = AssetDatabase.LoadAssetAtPath(assetPath, typeof(DialogueDatabase)) as DialogueDatabase; if ((database != null) && !prefs.merge) { database.Clear(); } } if (database == null) { assetPath = AssetDatabase.GenerateUniqueAssetPath(string.Format("{0}/{1}.asset", prefs.outputFolder, prefs.databaseFilename)); database = DatabaseUtility.CreateDialogueDatabaseInstance(); database.name = prefs.databaseFilename; AssetDatabase.CreateAsset(database, assetPath); } return(database); }
/// <summary> /// Removes all loaded databases from the master database and clears the Lua environment. /// </summary> public void Clear() { DialogueLua.InitializeChatMapperVariables(); m_masterDatabase.Clear(); m_loadedDatabases.Clear(); }