/// <summary> /// Main GUI update /// </summary> void OnGUI() { // If this is the first iteration since the window is opened, do the needed initializzations if (firstCycle) { Start(); } // Check if for some reason the updater is not initialized, this eventuality tends to happen if some code gets recompiled while the window is open if (updater == null) { updater = new TSUpdater(); } TSFunctions.DrawHeader(position.width, 10); section = (MultiWindowSection)GUILayout.Toolbar((int)section, Enum.GetNames(typeof(MultiWindowSection)), EditorStyles.toolbarButton, GUI.ToolbarButtonSize.Fixed); MainAreaScrollPos = EditorGUILayout.BeginScrollView(MainAreaScrollPos); GUILayout.Space(10); // Based on the section selected draw only the gui of said section switch (section) { case MultiWindowSection.Settings: DrawSettings(); break; case MultiWindowSection.Updater: DrawUpdater(); break; case MultiWindowSection.Credits: DrawCredits(); break; default: EditorGUILayout.LabelField("Something went wrong, maybe you should contact the creator and report this"); break; } EditorGUILayout.EndScrollView(); TSFunctions.DrawFooter(); }
/// <summary> /// Set the section that should be open /// </summary> /// <param name="section">Section to open</param> private void SetOpenSection(MultiWindowSection section) { this.section = section; }