Пример #1
0
        /// <summary> Resets the database to the default values </summary>
        public bool ResetDatabase()
        {
#if UNITY_EDITOR
            if (!EditorUtility.DisplayDialog(UILabels.ResetDatabase,
                                             UILabels.AreYouSureYouWantToResetDatabase +
                                             "\n\n" +
                                             UILabels.OperationCannotBeUndone,
                                             UILabels.Yes,
                                             UILabels.No))
            {
                return(false);
            }

            for (int i = Popups.Count - 1; i >= 0; i--)
            {
                UIPopupLink link = Popups[i];
                Popups.Remove(link);
                DoozyUtils.MoveAssetToTrash(AssetDatabase.GetAssetPath(link));
            }

            UpdateListOfPopupNames();
            SetDirty(true);
            DDebug.Log(UILabels.DatabaseHasBeenReset);
#endif
            return(true);
        }
Пример #2
0
        /// <summary> Deletes a reference from the database. Returns TRUE if the operation was successful </summary>
        /// <param name="reference"> Target link to be deleted </param>
        public bool DeletePopupLink(UIPopupLink reference)
        {
            if (reference == null || !Popups.Contains(reference))
            {
                return(false);                                                  //sanity check
            }
#if UNITY_EDITOR
            string popupName = reference.PopupName;
            if (!EditorUtility.DisplayDialog(UILabels.DeletePopupReference + " '" + popupName + "'",
                                             UILabels.AreYouSureYouWantToDeletePopupReference +
                                             "\n\n" +
                                             UILabels.OperationCannotBeUndone,
                                             UILabels.Yes,
                                             UILabels.No))
            {
                return(false);
            }

            Popups.Remove(reference);
            DoozyUtils.MoveAssetToTrash(AssetDatabase.GetAssetPath(reference));
            UpdateListOfPopupNames();
            SetDirty(false);
#endif
            return(true);
        }
Пример #3
0
        /// <summary> Removes the given ListOfNames reference from the database and also deletes its corresponding asset file. Returns TRUE if the operation was successful </summary>
        /// <param name="category"> Target category to be deleted </param>
        public bool DeleteCategory(ListOfNames category)
        {
            if (category == null)
            {
                return(false);
            }

#if UNITY_EDITOR
            if (!EditorUtility.DisplayDialog(UILabels.Delete + " '" + category.CategoryName + "'",
                                             UILabels.AreYouSureYouWantToDeleteDatabase +
                                             "\n\n" +
                                             UILabels.OperationCannotBeUndone,
                                             UILabels.Yes,
                                             UILabels.No))
            {
                return(false);
            }

            Categories.Remove(category);
            DoozyUtils.MoveAssetToTrash(AssetDatabase.GetAssetPath(category));
            UpdateListOfCategoryNames();
            SetDirty(false);
#endif
            return(true);
        }
Пример #4
0
        /// <summary> Resets the database to the default values </summary>
        public bool ResetDatabase()
        {
#if UNITY_EDITOR
            if (!DoozyUtils.DisplayDialog(UILabels.ResetDatabase,
                                          UILabels.AreYouSureYouWantToResetDatabase +
                                          "\n\n" +
                                          UILabels.OperationCannotBeUndone,
                                          UILabels.Yes,
                                          UILabels.No))
            {
                return(false);
            }

            for (int i = Categories.Count - 1; i >= 0; i--)
            {
                ListOfNames category = Categories[i];
                Categories.Remove(category);
                DoozyUtils.MoveAssetToTrash(AssetDatabase.GetAssetPath(category));
            }

            UpdateListOfCategoryNames();
            AddDefaultCategories(true);
            DDebug.Log(UILabels.DatabaseHasBeenReset);
#endif
            return(true);
        }
        /// <summary> Reset the database to the default values </summary>
        public bool ResetDatabase()
        {
#if UNITY_EDITOR
            if (!DoozyUtils.DisplayDialog(UILabels.ResetDatabase,
                                          UILabels.AreYouSureYouWantToResetDatabase +
                                          "\n\n" +
                                          UILabels.OperationCannotBeUndone,
                                          UILabels.Yes,
                                          UILabels.No))
            {
                return(false);
            }

            for (int i = Themes.Count - 1; i >= 0; i--)
            {
                ThemeData themeData = Themes[i];
                Themes.Remove(themeData);
                DataUtils.PlayerPrefsDeleteKey(themeData.Id.ToString());
                DoozyUtils.MoveAssetToTrash(AssetDatabase.GetAssetPath(themeData));
            }

            Initialize();
            DDebug.Log(UILabels.DatabaseHasBeenReset);
#endif
            return(true);
        }