Example #1
0
        public override void OnGUI(string searchContext)
        {
            //Init styles
            Styles.Load();

            //Set a min size on pref window
            if (prefWindow == null)
            {
                Assembly    assem = typeof(EditorWindow).Assembly;
                System.Type t     = assem.GetType("UnityEditor.PreferenceSettingsWindow");
                prefWindow         = EditorWindow.GetWindow(t, false, "Preferences", false);
                prefWindow.minSize = new Vector2(550, 500);
            }

            //Draw (project | options | help) toolbar
            DrawToolbar();

            //Open a scrollable layout area
            Utils.DrawSeparator();
            winRect = visualElement.contentRect.Offset(9, 30, -20, -80);
            GUI.BeginClip(winRect);
            GUILayout.BeginArea(new Rect(0, 5, winRect.width, winRect.height - 10));
            scroll[pageID] = GUILayout.BeginScrollView(scroll[pageID], GUIStyle.none);
            GUILayout.Space(5);

            //Draw page content
            switch (pageID)
            {
            default:
                DrawProjectSettingsGUI();
                break;

            case 1:
                DrawOptionsSettingsGUI();
                break;

            case 2:
                DrawHelpSettingsGUI();
                break;
            }

            //Close the scrollable layout area
            GUILayout.EndScrollView();
            GUILayout.EndArea();
            GUI.EndClip();
            GUILayout.Space(winRect.height - 20);
            Utils.DrawSeparator();

            //Draw page footer
            switch (pageID)
            {
            default:
                DrawProjectFooterGUI();
                break;

            case 1:
                DrawOptionsFooterGUI();
                break;

            case 2:
                DrawHelpFooterGUI();
                break;
            }
        }