Example #1
0
 public static void AutoConvertAssets()
 {
     if (!settings.converted)
     {
         settings.useNewUI = ShouldUseNewUI();
         ResourceUtil.Refresh();
         StyleConverter.ConvertStyles();
         settings.converted = true;
         settings.Write();
     }
 }
Example #2
0
#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();
            }
        }