コード例 #1
0
        private static void PreferencesGUI()
        {
            if (cp == null)
            {
                cp = CreateInstance(typeof(ConfigPreferences)) as ConfigPreferences;
            }

            tab = GUILayout.Toolbar(tab, new[] { "Configuration", "Help", "About" });

            if (tab != lastTab)
            {
                lastTab = tab;
                GUI.FocusControl(null);
            }

            switch (tab)
            {
            case 0:
            {
                cp.showConfiguration();

                EditorHelper.SeparatorUI();

                if (GUILayout.Button(new GUIContent(" Reset", EditorHelper.Icon_Reset, "Resets the configuration settings for this project.")))
                {
                    if (EditorUtility.DisplayDialog("Reset configuration?", "Reset the configuration of " + Util.Constants.ASSET_NAME + "?", "Yes", "No"))
                    {
                        Util.Config.Reset();
                        EditorConfig.Reset();
                        save();
                    }
                }

                GUILayout.Space(6);
                break;
            }

            case 1:
                cp.showHelp();
                break;

            default:
                cp.showAbout();
                break;
            }

            if (GUI.changed)
            {
                save();
            }
        }
コード例 #2
0
        private static void PreferencesGUI()
        {
            if (cp == null)
            {
                cp = ScriptableObject.CreateInstance(typeof(ConfigPreferences)) as ConfigPreferences;
            }

            tab = GUILayout.Toolbar(tab, new string[] { "Configuration", "Help", "About" });

            if (tab != lastTab)
            {
                lastTab = tab;
                GUI.FocusControl(null);
            }

            if (tab == 0)
            {
                cp.showConfiguration();

                EditorHelper.SeparatorUI();

                if (GUILayout.Button(new GUIContent(" Reset", EditorHelper.Icon_Reset, "Resets the configuration settings for this project.")))
                {
                    if (EditorUtility.DisplayDialog("Reset configuration?", "Reset the configuration of " + Util.Constants.ASSET_NAME + "?", "Yes", "No"))
                    {
                        Util.Config.Reset();
                        EditorConfig.Reset();
                        save();

                        GAApi.Event(typeof(ConfigPreferences).Name, "Reset configuration");
                    }
                }

                GUILayout.Space(6);
            }
            else if (tab == 1)
            {
                cp.showHelp();
            }
            else
            {
                cp.showAbout();
            }

            if (GUI.changed)
            {
                save();
            }
        }