Esempio n. 1
0
        internal static void Display(int windowId)
        {
            // Reset Tooltip active flag...
            Rect rect = new Rect();

            ToolTipActive = false;
            ShowToolTips  = Settings.SettingsToolTips;

            rect = new Rect(371, 4, 16, 16);
            if (GUI.Button(rect, new GUIContent("", "Close Window")))
            {
                ToolTip = "";
                if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    SMAddon.OnSMSettingsToggle();
                }
                else
                {
                    Settings.ShowSettings = false;
                }
            }
            if (Event.current.type == EventType.Repaint && ShowToolTips == true)
            {
                ToolTip = Utilities.SetActiveTooltip(rect, Settings.SettingsPosition, GUI.tooltip, ref ToolTipActive, 0, 0);
            }

            GUILayout.BeginVertical();

            DisplayTabButtons();

            ScrollViewerPosition = GUILayout.BeginScrollView(ScrollViewerPosition, GUILayout.Height(280), GUILayout.Width(375));
            GUILayout.BeginVertical();

            DisplaySelectedTab();

            GUILayout.EndVertical();
            GUILayout.EndScrollView();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Save"))
            {
                Settings.SaveIntervalSec = int.Parse(txtSaveInterval);
                Settings.Save();
                Settings.ShowSettings = false;
            }
            if (GUILayout.Button("Cancel"))
            {
                // We've canclled, so restore original settings.
                Settings.RestoreTempSettings();
                Settings.ShowSettings = false;
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();

            GUI.DragWindow(new Rect(0, 0, Screen.width, 30));
        }