#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(); } }
public void OnGUI() { ResourceUtil.Refresh(); InitEditorStyles(); // Is sub window activated ? if (nfsi != null) { currentScrollPos = EditorGUILayout.BeginScrollView(currentScrollPos); nfsi.OnInspectorGUI(this); EditorGUILayout.EndScrollView(); return; } if (!TitleBarGUI()) { return; } // Custom style foldout currentScrollPos = EditorGUILayout.BeginScrollView(currentScrollPos); EditorGUILayout.BeginHorizontal(toolBarStyle); EditorGUILayout.LabelField("Project styles:", toolBarLabelStyle); GUILayout.FlexibleSpace(); if (GUILayout.Button(GUIHelper.ContentFromEditor("New", "Toolbar Plus"), toolBarButtonStyle)) { nfsi = new NewFolderStyleInspector(null, false); } EditorGUILayout.EndHorizontal(); GUILayout.BeginVertical(styleListBackgroundStyle); GUILayout.Space(6); ButtonGrid.ButtonAction styleAction = customStyles.DrawGrid(); if (styleAction != null) { if (styleAction.IsLeftClick) { ApplyStyle((StyleGrid.StyleElement)styleAction.ClickedElement); } else { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Create variant"), false, CreateVariant, (StyleGrid.StyleElement)styleAction.ClickedElement); menu.AddItem(new GUIContent("Edit"), false, EditStyle, (StyleGrid.StyleElement)styleAction.ClickedElement); menu.AddItem(new GUIContent("Delete"), false, AskDeleteStyle, (StyleGrid.StyleElement)styleAction.ClickedElement); menu.ShowAsContext(); } } GUILayout.Space(2); GUILayout.EndVertical(); EditorGUILayout.BeginHorizontal(toolBarStyle); GUILayout.FlexibleSpace(); /*if (GUILayout.Button("Download Style packs", toolBarButtonStyle)) * { * //nfsi = new NewFolderStyleInspector(); * }*/ EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); }