internal static void Display(int windowId) { Title = SmUtils.SmTags["#smloc_settings_001"]; // set input locks when mouseover window... //_inputLocked = GuiUtils.PreventClickthrough(ShowWindow, Position, _inputLocked); // Reset Tooltip active flag... ToolTipActive = false; Rect rect = new Rect(Position.width - 20, 4, 16, 16); // "Close Window.\r\nSettings will not be immediately saved,\r\n but will be remembered while in game."))) if (GUI.Button(rect, new GUIContent("", SmUtils.SmTags["#smloc_settings_tt_001"]))) { ToolTip = ""; if (HighLogic.LoadedScene == GameScenes.SPACECENTER) { SMAddon.OnSmSettingsClicked(); } else { SMSettings.MemStoreTempSettings(); ShowWindow = false; } } if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.BeginVertical(); DisplayTabButtons(); _displayViewerPosition = GUILayout.BeginScrollView(_displayViewerPosition, SMStyle.ScrollStyle, GUILayout.Height(300), GUILayout.Width(380)); GUILayout.BeginVertical(); DisplaySelectedTab(_displayViewerPosition); GUILayout.EndVertical(); GUILayout.EndScrollView(); DisplayActionButtons(); GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, Screen.width, 30)); SMAddon.RepositionWindow(ref Position); }
private static void DisplayActionButtons() { GUILayout.BeginHorizontal(); // Save //GUIContent label = new GUIContent("Save", "Save the current settings to file."); GUIContent label = new GUIContent(SmUtils.Localize("#smloc_settings_002"), SmUtils.Localize("#smloc_settings_tt_002")); if (GUILayout.Button(label, GUILayout.Height(20))) { ToolTip = ""; SMSettings.SaveIntervalSec = int.Parse(TabConfig.TxtSaveInterval); SMSettings.SaveSettings(); // Sync SM to CLS override settings with CLS if (SMSettings.EnableCls && HighLogic.LoadedSceneIsFlight) { SMSettings.UpdateClsOverride(); } if (HighLogic.LoadedScene == GameScenes.SPACECENTER) SMAddon.OnSmSettingsClicked(); else ShowWindow = false; } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); // Cancel //label = new GUIContent("Cancel", "Cancel the changes made.\nSettings will revert to before changes were made."); label = new GUIContent(SmUtils.Localize("#smloc_settings_003"), SmUtils.Localize("#smloc_settings_tt_003")); if (GUILayout.Button(label, GUILayout.Height(20))) { ToolTip = ""; // We've canclled, so restore original settings. SMSettings.MemRestoreTempSettings(); if (HighLogic.LoadedScene == GameScenes.SPACECENTER) SMAddon.OnSmSettingsClicked(); else ShowWindow = false; } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); GUILayout.EndHorizontal(); }