public static void PreferencesGUI() { // Load the preferences if (!preferencesLoaded) { folderIconEnabled = EditorPrefs.GetBool("ext_" + ResourceUtil.ExtensionName + "_enabled", true); simpleClickEnabled = EditorPrefs.GetBool("ext_" + ResourceUtil.ExtensionName + "_simpleclick", false); preferencesLoaded = true; } // Preferences GUI folderIconEnabled = EditorGUILayout.Toggle("Folder icons enabled", folderIconEnabled); GUI.enabled = folderIconEnabled; EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("Preferences: ", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Show style selector on folder select"); simpleClickEnabled = EditorGUILayout.Toggle(simpleClickEnabled); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); GUI.enabled = true; EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("Danger zone: ", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Reset all folders")) { if (EditorUtility.DisplayDialog("Reset all folders?", "If you confirm all folders will use the default icon", "Yes", "No")) { ResourceUtil.ClearAllFolders(); } } if (GUILayout.Button("Delete all styles")) { if (EditorUtility.DisplayDialog("Delete all styles?", "If you confirm all custom styles will be deleted", "Yes", "No")) { ResourceUtil.ClearAllFolders(); ResourceUtil.DeleteAllStyles(); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); // Save the preferences if (GUI.changed) { EditorPrefs.SetBool("ext_" + ResourceUtil.ExtensionName + "_enabled", folderIconEnabled); EditorPrefs.SetBool("ext_" + ResourceUtil.ExtensionName + "_simpleclick", simpleClickEnabled); CustomProjectView.RepaintProjectViews(); } }
#pragma warning restore 0618 public static void PreferencesGUI() { // Load the preferences if (!preferencesLoaded) { UpdatePreferences(); preferencesLoaded = true; } // Preferences GUI folderIconEnabled = EditorGUILayout.Toggle("Folder icons enabled", folderIconEnabled); GUI.enabled = folderIconEnabled; EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("User Preferences: ", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Show style selector on folder select"); simpleClickEnabled = EditorGUILayout.Toggle(simpleClickEnabled); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("Project Settings: ", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use Unity new icons"); bool newUILocal = EditorGUILayout.Toggle(settings.useNewUI); if (settings.useNewUI != newUILocal) { settings.useNewUI = newUILocal; StyleConverter.ConvertStyles(); settings.Write(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("Danger zone: ", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Reset all folders")) { if (EditorUtility.DisplayDialog("Reset all folders?", "If you confirm all folders will use the default icon", "Yes", "No")) { ResourceUtil.ClearAllFolders(); } } if (GUILayout.Button("Delete all styles")) { if (EditorUtility.DisplayDialog("Delete all styles?", "If you confirm all custom styles will be deleted", "Yes", "No")) { ResourceUtil.ClearAllFolders(); ResourceUtil.DeleteAllStyles(); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); GUI.enabled = true; // Save the preferences if (GUI.changed) { PreferenceHelper.SetBool("enabled", folderIconEnabled); PreferenceHelper.SetBool("simpleclick", simpleClickEnabled); CustomProjectView.RepaintProjectViews(); } }