Example #1
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);
        }
        public static LocalizationItemGroup Create(LocalizationDatabase database = null, string tag = "Unnamed Group")
        {
            LocalizationItemGroup created = ScriptableObject.CreateInstance <LocalizationItemGroup>();

            created.groupID     = tag;
            created.storedItems = new List <LocalizationObjectItem>();
            created.database    = database;
            if (database != null)
            {
                if (database.entryGroupList.Count > 0)
                {
                    while (database.entryGroupList.Any(e => e.groupID == created.groupID))
                    {
                        created.groupID += "*";
                    }
                }
                database.entryGroupList.Add(created);
                AssetDatabase.AddObjectToAsset(created, database);
                created.hideFlags = HideFlags.HideInHierarchy;
            }


            return(created);
        }
Example #3
0
        void LoadDatabase(LocalizationDatabase database)
        {
            if (database == null)
            {
                Debug.LogError("LoadDatabase():: The passed in database object is null!");
                return;
            }
            if (database == databaseCache)
            {
                return;
            }
            SaveDatabase();
            UnloadItemGroup();
            databaseCache = database;
            SyncDatabaseConfig();
            DrawHeaderBuffer = DrawHeader_Normal;
            ItemCountCache   = databaseCache.ItemCount;

            CacheSupportingTypes();

            GUI.FocusControl("0");
            databaseCacheBuffer = null;
            Repaint();
        }
Example #4
0
 void CopyDatabase()
 {
     LocalizationDatabase newDatabase = databaseCache.CopyAs(databaseCache.name + "(Copy)");
 }