void OnGUI()
        {
            if (_optionNames == null)
            {
                _optionNames = Enum.GetNames(typeof(Options));
            }

            _settings.Filename = EditorGUILayout.TextField("Target file", _settings.Filename).Trim();
            if (string.IsNullOrEmpty(_settings.Filename))
            {
                _settings.Filename = DefaultFilename;
            }
            _settings.Namespace = EditorGUILayout.TextField("Namespace", _settings.Namespace).Trim();
            if (string.IsNullOrEmpty(_settings.Namespace))
            {
                _settings.Namespace = DefaultNamespace;
            }
            _settings.Options = (Options)EditorGUILayout.MaskField("Options", (int)_settings.Options, _optionNames);

            _settings.IgnoredPaths = EditorGUILayout.TextField("Ignore assets at paths", _settings.IgnoredPaths).Trim();

            if (GUILayout.Button("Reset settings"))
            {
                ProjectPrefs.DeleteKey(SettingsKey);
                OnEnable();
                Repaint();
            }
            if (GUILayout.Button("Save settings & generate"))
            {
                ProjectPrefs.SetString(SettingsKey, Singleton.Get <JsonSerialization> ().Serialize(_settings));
                var res = Generate(_settings);
                EditorUtility.DisplayDialog(titleContent.text, res ?? "Success", "Close");
            }
        }
예제 #2
0
        protected override void Save()
        {
            var saveData = new List <SaveData>();

            foreach (var item in pinning)
            {
                if (item == null || item.target == null)
                {
                    continue;
                }

                var guid = UnityEditorUtility.GetAssetGUID(item.target);

                var data = new SaveData()
                {
                    guid    = guid,
                    comment = item.comment,
                };

                saveData.Add(data);
            }

            if (saveData.Any())
            {
                ProjectPrefs.Set(PinnedPrefsKey, saveData);
            }
            else
            {
                if (ProjectPrefs.HasKey(PinnedPrefsKey))
                {
                    ProjectPrefs.DeleteKey(PinnedPrefsKey);
                }
            }
        }
예제 #3
0
 void Save()
 {
     if (_paths != null && _paths.Count > 0)
     {
         ProjectPrefs.SetString(ProjectPrefsKey, Singleton.Get <JsonSerialization> ().Serialize(_paths));
     }
     else
     {
         ProjectPrefs.DeleteKey(ProjectPrefsKey);
     }
 }
 void Save()
 {
     if (_items != null && _items.Count > 0)
     {
         ProjectPrefs.SetString(ProjectPrefsKey, Service <JsonSerialization> .Get().Serialize(_items));
     }
     else
     {
         ProjectPrefs.DeleteKey(ProjectPrefsKey);
     }
 }
 void Save()
 {
     if (_items != null && _items.Count > 0)
     {
         ProjectPrefs.SetString(ProjectPrefsKey, _serializer.Serialize(_items));
     }
     else
     {
         ProjectPrefs.DeleteKey(ProjectPrefsKey);
     }
 }
 static void SaveInfo()
 {
     if (_allDescs.Count > 0)
     {
         try {
             ProjectPrefs.SetString(StorageKey, JsonSerialization.SerializeStatic(_allDescs));
         } catch {
         }
     }
     else
     {
         ProjectPrefs.DeleteKey(StorageKey);
     }
 }
예제 #7
0
 static void SaveInfo()
 {
     if (_allDescs.Count > 0)
     {
         try {
             ProjectPrefs.SetString(StorageKey, Service <JsonSerialization> .Get().Serialize(_allDescs));
         } catch (Exception ex) {
             Debug.LogWarning("FolderIconEditor.SaveInfo: " + ex.Message);
         }
     }
     else
     {
         ProjectPrefs.DeleteKey(StorageKey);
     }
 }
예제 #8
0
        protected override void Save()
        {
            var prefsKey = GetPinnedPrefsKey();

            var saveData = new List <SaveData>();

            foreach (var item in pinning)
            {
                if (item == null || item.target == null)
                {
                    continue;
                }

                var localIdentifierInFile = UnityEditorUtility.GetLocalIdentifierInFile(item.target);

                if (localIdentifierInFile == -1)
                {
                    continue;
                }

                var data = new SaveData()
                {
                    localIdentifierInFile = localIdentifierInFile,
                    comment = item.comment,
                };

                saveData.Add(data);
            }

            if (saveData.Any())
            {
                ProjectPrefs.Set(prefsKey, saveData);
            }
            else
            {
                if (ProjectPrefs.HasKey(prefsKey))
                {
                    ProjectPrefs.DeleteKey(prefsKey);
                }
            }
        }
        // ReSharper disable once InconsistentNaming
        void OnGUI()
        {
            if (_optionNames == null)
            {
                _optionNames = Enum.GetNames(typeof(Options));
            }

            _fileName = EditorGUILayout.TextField("Target file", _fileName).Trim();
            if (string.IsNullOrEmpty(_fileName))
            {
                _fileName = DefaultFileName;
            }
            _nsName = EditorGUILayout.TextField("Namespace", _nsName).Trim();
            if (string.IsNullOrEmpty(_nsName))
            {
                _nsName = DefaultNamespace;
            }
            _options = (Options)EditorGUILayout.MaskField("Options", (int)_options, _optionNames);

            if (GUILayout.Button("Reset settings"))
            {
                ProjectPrefs.DeleteKey(TargetFileKey);
                ProjectPrefs.DeleteKey(NamespaceKey);
                ProjectPrefs.DeleteKey(OptionsKey);
                OnEnable();
                Repaint();
            }
            if (GUILayout.Button("Save settings & generate"))
            {
                ProjectPrefs.SetString(TargetFileKey, _fileName);
                ProjectPrefs.SetString(NamespaceKey, _nsName);
                ProjectPrefs.SetInt(OptionsKey, (int)_options);
                var res = Generate(_fileName, _nsName, _options);
                EditorUtility.DisplayDialog(titleContent.text, res ?? "Success", "Close");
            }
        }