Ejemplo n.º 1
0
        void DeleteAll()
        {
            IEnumerable <string> keys = FilterPlayerPrefByRegexs().Select(pref => pref.Key);

            if (EditorUtility.DisplayDialog("Delet All", $"Do you want to delete {keys.Count()} prefs?", "Delete", "Cancel"))
            {
                foreach (var key in keys)
                {
                    PlayerPrefs.DeleteKey(key);
                }

                OnionDataEditorWindow.RebuildNode();

                OnionDataEditorWindow.ShowNotification(new GUIContent($"There are {keys.Count()} prefs been deleted."), 1F);
            }
        }
        void Save()
        {
            string assetPath = AssetDatabase.GetAssetPath(textAsset).Substring("Asset/".Length);

            string projectPath = Application.dataPath;

            string path = $"{projectPath}{assetPath}";

            try
            {
                File.WriteAllText(path, editingContent, Encoding.UTF8);

                EditorUtility.SetDirty(textAsset);
                AssetDatabase.Refresh();

                OnionDataEditorWindow.ShowNotification(new GUIContent("Saved Success!"), 0.5F);
            }
            catch (System.Exception e)
            {
                Debug.LogError(e.Message);
            }
        }