コード例 #1
0
ファイル: PreferencesUI.cs プロジェクト: dbooher/KC
        private static void UpdatePreferences()
        {
            folderIconEnabled  = PreferenceHelper.GetBool("enabled", true);
            simpleClickEnabled = PreferenceHelper.GetBool("simpleclick", false);

            settings = Settings.Read();
        }
コード例 #2
0
ファイル: PreferencesUI.cs プロジェクト: dbooher/KC
 public static void InitPreferences()
 {
     if (!PreferenceHelper.HasKey("enabled"))
     {
         PreferenceHelper.SetBool("enabled", true);
         PreferenceHelper.SetBool("simpleclick", false);
         settings = Settings.Read();
     }
 }
コード例 #3
0
ファイル: PreferencesUI.cs プロジェクト: dbooher/KC
#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();
            }
        }