Exemplo n.º 1
0
        public LocalizationDatabase CopyAs(string databaseName)
        {
            string path = AssetDatabase.GetAssetPath(this);

            path  = path.Substring(0, path.LastIndexOf("/") + 1);
            path += databaseName + ".asset";
            if (System.IO.File.Exists(path))
            {
                EditorUtility.DisplayDialog("File existed", "A database called " + databaseName + " exist, try again after you rename/delete it", "OK");
                return(null);
            }

            LocalizationDatabase newDatabase = LocalizationDatabase.Create();

            AssetDatabase.CreateAsset(newDatabase, path);

            for (int i = 0; i < entryGroupList.Count; i++)
            {
                entryGroupList[i].CloneTo(newDatabase);
            }

            EditorUtility.SetDirty(newDatabase);
            AssetDatabase.SaveAssets();

            return(newDatabase);
        }
Exemplo n.º 2
0
        LocalizationDatabase CreateNewDatabase()
        {
            if (!Directory.Exists(editorConfig.SavePath))
            {
                Directory.CreateDirectory(editorConfig.SavePath);
            }
            if (File.Exists(editorConfig.SavePath + editorConfig.defaultDatabaseName))
            {
                EditorUtility.DisplayDialog("File existed", "A database called Unnamed exist, try again after you rename/delete it", "OK");
                return(null);
            }
            LocalizationDatabase newDatabase = LocalizationDatabase.Create();

            AssetDatabase.CreateAsset(newDatabase, editorConfig.SavePath + editorConfig.defaultDatabaseName);
            SaveDatabase();
            OnDatabaseCreated();
            return(newDatabase);
        }