private static string GetFrozenKerbalDetails(ProtoCrewMember kerbal) { try { string rosterDetails = ""; if (!DFWrapper.APIReady) { DFWrapper.InitDFWrapper(); } if (DFWrapper.APIReady) { if (DFWrapper.DeepFreezeAPI.FrozenKerbals.ContainsKey(kerbal.name)) // "Frozen" { rosterDetails = string.Format("{0} - {1}", SMUtils.Localize("#smloc_roster_015"), DFWrapper.DeepFreezeAPI.FrozenKerbals[kerbal.name].vesselName.Replace("(unloaded)", "")); } else { rosterDetails = SMUtils.Localize("#smloc_roster_015"); // "Frozen"; } } return(rosterDetails); } catch (Exception ex) { if (!SMAddon.FrameErrTripped) { SMUtils.LogMessage(string.Format(" in GetRosterList().\r\nError: {0}", ex), SMUtils.LogType.Error, true); } return(string.Format("{0}:", SMUtils.Localize("#smloc_error_001"))); // "Display Error" } }
private static void DisplaySelectProfession() { GUILayout.BeginHorizontal(); GUILayout.Label(SMUtils.Localize("#smloc_roster_005"), GUILayout.Width(85)); // "Profession:" bool isPilot = GUILayout.Toggle(KerbalProfession == Professions.Pilot, SMUtils.Localize("#smloc_roster_006"), GUILayout.Width(90)); // "Pilot" if (isPilot) { KerbalProfession = Professions.Pilot; } bool isEngineer = GUILayout.Toggle(KerbalProfession == Professions.Engineer, SMUtils.Localize("#smloc_roster_007"), GUILayout.Width(90)); // "Engineer" if (isEngineer) { KerbalProfession = Professions.Engineer; } bool isScientist = GUILayout.Toggle(KerbalProfession == Professions.Scientist, SMUtils.Localize("#smloc_roster_008"), GUILayout.Width(90)); // "Scientist" if (isScientist) { KerbalProfession = Professions.Scientist; } GUILayout.EndHorizontal(); }
internal static void Display(Vector2 displayViewerPosition) { //float scrollX = WindowControl.Position.x + 10; //float scrollY = WindowControl.Position.y + 50 - displayViewerPosition.y; float scrollX = 10; float scrollY = 50 - displayViewerPosition.y; // Reset Tooltip active flag... ToolTipActive = false; SMHighlighter.IsMouseOver = false; GUILayout.BeginVertical(); GUI.enabled = true; //GUILayout.Label("Science Lab Control Center ", SMStyle.LabelTabHeader); GUILayout.Label(SMUtils.Localize("#smloc_control_lab_000"), SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); string step = "start"; try { // Display all Labs List <ModuleScienceLab> .Enumerator iLabs = SMAddon.SmVessel.Labs.GetEnumerator(); while (iLabs.MoveNext()) { if (iLabs.Current == null) { continue; } bool isEnabled = true; step = "gui enable"; GUI.enabled = isEnabled; string label = iLabs.Current.name + " - (" + (iLabs.Current.IsOperational() ? SMUtils.Localize("#smloc_control_lab_001") : SMUtils.Localize("#smloc_control_lab_002")) + ")"; // Operational, InOp GUILayout.Label(label, GUILayout.Width(260), GUILayout.Height(40)); Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.IsMouseOver = true; SMHighlighter.MouseOverRect = new Rect(scrollX + rect.x, scrollY + rect.y, rect.width, rect.height); SMHighlighter.MouseOverPart = iLabs.Current.part; SMHighlighter.MouseOverParts = null; } } iLabs.Dispose(); // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SMUtils.LogMessage( string.Format(" in Solar Panel Tab at step {0}. Error: {1} \r\n\r\n{2}", step, ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } GUILayout.EndVertical(); }
private static void DisplayRosterFilter() { GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("{0}:", SMUtils.Localize("#smloc_roster_009")), GUILayout.Width(40)); // Filter bool isAll = GUILayout.Toggle(CurrentFilter == KerbalFilters.All, SMUtils.Localize("#smloc_roster_010"), GUILayout.Width(60)); // "All" if (isAll) { CurrentFilter = KerbalFilters.All; } bool isAssign = GUILayout.Toggle(CurrentFilter == KerbalFilters.Assigned, SMUtils.Localize("#smloc_roster_011"), GUILayout.Width(95)); // "Assigned" if (isAssign) { CurrentFilter = KerbalFilters.Assigned; } if (HighLogic.LoadedSceneIsFlight) { bool isVessel = GUILayout.Toggle(CurrentFilter == KerbalFilters.Vessel, SMUtils.Localize("#smloc_roster_012"), GUILayout.Width(80)); // "Vessel" if (isVessel) { CurrentFilter = KerbalFilters.Vessel; } } bool isAvail = GUILayout.Toggle(CurrentFilter == KerbalFilters.Available, SMUtils.Localize("#smloc_roster_013"), GUILayout.Width(95)); // "Available" if (isAvail) { CurrentFilter = KerbalFilters.Available; } bool isDead = GUILayout.Toggle(CurrentFilter == KerbalFilters.Dead, SMUtils.Localize("#smloc_roster_014"), GUILayout.Width(130)); // "Dead/Missing" if (isDead) { CurrentFilter = KerbalFilters.Dead; } if (InstalledMods.IsDfInstalled) { bool isFrozen = GUILayout.Toggle(CurrentFilter == KerbalFilters.Frozen, SMUtils.Localize("#smloc_roster_015"), GUILayout.Width(80)); // "Frozen" if (isFrozen) { CurrentFilter = KerbalFilters.Frozen; } } GUILayout.EndHorizontal(); }
internal static void Display(int windowId) { Title = SMUtils.Localize("#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.Localize("#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 PreLaunchGui() { try { if (SMSettings.EnablePfCrews) { GUILayout.BeginHorizontal(); // Realism Mode is desirable, as there is a cost associated with a kerbal on a flight. No cheating! if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_005"), SMStyle.ButtonStyle, GUILayout.Width(134), GUILayout.Height(20))) // "Fill Crew" { SMAddon.SmVessel.FillCrew(); } if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_006"), SMStyle.ButtonStyle, GUILayout.Width(134), GUILayout.Height(20))) // "Empty Crew" { SMAddon.SmVessel.EmptyCrew(); } GUILayout.EndHorizontal(); } if (!SMSettings.EnablePfResources) { return; } GUILayout.BeginHorizontal(); if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_007"), SMStyle.ButtonStyle, GUILayout.Width(134), GUILayout.Height(20))) // "Fill Resources" { SMAddon.SmVessel.FillResources(); } if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_008"), SMStyle.ButtonStyle, GUILayout.Width(134), GUILayout.Height(20))) // "Empty Resources" { SMAddon.SmVessel.DumpAllResources(); } GUILayout.EndHorizontal(); } catch (Exception ex) { if (!SMAddon.FrameErrTripped) { SMUtils.LogMessage( string.Format(" in PreLaunchGui. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); SMAddon.FrameErrTripped = true; } } }
private static void SetupEditButton(ProtoCrewMember kerbal, out string buttonText, out string buttonToolTip) { GUI.enabled = kerbal.rosterStatus == ProtoCrewMember.RosterStatus.Available && SMSettings.EnableCrewModify; //buttonText = SelectedKerbal == null || SelectedKerbal.Kerbal != kerbal ? "Edit" : "Cancel"; buttonText = SelectedKerbal == null || SelectedKerbal.Kerbal != kerbal?SMUtils.Localize("#smloc_roster_020") : SMUtils.Localize("#smloc_roster_004"); if (GUI.enabled) { buttonToolTip = SelectedKerbal == null || SelectedKerbal.Kerbal != kerbal ? SMUtils.Localize("#smloc_roster_tt_007") // "Edit this Kerbal's attributes" : SMUtils.Localize("#smloc_roster_tt_008"); // "Cancel any changes to this Kerbal" } else { buttonToolTip = kerbal.rosterStatus != ProtoCrewMember.RosterStatus.Available ? SMUtils.Localize("#smloc_roster_tt_009") // "Kerbal is not available at this time.\r\nEditing is disabled"; : SMUtils.Localize("#smloc_roster_tt_021"); // "Realistic Control is On.\r\nEditing is disabled"; } }
private static void CreateKerbalViewer() { DisplaySelectProfession(); GUILayout.BeginHorizontal(); // "Create", "Creates a Kerbal with profession selected above.\r\nAdds him/her to the Roster." GUIContent guilabel = new GUIContent(SMUtils.Localize("#smloc_roster_003"), SMUtils.Localize("#smloc_roster_tt_002")); if (GUILayout.Button(guilabel, GUILayout.MaxWidth(80), GUILayout.Height(20))) { bool kerbalFound = false; while (!kerbalFound) { SelectedKerbal = ModKerbal.CreateKerbal(); if (SelectedKerbal.Trait == KerbalProfession.ToString()) { kerbalFound = true; } } OnCreate = false; } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } //guilabel = new GUIContent("Cancel", "Cancels current creation and exit editor."); guilabel = new GUIContent(SMUtils.Localize("#smloc_roster_004"), SMUtils.Localize("#smloc_roster_tt_003")); if (GUILayout.Button(guilabel, GUILayout.MaxWidth(80), GUILayout.Height(20))) { OnCreate = false; SelectedKerbal = null; } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.EndHorizontal(); }
internal static void Display(int windowId) { Title = SMUtils.Localize("#smloc_control_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); if (GUI.Button(rect, new GUIContent("", SMUtils.Localize("#smloc_window_tt_001")))) // "Close Window" { ShowWindow = false; ToolTip = ""; } if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } // This is a scroll panel (we are using it to make button lists...) GUILayout.BeginVertical(); DisplayWindowTabs(); // This is a scroll panel (we are using it to make button lists...) _displayViewerPosition = GUILayout.BeginScrollView(_displayViewerPosition, SMStyle.ScrollStyle, GUILayout.Height(200), GUILayout.Width(380)); DisplaySelectedTab(_displayViewerPosition); GUILayout.EndScrollView(); DisplayTabActions(); GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, Screen.width, 30)); SMAddon.RepositionWindow(ref Position); }
internal static void Display(int windowId) { Title = SMUtils.Localize("#smloc_roster_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); if (GUI.Button(rect, new GUIContent("", SMUtils.Localize("#smloc_window_tt_001")))) // "Close Window" { OnCreate = false; SelectedKerbal = null; ToolTip = ""; if (HighLogic.LoadedScene == GameScenes.SPACECENTER) { SMAddon.OnSmRosterClicked(); } else { ShowWindow = false; } } if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } try { GUILayout.BeginVertical(); DisplayRosterFilter(); DisplayRosterListViewer(); if (OnCreate) { CreateKerbalViewer(); } else if (SelectedKerbal != null) { EditKerbalViewer(); } else { GUILayout.BeginHorizontal(); GUI.enabled = SMSettings.EnableCrewModify; GUIContent guilabel = new GUIContent(SMUtils.Localize("#smloc_roster_002"), GUI.enabled // "Create Kerbal" ? SMUtils.Localize("#smloc_roster_tt_001") // Realistic Control is On. Create a Kerbal is disabled. : SMUtils.Localize("#smloc_roster_tt_022")); // "Opens the Kerbal creation editor." if (GUILayout.Button(guilabel, GUILayout.MaxWidth(120), GUILayout.Height(20))) { OnCreate = true; } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.EndHorizontal(); GUI.enabled = true; } GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, Screen.width, 30)); SMAddon.RepositionWindow(ref Position); } catch (Exception ex) { SMUtils.LogMessage(string.Format(" in Roster Window. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } }
internal static void Display(Vector2 displayViewerPosition) { // Reset Tooltip active flag... ToolTipActive = false; _canShowToolTips = WindowSettings.ShowToolTips && ShowToolTips; Position = WindowSettings.Position; int scrollX = 20; GUILayout.Label(SMUtils.Localize("#smloc_settings_sounds_000"), SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); GUILayout.Label(SMUtils.Localize("#smloc_settings_sounds_001") + ":", GUILayout.Height(20)); //"Transfer Pump:" // Pump Start Sound GUILayout.BeginHorizontal(); //_label = "Pump Starting: "; //_toolTip = "Folder location where Pump Starting sound is stored."; //_toolTip += "\r\nChange to point to your own custom sounds if desired."; _label = SMUtils.Localize("#smloc_settings_sounds_002") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_sounds_tt_001"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(100)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } SMSettings.PumpSoundStart = GUILayout.TextField(SMSettings.PumpSoundStart, GUILayout.Width(220)); GUILayout.EndHorizontal(); // Pump Run Sound GUILayout.BeginHorizontal(); //_label = "Pump Running: "; //_toolTip = "Folder location where Pump Running sound is stored."; //_toolTip += "\r\nChange to point to your own custom sounds if desired."; _label = SMUtils.Localize("#smloc_settings_sounds_003") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_sounds_tt_002"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(100)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } SMSettings.PumpSoundRun = GUILayout.TextField(SMSettings.PumpSoundRun, GUILayout.Width(220)); GUILayout.EndHorizontal(); // Pump Stop Sound GUILayout.BeginHorizontal(); //_label = "Pump Stopping: "; //_toolTip = "Folder location where Pump Stopping sound is stored."; //_toolTip += "\r\nChange to point to your own custom sounds if desired."; _label = SMUtils.Localize("#smloc_settings_sounds_004") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_sounds_tt_003"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(100)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } SMSettings.PumpSoundStop = GUILayout.TextField(SMSettings.PumpSoundStop, GUILayout.Width(220)); GUILayout.EndHorizontal(); // Pump Sound Volume GUILayout.BeginHorizontal(); //_label = "Pump Volume: "; //_toolTip = "How loud do you want it?"; //_toolTip += "\r\nMove slider to change volume."; _label = SMUtils.Localize("#smloc_settings_sounds_005") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_sounds_tt_004"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(100)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } // Volume Slider Control //GUILayout.Label("Min", GUILayout.Width(40), GUILayout.Height(20)); GUILayout.Label(SMUtils.Localize("#smloc_settings_sounds_006"), GUILayout.Width(40), GUILayout.Height(20)); // "Min" SMSettings.PumpSoundVol = GUILayout.HorizontalSlider((float)SMSettings.PumpSoundVol, 0f, 1f, GUILayout.Width(140), GUILayout.Height(20)); //_label = "Max"; //_toolTip = "Slide control to change the volume above."; _label = SMUtils.Localize("#smloc_settings_sounds_007"); _toolTip = SMUtils.Localize("#smloc_settings_sounds_004"); GUILayout.Label(new GUIContent(_label, _toolTip), GUILayout.Width(40), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); GUILayout.Label(" ", GUILayout.Height(10)); //GUILayout.Label("Crew:", GUILayout.Height(20)); GUILayout.Label(SMUtils.Localize("#smloc_settings_sounds_008") + ":", GUILayout.Height(20)); // Crew Start Sound GUILayout.BeginHorizontal(); //_label = "Crew Exiting: "; //_toolTip = "Folder location where Crew Exiting their seat sound is stored."; //_toolTip += "\r\nChange to point to your own custom sounds if desired."; _label = SMUtils.Localize("#smloc_settings_sounds_009") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_sounds_tt_005"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(100)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } SMSettings.CrewSoundStart = GUILayout.TextField(SMSettings.CrewSoundStart, GUILayout.Width(220)); GUILayout.EndHorizontal(); // Crew Run Sound GUILayout.BeginHorizontal(); //_label = "Crew Xfering: "; //_toolTip = "Folder location where Crew transferring sound is stored."; //_toolTip += "\r\nChange to point to your own custom sounds if desired."; _label = SMUtils.Localize("#smloc_settings_sounds_010") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_sounds_tt_006"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(100)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } SMSettings.CrewSoundRun = GUILayout.TextField(SMSettings.CrewSoundRun, GUILayout.Width(220)); GUILayout.EndHorizontal(); // Crew Stop Sound GUILayout.BeginHorizontal(); //_label = "Crew Entering: "; //_toolTip = "Folder location where Crew Entering sound is stored."; //_toolTip += "\r\nChange to point to your own custom sounds if desired."; _label = SMUtils.Localize("#smloc_settings_sounds_011") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_sounds_tt_007"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(100)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } SMSettings.CrewSoundStop = GUILayout.TextField(SMSettings.CrewSoundStop, GUILayout.Width(220)); GUILayout.EndHorizontal(); // Crew Sound Volume GUILayout.BeginHorizontal(); //_label = "Crew Volume: "; //_toolTip = "How loud do you want it?"; //_toolTip += "\r\nMove slider to change volume."; _label = SMUtils.Localize("#smloc_settings_sounds_012") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_sounds_tt_004"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(100)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } // Volume Slider Control //GUILayout.Label("Min", GUILayout.Width(40), GUILayout.Height(20)); GUILayout.Label(SMUtils.Localize("#smloc_settings_sounds_006"), GUILayout.Width(40), GUILayout.Height(20)); // "Min" SMSettings.CrewSoundVol = GUILayout.HorizontalSlider((float)SMSettings.CrewSoundVol, 0f, 1f, GUILayout.Width(140), GUILayout.Height(20)); //_label = "Max"; //_toolTip = "Slide control to change the volume above."; _label = SMUtils.Localize("#smloc_settings_sounds_007"); _toolTip = SMUtils.Localize("#smloc_settings_sounds_tt_004"); GUILayout.Label(new GUIContent(_label, _toolTip), GUILayout.Width(40), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); }
internal static void Display(Vector2 displayViewerPosition) { //float scrollX = WindowControl.Position.x + 20; //float scrollY = WindowControl.Position.y + 50 - displayViewerPosition.y; float scrollX = 20; float scrollY = 50 - displayViewerPosition.y; // Reset Tooltip active flag... ToolTipActive = false; SMHighlighter.IsMouseOver = false; GUILayout.BeginVertical(); GUI.enabled = true; //GUILayout.Label("External Light Control Center ", SMStyle.LabelTabHeader); GUILayout.Label(SMUtils.Localize("#smloc_control_light_000"), SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); string step = "start"; try { // Display all Lights List <ModLight> .Enumerator iLights = SMAddon.SmVessel.Lights.GetEnumerator(); while (iLights.MoveNext()) { if (iLights.Current == null) { continue; } string label = iLights.Current.Status + " - " + iLights.Current.Title; bool onState = iLights.Current.IsOn; bool newOnState = GUILayout.Toggle(onState, label, GUILayout.Width(325), GUILayout.Height(40)); step = "button toggle check"; if (!onState && newOnState) { iLights.Current.TurnOnLight(); } else if (onState && !newOnState) { iLights.Current.TurnOffLight(); } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type != EventType.Repaint || !rect.Contains(Event.current.mousePosition)) { continue; } SMHighlighter.IsMouseOver = true; SMHighlighter.MouseOverRect = new Rect(scrollX + rect.x, scrollY + rect.y, rect.width, rect.height); SMHighlighter.MouseOverPart = iLights.Current.SPart; SMHighlighter.MouseOverParts = null; } iLights.Dispose(); // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SMUtils.LogMessage( string.Format(" in Light Tab at step {0}. Error: {1} \r\n\r\n{2}", step, ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } GUILayout.EndVertical(); }
private static void SetupActionButton(ProtoCrewMember kerbal, out string buttonText, out string buttonToolTip) { if (HighLogic.LoadedScene != GameScenes.SPACECENTER) { if (SMConditions.CanKerbalBeAdded(kerbal)) { GUI.enabled = true; buttonText = SMUtils.Localize("#smloc_roster_023"); // "Add"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_010"); //buttonToolTip = "Adds a kerbal to the Selected Source Part,\r\nin the first available seat."; } else if (SMConditions.FrozenKerbalNotThawable(kerbal)) { GUI.enabled = false; buttonText = SMUtils.Localize("#smloc_roster_025"); // "Thaw"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_011"); // buttonToolTip = "Thaw disabled. Vessel not active. UnFreeze a Kerbal and Revive them.\r\nWill then become assigned to current vessel."; } else if (SMConditions.FrozenKerbalIsThawable(kerbal)) { GUI.enabled = true; buttonText = SMUtils.Localize("#smloc_roster_025"); // "Thaw"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_012"); // buttonToolTip = "UnFreeze a Kerbal and Revive them.\r\nWill then become assigned to current vessel."; } else if (SMConditions.CanKerbalBeFrozen(kerbal)) { GUI.enabled = true; buttonText = SMUtils.Localize("#smloc_roster_026"); // "Freeze"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_013"); // buttonToolTip = "Freezes a Kerbal in the DeepFreezer.\r\nWill then become Unowned and will not consume life support."; } else if (SMConditions.CanKerbalBeRemoved(kerbal)) { GUI.enabled = true; buttonText = SMUtils.Localize("#smloc_roster_022"); // "Remove"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_014"); // "Removes a Kerbal from the active vessel.\r\nWill then become available."; } else if (SMConditions.KerbalCannotBeRemovedRealism(kerbal)) { GUI.enabled = false; buttonText = SMUtils.Localize("#smloc_roster_022"); // "Remove"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_023"); // "Remove Disabled. Roster Modifications is preventing this action.\r\nTo Remove this Kerbal, Change your Roster Modifications Setting."; } else if (SMConditions.KerbalCannotBeAddedNoSource(kerbal)) { GUI.enabled = false; buttonText = SMUtils.Localize("#smloc_roster_023"); // "Add"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_015"); // buttonToolTip = "Add Disabled. No source part is selected.\r\nTo add a Kerbal, Select a Source Part with an available seat."; } else if (SMConditions.KerbalCannotBeAddedRealism(kerbal)) { GUI.enabled = false; buttonText = SMUtils.Localize("#smloc_roster_023"); // "Add"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_016"); // buttonToolTip = "Add Disabled. Roster Modifications is preventing this action.\r\nTo add a Kerbal, Change your Roster Modifications Setting."; } else { GUI.enabled = false; buttonText = "--"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_017"); // buttonToolTip = "Kerbal is not available.\r\nCurrent status does not allow any action."; } } else // HighLogic.LoadedScene == GameScenes.SPACECENTER { GUI.enabled = false; buttonText = "--"; buttonToolTip = SMUtils.Localize("#smloc_roster_tt_018"); // buttonToolTip = "Kerbal is not dead or missing.\r\nCurrent status does not allow any action while in Space Center."; } // Applies to both scenes. if (SMConditions.CanKerbalBeReSpawned(kerbal)) { GUI.enabled = SMSettings.EnableCrewModify; buttonText = SMUtils.Localize("#smloc_roster_024"); // "Respawn"; buttonToolTip = SMSettings.EnableCrewModify ? SMUtils.Localize("#smloc_roster_tt_020") // "Brings a Kerbal back to life.\r\nWill then become available."; : SMUtils.Localize("#smloc_roster_tt_019"); // "Realistic Control is preventing this action."; } }
private static void DisplayRealismButtons() { // RealismMode options GUIContent[] options = { new GUIContent(SMUtils.Localize("#smloc_settings_realism_004"), SMUtils.Localize("#smloc_settings_realism_tt_003")), new GUIContent(SMUtils.Localize("#smloc_settings_realism_005"), SMUtils.Localize("#smloc_settings_realism_tt_004")), new GUIContent(SMUtils.Localize("#smloc_settings_realism_006"), SMUtils.Localize("#smloc_settings_realism_tt_005")), new GUIContent(SMUtils.Localize("#smloc_settings_realism_007"), SMUtils.Localize("#smloc_settings_realism_tt_006")) }; GUIStyle[] styles = { SMSettings.RealismMode == 0 ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle, SMSettings.RealismMode == 1 ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle, SMSettings.RealismMode == 2 ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle, SMSettings.RealismMode == 3 ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle, }; // "Realism Mode Label" _label = $"{SMUtils.Localize("#smloc_settings_realism_003")}:"; _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_002"); _guiLabel = new GUIContent(_label, _toolTip); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.Label(_guiLabel, SMStyle.LabelStyleNoWrap, GUILayout.Width(90)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } // Build Option Buttons SMSettings.RealismMode = SMSettings.GetRealismMode(); for (int x = 0; x <= 3; x++) { if (x == 3) { GUI.enabled = false; } if (GUILayout.Button(options[x], styles[x], GUILayout.Height(20))) { if (x != SMSettings.RealismMode) { SMSettings.SetRealismMode(x); } } _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } GUI.enabled = true; } GUILayout.EndHorizontal(); }
internal static void Display(int windowId) { Title = string.Format("{0}: {1}", SMUtils.Localize("#smloc_debug_000"), SMSettings.CurVersion); // 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); if (GUI.Button(rect, new GUIContent("", SMUtils.Localize("#smloc_window_tt_001")))) // "Close Window" { ShowWindow = false; SMSettings.MemStoreTempSettings(); ToolTip = ""; } if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.BeginVertical(); SMUtils.DebugScrollPosition = GUILayout.BeginScrollView(SMUtils.DebugScrollPosition, SMStyle.ScrollStyle, GUILayout.Height(300), GUILayout.Width(500)); GUILayout.BeginVertical(); List <string> .Enumerator errors = SMUtils.LogItemList.GetEnumerator(); while (errors.MoveNext()) { if (errors.Current == null) { continue; } GUILayout.TextArea(errors.Current, GUILayout.Width(460)); } errors.Dispose(); GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); if (GUILayout.Button(SMUtils.Localize("#smloc_debug_001"), GUILayout.Height(20))) //"Clear log" { SMUtils.LogItemList.Clear(); SMUtils.LogItemList.Add("Info: Log Cleared at " + DateTime.UtcNow.ToString(CultureInfo.InvariantCulture) + " UTC."); } if (GUILayout.Button(SMUtils.Localize("#smloc_debug_002"), GUILayout.Height(20))) // "Save Log" { // Create log file and save. Savelog(); } if (GUILayout.Button(SMUtils.Localize("#smloc_debug_003"), GUILayout.Height(20))) // "Close" { // Create log file and save. ShowWindow = false; SMSettings.MemStoreTempSettings(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, Screen.width, 30)); SMAddon.RepositionWindow(ref Position); }
internal static void Display(Vector2 displayViewerPosition) { // Reset Tooltip active flag... ToolTipActive = false; _canShowToolTips = WindowSettings.ShowToolTips && ShowToolTips; Position = WindowSettings.Position; int scrollX = 20; GUI.enabled = true; if (!SMSettings.LockSettings) { // "Realism Settings / Options" GUILayout.Label(SMUtils.Localize("#smloc_settings_realism_001"), SMStyle.LabelTabHeader); } else { // "Realism Settings / Options (Locked. To unlock, edit SMSettings.dat file)" GUILayout.Label( new GUIContent(SMUtils.Localize("#smloc_settings_realism_002"), SMUtils.Localize("#smloc_settings_realism_tt_001")), SMStyle.LabelTabHeader); } GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); bool isEnabled = !SMSettings.LockSettings; //RealismMode Buttons. DisplayRealismButtons(); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); // RealXfers Mode GUI.enabled = isEnabled; //_label = "Realistic Transfers"; //_toolTip = "Turns on/off Realistic Resource Transfers."; //_toolTip += "\r\nWhen ON, Resource fills, Dumps, Crew and Science transfers will behave realistically"; //_toolTip += "\r\nWhen Off, Allows Fills, Dumps, Repeating Science,"; //_toolTip += "\r\ninstantaneous Xfers, Crew Xfers anywwhere, etc."; _label = SMUtils.Localize("#smloc_settings_realism_008"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_007"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.RealXfers = GUILayout.Toggle(SMSettings.RealXfers, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } // RealControl Mode GUI.enabled = isEnabled; //_label = "Realistic Control"; //_toolTip = "Turns on/off Realistic Shipboard Control."; //_toolTip += "\r\nWhen ON, you must have crew aboard, or a valid comm link to a control station or satellite"; //_toolTip += "\r\nWhen Off, you have full control of the vessel at any time (subject to the availability of resources)."; _label = SMUtils.Localize("#smloc_settings_realism_009"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_008"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.RealControl = GUILayout.Toggle(SMSettings.RealControl, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } // EnableCrew Modifications GUI.enabled = isEnabled; GUILayout.BeginHorizontal(); //_label = "Enable Roster Modifications"; //_toolTip = "Enables/Disable Crew Modifications in the Roster Window."; //_toolTip += "\r\nWhen ON, You cannot Edit, Create, or Respawn Crew members."; //_toolTip += "\r\nWhen Off, You can Edit, Create, or Respawn Crew members."; _label = SMUtils.Localize("#smloc_settings_realism_010"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_009"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableCrewModify = GUILayout.Toggle(SMSettings.EnableCrewModify, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); //_label = "Enable Kerbal Renaming"; //_toolTip = "Allows renaming a Kerbal."; _label = SMUtils.Localize("#smloc_settings_realism_011"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_010"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableKerbalRename = GUILayout.Toggle(SMSettings.EnableKerbalRename, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.BeginHorizontal(); //_label = "Enable Profession management"; //_toolTip = "When On, SM allows you to change a Kerbal's profession."; _label = SMUtils.Localize("#smloc_settings_realism_012"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_011"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableChangeProfession = GUILayout.Toggle(SMSettings.EnableChangeProfession, _guiLabel, GUILayout.Width(300)); GUILayout.EndHorizontal(); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUI.enabled = true; // Enable stock Crew Xfers GUI.enabled = SMSettings.EnableCrew && isEnabled; GUILayout.BeginHorizontal(); //_label = "Enable Stock Crew Xfers"; //_toolTip = "Turns On/Off the stock Crew Transfer mechanism."; //_toolTip += "\r\nWhen ON stock crew transfers will be Allowed."; //_toolTip += "\r\nWhen OFF Stock Crew transfers are disabled."; _label = SMUtils.Localize("#smloc_settings_realism_013"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_012"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableStockCrewXfer = GUILayout.Toggle(SMSettings.EnableStockCrewXfer, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); // EnableCrew Xfer Mode GUI.enabled = isEnabled; GUILayout.BeginHorizontal(); //_label = "Enable SM Crew Xfers"; //_toolTip = "Turns on/off Crew transfers using SM."; //_toolTip += "\r\nWhen ON, The Crew option will appear in your resource list."; //_toolTip += "\r\nWhen Off, Crew transfers are not possible using SM."; _label = SMUtils.Localize("#smloc_settings_realism_014"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_013"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableCrew = GUILayout.Toggle(SMSettings.EnableCrew, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); if (!SMSettings.EnableCrew && HighLogic.LoadedSceneIsFlight) { if (SMAddon.SmVessel.SelectedResources.Contains(SMConditions.ResourceType.Crew.ToString())) { // Clear Resource selection. SMHighlighter.ClearResourceHighlighting(SMAddon.SmVessel.SelectedResourcesParts); SMAddon.SmVessel.SelectedResources.Clear(); WindowTransfer.ShowWindow = false; } } // Set Gui.enabled for child settings to resources... GUI.enabled = SMSettings.EnableCrew && isEnabled; // EnablePFResources Mode GUILayout.BeginHorizontal(); GUILayout.Space(20); //_label = "Enable Crew Fill and Empty Ops in Pre-Flight"; //_toolTip = "Turns on/off Fill and Empty Crew when in preflight."; //_toolTip += "\r\nWhen ON, Fill & Empty Crew vessel wide are possible (shows in the Resource list)."; //_toolTip += "\r\nWhen Off, Fill and Empty Crew vessel wide will not appear in the resource list."; _label = SMUtils.Localize("#smloc_settings_realism_015"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_014"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnablePfCrews = GUILayout.Toggle(SMSettings.EnablePfCrews, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); // Enable stock Crew Xfer Override GUI.enabled = SMSettings.EnableCrew && isEnabled && SMSettings.EnableStockCrewXfer; GUILayout.BeginHorizontal(); //_label = "Override Stock Crew Xfers"; //_toolTip = "Turns on/off Overriding the stock Crew Transfer mechanism with the SM style."; //_toolTip += "\r\nWhen ON stock crew transfers will behave like SM style transfers.\n(requires both Stock Crew Transfers & SM Crew Transfers ON)"; //_toolTip += "\r\nWhen Off Stock Crew transfers behave normally if enabled."; _label = SMUtils.Localize("#smloc_settings_realism_016"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_015"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Space(20); SMSettings.OverrideStockCrewXfer = GUILayout.Toggle(SMSettings.OverrideStockCrewXfer, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); // EnableCLS Mode GUILayout.BeginHorizontal(); GUILayout.Space(20); if (!SMSettings.EnableCrew || !SMSettings.ClsInstalled) { GUI.enabled = false; } else { GUI.enabled = isEnabled; } //_label = "Enable CLS (Connected Living Spaces)"; //_toolTip = "Turns on/off Connected Living space support."; //_toolTip += "\r\nWhen ON, Crew can only be xfered to a part in the same 'Living Space'."; //_toolTip += "\r\nWhen Off, Crew transfers are possible to any part that can hold a kerbal."; _label = SMUtils.Localize("#smloc_settings_realism_017"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_016"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableCls = GUILayout.Toggle(SMSettings.EnableCls, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); if (SMSettings.EnableCls != SMSettings.PrevEnableCls && HighLogic.LoadedSceneIsFlight) { if (!SMSettings.EnableCls) { SMHighlighter.HighlightClsVessel(false, true); } else if (SMAddon.SmVessel.SelectedResources.Contains(SMConditions.ResourceType.Crew.ToString())) { // Update spaces and reassign the resource to observe new settings. SMAddon.UpdateClsSpaces(); SMAddon.SmVessel.SelectedResources.Clear(); SMAddon.SmVessel.SelectedResources.Add(SMConditions.ResourceType.Crew.ToString()); } } // Enable stock Crew Xfer Override if (!SMSettings.EnableCrew || !SMSettings.ClsInstalled) { GUI.enabled = false; } else { GUI.enabled = isEnabled; } GUILayout.BeginHorizontal(); //_label = "Enable CLS' Allow Unrestricted Crew Xfers switch"; //_toolTip = "Turns on/off Enabling the CLS Switch allowing unrestricted crew transfers."; //_toolTip += "\r\nWhen ON (requires Realism Mode On), SM Manages Stock and CLS aware Crew Transfers."; //_toolTip += "\r\nWhen Off (or Realism is off), the setting in CLS is not touched."; _label = SMUtils.Localize("#smloc_settings_realism_018"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_017"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Space(20); SMSettings.EnableClsAllowTransfer = GUILayout.Toggle(SMSettings.EnableClsAllowTransfer, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); // EnableScience Mode GUILayout.BeginHorizontal(); GUI.enabled = isEnabled; //_label = "Enable Science Xfers"; //_toolTip = "Turns on/off Science Xfers."; //_toolTip += "\r\nWhen ON, Science transfers are possible and show up in the Resource list."; //_toolTip += "\r\nWhen Off, Science transfers will not appear in the resource list."; _label = SMUtils.Localize("#smloc_settings_realism_019"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_018"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableScience = GUILayout.Toggle(SMSettings.EnableScience, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); if (!SMSettings.EnableScience && HighLogic.LoadedSceneIsFlight) { // Clear Resource selection. if (SMAddon.SmVessel.SelectedResources.Contains(SMConditions.ResourceType.Science.ToString())) { SMAddon.SmVessel.SelectedResources.Clear(); } } // EnableResources Mode GUILayout.BeginHorizontal(); GUI.enabled = isEnabled; //_label = "Enable Resource Xfers"; //_toolTip = "Turns on/off Resource Xfers."; //_toolTip += "\r\nWhen ON, Resource transfers are possible and display in Manifest Window."; //_toolTip += "\r\nWhen Off, Resources will not appear in the resource list."; _label = SMUtils.Localize("#smloc_settings_realism_020"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_019"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableResources = GUILayout.Toggle(SMSettings.EnableResources, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); if (!SMSettings.EnableResources && HighLogic.LoadedSceneIsFlight) { // Clear Resource selection. if (SMAddon.SmVessel.SelectedResources.Count > 0 && !SMAddon.SmVessel.SelectedResources.Contains(SMConditions.ResourceType.Crew.ToString()) && !SMAddon.SmVessel.SelectedResources.Contains(SMConditions.ResourceType.Science.ToString())) { SMAddon.SmVessel.SelectedResources.Clear(); } } // Set Gui.enabled for child settings to resources... GUI.enabled = SMSettings.EnableResources && isEnabled; // EnablePFResources Mode GUILayout.BeginHorizontal(); GUILayout.Space(20); //_label = "Enable Resources in Pre-Flight"; //_toolTip = "Turns on/off Fill and Empty Resources when in preflight."; //_toolTip += "\r\nWhen ON, Fill & Dump resources vessel wide are possible (shows in the Resource list)."; //_toolTip += "\r\nWhen Off, Fill and Dump Resources vessel wide will not appear in the resource list."; _label = SMUtils.Localize("#smloc_settings_realism_021"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_020"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnablePfResources = GUILayout.Toggle(SMSettings.EnablePfResources, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); // EnableXferCost Mode GUILayout.BeginHorizontal(); GUILayout.Space(20); //_label = "Resource Xfers Consume Power"; //_toolTip = "Turns on/off ElectricCharge cost forResource Xfers."; //_toolTip += "\r\nWhen ON, Resource transfers will consume ElectricCharge."; //_toolTip += "\r\nWhen Off, Resources Xfers consume no ElectricCharge."; _label = SMUtils.Localize("#smloc_settings_realism_022"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_021"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableXferCost = GUILayout.Toggle(SMSettings.EnableXferCost, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); // Resource Xfer EC cost float newCost; GUI.enabled = !SMSettings.LockSettings && SMSettings.EnableResources && SMSettings.EnableXferCost; GUILayout.BeginHorizontal(); GUILayout.Space(35); //_label = "Xfer Power Cost:"; //_toolTip = "Sets the Electrical cost of resource Xfers."; //_toolTip += "\r\nThe higher the number the more ElectricCharge used."; _label = SMUtils.Localize("#smloc_settings_realism_023") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_022"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(125), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } // Lets parse the string to allow decimal points. StrFlowCost = SMSettings.FlowCost.ToString(CultureInfo.InvariantCulture); // add the decimal point if it was typed. StrFlowCost = SMUtils.GetStringDecimal(StrFlowCost); // add the zero if it was typed. StrFlowCost = SMUtils.GetStringZero(StrFlowCost); StrFlowCost = GUILayout.TextField(StrFlowCost, 20, GUILayout.Height(20), GUILayout.Width(80)); //_label = "EC/Unit"; //_toolTip = "Sets the Electrical cost of resource Xfers when Realism Mode is on."; //_toolTip += "\r\nThe higher the number the more ElectricCharge used."; _label = SMUtils.Localize("#smloc_settings_realism_024"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_022"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(80), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); // update decimal bool SMUtils.SetStringDecimal(StrFlowCost); //update zero bool SMUtils.SetStringZero(StrFlowCost); if (float.TryParse(StrFlowCost, out newCost)) { SMSettings.FlowCost = newCost; } // create xfer Flow Rate slider; // Lets parse the string to allow decimal points. string strFlowRate = SMSettings.FlowRate.ToString(CultureInfo.InvariantCulture); string strMinFlowRate = SMSettings.MinFlowRate.ToString(CultureInfo.InvariantCulture); string strMaxFlowRate = SMSettings.MaxFlowRate.ToString(CultureInfo.InvariantCulture); string strMaxFlowTime = SMSettings.MaxFlowTimeSec.ToString(); float newRate; // Resource Flow Rate GUI.enabled = !SMSettings.LockSettings && SMSettings.EnableResources && SMSettings.RealXfers; GUILayout.BeginHorizontal(); GUILayout.Space(25); //_label = "Resource Flow Rate:"; //_toolTip = "Sets the rate that resources Xfer when Realistic Transfers is on."; //_toolTip += "\r\nThe higher the number the faster resources move."; //_toolTip += "\r\nYou can also use the slider below to change this value."; _label = SMUtils.Localize("#smloc_settings_realism_025") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_023"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(135), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } strFlowRate = GUILayout.TextField(strFlowRate, 20, GUILayout.Height(20), GUILayout.Width(80)); //_label = "Units/Sec"; //_toolTip = "Sets the rate that resources Xfer when Realism Mode is on."; //_toolTip += "\r\nThe higher the number the faster resources move."; //_toolTip += "\r\nYou can also use the slider below to change this value."; _label = SMUtils.Localize("#smloc_settings_realism_026"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_023"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(80), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); if (float.TryParse(strFlowRate, out newRate)) { SMSettings.FlowRate = (int)newRate; } // Resource Flow rate Slider GUILayout.BeginHorizontal(); GUILayout.Space(30); GUILayout.Label(SMSettings.MinFlowRate.ToString(CultureInfo.InvariantCulture), GUILayout.Width(10), GUILayout.Height(20)); SMSettings.FlowRate = GUILayout.HorizontalSlider((float)SMSettings.FlowRate, (float)SMSettings.MinFlowRate, (float)SMSettings.MaxFlowRate, GUILayout.Width(240), GUILayout.Height(20)); _label = SMSettings.MaxFlowRate.ToString(CultureInfo.InvariantCulture); //_toolTip = "Slide control to change the Resource Flow Rate shown above."; _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_024"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(40), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); // Min Flow Rate for Slider GUILayout.BeginHorizontal(); GUILayout.Space(30); //_label = " - Min Flow Rate:"; //_toolTip = "Sets the lower limit (left side) of the Flow rate Slider range."; _label = $" - {SMUtils.Localize("#smloc_settings_realism_027")}:"; _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_025"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(130), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } strMinFlowRate = GUILayout.TextField(strMinFlowRate, 20, GUILayout.Height(20), GUILayout.Width(80)); //_label = "Units/Sec"; //_toolTip = "Sets the lower limit (left side) of the Flow rate Slider range."; _label = SMUtils.Localize("#smloc_settings_realism_026"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_025"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(80), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); if (float.TryParse(strMinFlowRate, out newRate)) { SMSettings.MinFlowRate = (int)newRate; } // Max Flow Rate for Slider GUILayout.BeginHorizontal(); GUILayout.Space(30); //_label = " - Max Flow Rate:"; //_toolTip = "Sets the upper limit (right side) of the Flow rate Slider range."; _label = $" - {SMUtils.Localize("#smloc_settings_realism_028")}:"; _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_026"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(130), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } strMaxFlowRate = GUILayout.TextField(strMaxFlowRate, 20, GUILayout.Height(20), GUILayout.Width(80)); //_label = "Units/Sec"; //_toolTip = "Sets the upper limit (right side) of the Flow rate Slider range."; _label = SMUtils.Localize("#smloc_settings_realism_026"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_026"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(80), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); if (float.TryParse(strMaxFlowRate, out newRate)) { SMSettings.MaxFlowRate = (int)newRate; } // Max Flow Time GUILayout.BeginHorizontal(); GUILayout.Space(30); //_label = " - Max Flow Time:"; //_toolTip = "Sets the maximum duration (in sec) of a resource transfer."; //_toolTip += "\r\nWorks in conjunction with the Flow rate. if time it would take"; //_toolTip += "\r\n to move a resource exceeds this number, this number will be used"; //_toolTip += "\r\n to calculate an adjusted flow rate."; //_toolTip += "\r\n(protects you from long Xfers)"; _label = $" - {SMUtils.Localize("#smloc_settings_realism_029")}:"; _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_027"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(130), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } strMaxFlowTime = GUILayout.TextField(strMaxFlowTime, 20, GUILayout.Height(20), GUILayout.Width(80)); //_label = "Sec"; //_toolTip = "Sets the maximum duration (in sec) of a resource transfer."; //_toolTip += "\r\nWorks in conjunction with the Flow rate. if time it would take"; //_toolTip += "\r\n to move a resource exceeds this number, this number will be used"; //_toolTip += "\r\n to calculate an adjusted flow rate."; //_toolTip += "\r\n(protects you from long Xfers)"; _label = SMUtils.Localize("#smloc_settings_realism_030"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_027"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(80), GUILayout.Height(20)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.EndHorizontal(); if (float.TryParse(strMaxFlowTime, out newRate)) { SMSettings.MaxFlowTimeSec = (int)newRate; } // reset gui.enabled to default GUI.enabled = true; GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); // LockSettings Mode GUI.enabled = isEnabled; //_label = "Lock Realism Settings (If set ON, disable in config file)"; //_toolTip = "Locks the settings in this section so they cannot be altered in game."; //_toolTip += "\r\nTo turn off Locking you MUST edit the SMSettings.dat file."; _label = SMUtils.Localize("#smloc_settings_realism_031"); _toolTip = SMUtils.Localize("#smloc_settings_realism_tt_028"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.LockSettings = GUILayout.Toggle(SMSettings.LockSettings, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUI.enabled = true; GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); }
private static void DisplayActionButtons() { Rect rect; 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 = 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(); }
internal static void Display(Vector2 displayViewerPosition) { // Reset Tooltip active flag... ToolTipActive = false; _canShowToolTips = WindowSettings.ShowToolTips && ShowToolTips; Position = WindowSettings.Position; int scrollX = 20; GUI.enabled = true; GUILayout.Label(SMUtils.Localize("#smloc_settings_highlight_000"), SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); // EnableHighlighting Mode GUILayout.BeginHorizontal(); //_label = "Enable Highlighting"; //_toolTip = "Enables highlighting of all parts that contain the resource(s) selected in the Manifest Window."; //_toolTip += "\r\nThis is a global setting. Does not affect mouseover highlighting."; _label = SMUtils.Localize("#smloc_settings_highlight_001"); _toolTip = SMUtils.Localize("#smloc_settings_highlight_tt_001"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableHighlighting = GUILayout.Toggle(SMSettings.EnableHighlighting, _guiLabel, GUILayout.Width(300)); GUILayout.EndHorizontal(); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } if (SMSettings.EnableHighlighting != SMSettings.PrevEnableHighlighting && HighLogic.LoadedSceneIsFlight) { if (SMSettings.EnableCls) { if (SMAddon.SmVessel.SelectedResources.Contains(SMConditions.ResourceType.Crew.ToString())) { // Update spaces and reassign the resource to observe new settings. SMHighlighter.HighlightClsVessel(SMSettings.EnableHighlighting, true); SMAddon.UpdateClsSpaces(); SMAddon.SmVessel.SelectedResources.Clear(); SMAddon.SmVessel.SelectedResources.Add(SMConditions.ResourceType.Crew.ToString()); } } } // OnlySourceTarget Mode GUI.enabled = true; GUI.enabled = SMSettings.EnableHighlighting; GUILayout.BeginHorizontal(); GUILayout.Space(20); //_label = "Highlight Only Source / Target Parts"; //_toolTip = "Disables general highlighting of parts for a selected Resource or resources."; //_toolTip += "\r\nRestricts highlighting of parts to only the part or parts selected in the Transfer Window."; //_toolTip += "\r\nRequires 'Enable Highlighting' to be On."; _label = SMUtils.Localize("#smloc_settings_highlight_002"); _toolTip = SMUtils.Localize("#smloc_settings_highlight_tt_002"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.OnlySourceTarget = GUILayout.Toggle(SMSettings.OnlySourceTarget, _guiLabel, GUILayout.Width(300)); GUILayout.EndHorizontal(); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } if (SMSettings.OnlySourceTarget && (!SMSettings.PrevOnlySourceTarget || SMSettings.EnableClsHighlighting)) { SMSettings.EnableClsHighlighting = false; if (HighLogic.LoadedSceneIsFlight && SMSettings.EnableCls && SMAddon.SmVessel.SelectedResources.Contains(SMConditions.ResourceType.Crew.ToString())) { // Update spaces and reassign the resource to observe new settings. SMHighlighter.HighlightClsVessel(false, true); SMAddon.UpdateClsSpaces(); SMAddon.SmVessel.SelectedResources.Clear(); SMAddon.SmVessel.SelectedResources.Add(SMConditions.ResourceType.Crew.ToString()); } } // Enable CLS Highlighting Mode if (!SMSettings.EnableHighlighting || !SMSettings.EnableCls) { GUI.enabled = false; } else { GUI.enabled = true; } GUILayout.BeginHorizontal(); GUILayout.Space(20); //_label = "Enable CLS Highlighting"; //_toolTip = "Changes highlighting behavior if CLS is enabled & Crew selected in Manifest Window."; //_toolTip += "\r\nHighlights the parts associated with livable/passable spaces on vessel."; //_toolTip += "\r\nRequires 'Enable Highlighting' to be On and is mutually exclusive with "; //_toolTip += "\r\n'Highlight Only Source / Target Parts'."; _label = SMUtils.Localize("#smloc_settings_highlight_003"); _toolTip = SMUtils.Localize("#smloc_settings_highlight_tt_003"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableClsHighlighting = GUILayout.Toggle(SMSettings.EnableClsHighlighting, _guiLabel, GUILayout.Width(300)); GUILayout.EndHorizontal(); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } if (SMSettings.EnableClsHighlighting && (!SMSettings.PrevEnableClsHighlighting || SMSettings.OnlySourceTarget)) { SMSettings.OnlySourceTarget = false; } if (HighLogic.LoadedSceneIsFlight && SMSettings.EnableCls && SMAddon.SmVessel.SelectedResources.Contains(SMConditions.ResourceType.Crew.ToString()) && WindowTransfer.ShowWindow) { if (SMSettings.EnableClsHighlighting != SMSettings.PrevEnableClsHighlighting) { SMHighlighter.HighlightClsVessel(SMSettings.EnableClsHighlighting); } } // Enable Edge Highlighting Mode GUI.enabled = SMSettings.EnableHighlighting; GUILayout.BeginHorizontal(); //_label = "Enable Edge Highlighting (On Mouse Overs)"; //_toolTip = "Changes highlighting behavior when you mouseover a part button in Transfer Window."; //_toolTip += "\r\nCauses the edge of the part to glow, making it easier to see."; //_toolTip += "\r\nRequires Edge Highlighting to be enabled in the KSP Game settings."; _label = SMUtils.Localize("#smloc_settings_highlight_004"); _toolTip = SMUtils.Localize("#smloc_settings_highlight_tt_004"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableEdgeHighlighting = GUILayout.Toggle(SMSettings.EnableEdgeHighlighting, _guiLabel, GUILayout.Width(300)); GUILayout.EndHorizontal(); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } if (SMSettings.EnableEdgeHighlighting != SMSettings.PrevEnableEdgeHighlighting && HighLogic.LoadedSceneIsFlight) { if (SMSettings.EnableEdgeHighlighting == false) { if (SMAddon.SmVessel.SelectedResources.Count > 0) { List <Part> .Enumerator parts = SMAddon.SmVessel.SelectedResourcesParts.GetEnumerator(); while (parts.MoveNext()) { if (parts.Current == null) { continue; } SMHighlighter.EdgeHighight(parts.Current, false); } parts.Dispose(); } } } GUI.enabled = true; }
internal static void Display(int windowId) { Title = string.Format("{0} {1} - {2}", SMUtils.Localize("#smloc_manifest_002"), SMSettings.CurVersion, SMAddon.SmVessel.Vessel.vesselName); // set input locks when mouseover window... //_inputLocked = GuiUtils.PreventClickthrough(ShowWindow, Position, _inputLocked); // Reset Tooltip active flag... ToolTipActive = false; //GUIContent label = new GUIContent("", "Close Window"); GUIContent label = new GUIContent("", SMUtils.Localize("#smloc_window_tt_001")); if (SMConditions.IsTransferInProgress()) { //label = new GUIContent("", "Action in progress. Cannot close window"); label = new GUIContent("", SMUtils.Localize("#smloc_window_tt_002")); GUI.enabled = false; } Rect rect = new Rect(Position.width - 20, 4, 16, 16); if (GUI.Button(rect, label)) { SMAddon.OnSmButtonClicked(); ToolTip = ""; SMHighlighter.Update_Highlighter(); } if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUI.enabled = true; try { GUILayout.BeginVertical(); _smScrollViewerPosition = GUILayout.BeginScrollView(_smScrollViewerPosition, SMStyle.ScrollStyle, GUILayout.Height(100), GUILayout.Width(300)); GUILayout.BeginVertical(); // Prelaunch (landed) Gui if (SMConditions.IsInPreflight()) { PreLaunchGui(); } // Now the Resource Buttons ResourceButtonsList(); GUILayout.EndVertical(); GUILayout.EndScrollView(); //string resLabel = "No Resource Selected"; string resLabel = SMUtils.Localize("#smloc_manifest_003"); if (SMAddon.SmVessel.SelectedResources.Count == 1) { resLabel = SMAddon.SmVessel.SelectedResources[0]; } else if (SMAddon.SmVessel.SelectedResources.Count == 2) { //resLabel = "Multiple Resources selected"; resLabel = SMUtils.Localize("#smloc_manifest_004"); } GUILayout.Label(string.Format("{0}", resLabel), GUILayout.Width(300), GUILayout.Height(20)); // Resource Details List Viewer ResourceDetailsViewer(); // Window toggle Button List WindowToggleButtons(); GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, Screen.width, 30)); SMAddon.RepositionWindow(ref Position); } catch (Exception ex) { if (!SMAddon.FrameErrTripped) { SMUtils.LogMessage( string.Format(" in WindowManifest.Display. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); SMAddon.FrameErrTripped = true; } } }
internal static bool CanKerbalsBeXferred(List <Part> selectedPartsSource, List <Part> selectedPartsTarget) { bool results = true; WindowTransfer.XferToolTip = ""; try { if (IsTransferInProgress()) { //WindowTransfer.XferToolTip = "Transfer in progress. Xfers disabled."; WindowTransfer.XferToolTip = SMUtils.Localize("#smloc_conditions_tt_001"); return(false); } if (selectedPartsSource.Count == 0 || selectedPartsTarget.Count == 0) { WindowTransfer.XferToolTip = SMUtils.Localize("#smloc_conditions_tt_002"); // "Source or Target Part is not selected.\r\nPlease Select a Source AND a Target part."; return(false); } if (selectedPartsSource[0] == selectedPartsTarget[0]) { WindowTransfer.XferToolTip = SMUtils.Localize("#smloc_conditions_tt_003"); // "Source and Target Part are the same.\r\nUse Move Kerbal (>>) instead."; return(false); } // If one of the parts is a DeepFreeze part and no crew are showing in protoModuleCrew, check it isn't full of frozen Kerbals. // This is to prevent SM from Transferring crew into a DeepFreeze part that is full of frozen kerbals. // If there is just one spare seat or seat taken by a Thawed Kerbal that is OK because SM will just transfer them into the empty // seat or swap them with a thawed Kerbal. DFWrapper.DeepFreezer sourcepartFrzr = null; // selectedPartsSource[0].FindModuleImplementing<DFWrapper.DeepFreezer>(); DFWrapper.DeepFreezer targetpartFrzr = null; // selectedPartsTarget[0].FindModuleImplementing<DFWrapper.DeepFreezer>(); PartModule sourcedeepFreezer = GetFreezerModule(selectedPartsSource[0]); if (sourcedeepFreezer != null) { sourcepartFrzr = new DFWrapper.DeepFreezer(sourcedeepFreezer); } PartModule targetdeepFreezer = GetFreezerModule(selectedPartsTarget[0]); if (targetdeepFreezer != null) { targetpartFrzr = new DFWrapper.DeepFreezer(targetdeepFreezer); } if (sourcepartFrzr != null) { if (sourcepartFrzr.FreezerSpace == 0) { WindowTransfer.XferToolTip = SMUtils.Localize("#smloc_conditions_tt_004"); // "DeepFreeze Part is full of frozen kerbals.\r\nCannot Xfer until some are thawed."; return(false); } } if (targetpartFrzr != null) { if (targetpartFrzr.FreezerSpace == 0) { WindowTransfer.XferToolTip = SMUtils.Localize("#smloc_conditions_tt_004"); // "DeepFreeze Part is full of frozen kerbals.\r\nCannot Xfer until some are thawed."; return(false); } } // Are there kerbals to move? if (selectedPartsSource[0].protoModuleCrew.Count == 0) { //WindowTransfer.XferToolTip = "No Kerbals to Move."; WindowTransfer.XferToolTip = SMUtils.Localize("#smloc_conditions_tt_005"); return(false); } // now if realistic xfers is enabled, are the parts connected to each other in the same living space? results = IsClsInSameSpace(selectedPartsSource[0], selectedPartsTarget[0]); if (!results) { WindowTransfer.EvaToolTip = SMUtils.Localize("#smloc_conditions_tt_006"); } // "CLS is preventing internal Crew Transfer. Click to initiate EVA operation."; else { WindowTransfer.XferToolTip = SMUtils.Localize("#smloc_conditions_tt_007"); } // "Kerbal can be Transfered."; } catch (Exception ex) { SMUtils.LogMessage(string.Format(" in CanBeXferred. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } return(results); }
internal static void Display(Vector2 displayViewerPosition) { //float scrollX = WindowControl.Position.x + 10; //float scrollY = WindowControl.Position.y + 50 - displayViewerPosition.y; float scrollX = 10; float scrollY = 50 - displayViewerPosition.y; // Reset Tooltip active flag... ToolTipActive = false; SMHighlighter.IsMouseOver = false; GUILayout.BeginVertical(); GUI.enabled = true; //GUILayout.Label("Deployable Solar Panel Control Center ", SMStyle.LabelTabHeader); GUILayout.Label(SMUtils.Localize("#smloc_control_panel_000"), SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); string step = "start"; try { // Display all hatches List <ModSolarPanel> .Enumerator iPanels = SMAddon.SmVessel.SolarPanels.GetEnumerator(); while (iPanels.MoveNext()) { if (iPanels.Current == null) { continue; } bool isEnabled = true; string label = iPanels.Current.PanelStatus + " - " + iPanels.Current.Title; if (iPanels.Current.PanelState == ModuleDeployablePart.DeployState.BROKEN) { isEnabled = false; label = iPanels.Current.PanelStatus + " - (Broken) - " + iPanels.Current.Title; } bool open = !(iPanels.Current.PanelState == ModuleDeployablePart.DeployState.RETRACTED || iPanels.Current.PanelState == ModuleDeployablePart.DeployState.RETRACTING || iPanels.Current.PanelState == ModuleDeployablePart.DeployState.BROKEN); step = "gui enable"; GUI.enabled = isEnabled; if (!iPanels.Current.CanBeRetracted) { label = iPanels.Current.PanelStatus + " - (Locked) - " + iPanels.Current.Title; } bool newOpen = GUILayout.Toggle(open, label, GUILayout.Width(325), GUILayout.Height(40)); step = "button toggle check"; if (!open && newOpen) { iPanels.Current.ExtendPanel(); } else if (open && !newOpen) { iPanels.Current.RetractPanel(); } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.IsMouseOver = true; SMHighlighter.MouseOverRect = new Rect(scrollX + rect.x, scrollY + rect.y, rect.width, rect.height); SMHighlighter.MouseOverPart = iPanels.Current.SPart; SMHighlighter.MouseOverParts = null; } } iPanels.Dispose(); // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SMUtils.LogMessage( string.Format(" in Solar Panel Tab at step {0}. Error: {1} \r\n\r\n{2}", step, ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } GUILayout.EndVertical(); }
internal static void Display(Vector2 displayViewerPosition) { //float scrollX = WindowControl.Position.x; //float scrollY = WindowControl.Position.y + 50 - displayViewerPosition.y; float scrollX = 0; float scrollY = 50 - displayViewerPosition.y; // Reset Tooltip active flag... ToolTipActive = false; SMHighlighter.IsMouseOver = false; GUILayout.BeginVertical(); GUI.enabled = true; GUILayout.Label( //InstalledMods.IsRtInstalled ? "Antenna Control Center (RemoteTech detected)" : "Antenna Control Center ", InstalledMods.IsRtInstalled ? SMUtils.Localize("#smloc_control_antenna_001") : SMUtils.Localize("#smloc_control_antenna_000"), SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); string step = "start"; try { // Display all antennas List <ModAntenna> .Enumerator iAntennas = SMAddon.SmVessel.Antennas.GetEnumerator(); while (iAntennas.MoveNext()) { if (iAntennas.Current == null) { continue; } if (!IsRtAntennas && iAntennas.Current.IsRtModule) { IsRtAntennas = true; } step = "get Antenna label"; string label = iAntennas.Current.AntennaStatus + " - " + iAntennas.Current.Title; bool open = iAntennas.Current.Extended; bool newOpen = GUILayout.Toggle(open, label, GUILayout.Width(325), GUILayout.Height(40)); step = "button toggle check"; if (!open && newOpen) { iAntennas.Current.ExtendAntenna(); } else if (open && !newOpen) { iAntennas.Current.RetractAntenna(); } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.IsMouseOver = true; SMHighlighter.MouseOverRect = new Rect(scrollX + rect.x, scrollY + rect.y, rect.width, rect.height); SMHighlighter.MouseOverPart = iAntennas.Current.SPart; SMHighlighter.MouseOverParts = null; } } iAntennas.Dispose(); // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SMUtils.LogMessage( string.Format(" in Antenna Tab at step {0}. Error: {1} \r\n\r\n{2}", step, ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } GUILayout.EndVertical(); }
internal static void DisplayTabActions() { GUILayout.BeginHorizontal(); switch (_selectedTab) { case Tab.Panel: GUI.enabled = SMAddon.SmVessel.SolarPanels.Count > 0 && (!SMSettings.RealControl || SMConditions.IsShipControllable()); if (GUILayout.Button(SMUtils.Localize("#smloc_control_016"), GUILayout.Height(20))) // "Retract All Solar Panels" { TabSolarPanel.RetractAllPanels(); } if (GUILayout.Button(SMUtils.Localize("#smloc_control_007"), GUILayout.Height(20))) // "Extend All Solar Panels" { TabSolarPanel.ExtendAllPanels(); } break; case Tab.Hatch: GUI.enabled = SMAddon.SmVessel.Hatches.Count > 0 && (!SMSettings.RealControl || SMConditions.IsShipControllable()); if (GUILayout.Button(SMUtils.Localize("#smloc_control_008"), GUILayout.Height(20))) // "Close All Hatches" { TabHatch.CloseAllHatches(); } if (GUILayout.Button(SMUtils.Localize("#smloc_control_009"), GUILayout.Height(20))) // "Open All Hatches" { TabHatch.OpenAllHatches(); } break; case Tab.Antenna: GUI.enabled = SMAddon.SmVessel.Antennas.Count > 0 && (!SMSettings.RealControl || SMConditions.IsShipControllable()); if (GUILayout.Button(SMUtils.Localize("#smloc_control_010"), GUILayout.Height(20))) // "Retract All Antennas" { TabAntenna.RetractAllAntennas(); } if (GUILayout.Button(SMUtils.Localize("#smloc_control_011"), GUILayout.Height(20))) // "Extend All Antennas" { TabAntenna.ExtendAllAntennas(); } break; case Tab.Light: GUI.enabled = SMAddon.SmVessel.Lights.Count > 0 && (!SMSettings.RealControl || SMConditions.IsShipControllable()); if (GUILayout.Button(SMUtils.Localize("#smloc_control_012"), GUILayout.Height(20))) // "Turn Off All Lights" { TabLight.TurnOffAllLights(); } if (GUILayout.Button(SMUtils.Localize("#smloc_control_013"), GUILayout.Height(20))) // "Turn On All Lights" { TabLight.TurnOnAllLights(); } break; case Tab.Lab: GUI.enabled = SMAddon.SmVessel.Labs.Count > 0 && (!SMSettings.RealControl || SMConditions.IsShipControllable()); if (GUILayout.Button(SMUtils.Localize("#smloc_control_014"), GUILayout.Height(20))) // "Turn Off All Labs" { TabLight.TurnOffAllLights(); } if (GUILayout.Button(SMUtils.Localize("#smloc_control_015"), GUILayout.Height(20))) // "Turn On All Labs" { TabLight.TurnOnAllLights(); } break; case Tab.None: break; default: throw new ArgumentOutOfRangeException(); } GUI.enabled = true; GUILayout.EndHorizontal(); }
private static void DisplayRosterListViewer() { try { GUILayout.BeginVertical(); // Roster List Header... GUILayout.BeginHorizontal(); //GUILayout.Label("", GUILayout.Width(5)); GUILayout.Label(SMUtils.Localize("#smloc_roster_016"), GUILayout.Width(140)); // "Name" GUILayout.Label(SMUtils.Localize("#smloc_roster_017"), GUILayout.Width(50)); // "Gender" GUILayout.Label(SMUtils.Localize("#smloc_roster_005"), GUILayout.Width(70)); // "Profession" GUILayout.Label(SMUtils.Localize("#smloc_roster_018"), GUILayout.Width(30)); // "Skill" GUILayout.Label(SMUtils.Localize("#smloc_roster_019"), GUILayout.Width(220)); // "Status" GUILayout.Label(SMUtils.Localize("#smloc_roster_020"), GUILayout.Width(55)); // "Edit" GUILayout.Label(SMUtils.Localize("#smloc_roster_021"), GUILayout.Width(65)); // "Action" GUILayout.EndHorizontal(); _scrollViewerPosition = GUILayout.BeginScrollView(_scrollViewerPosition, SMStyle.ScrollStyle, GUILayout.Height(230), GUILayout.Width(680)); // vars for acton to occurs after button press bool isAction = false; Part actionPart = null; string actionText = ""; ProtoCrewMember actionKerbal = null; List <ProtoCrewMember> .Enumerator kerbals = RosterList.GetEnumerator(); while (kerbals.MoveNext()) { if (kerbals.Current == null) { continue; } if (!CanDisplayKerbal(kerbals.Current)) { continue; } GUIStyle labelStyle; if (kerbals.Current.rosterStatus == ProtoCrewMember.RosterStatus.Dead || kerbals.Current.rosterStatus == ProtoCrewMember.RosterStatus.Missing) { labelStyle = SMStyle.LabelStyleRed; } else if (kerbals.Current.rosterStatus == ProtoCrewMember.RosterStatus.Assigned) { labelStyle = SMStyle.LabelStyleYellow; } else { labelStyle = SMStyle.LabelStyle; } // What vessel is this Kerbal Assigned to? string rosterDetails = ""; if (kerbals.Current.rosterStatus == ProtoCrewMember.RosterStatus.Assigned) { List <Vessel> .Enumerator theseVessels = FlightGlobals.Vessels.GetEnumerator(); while (theseVessels.MoveNext()) { if (theseVessels.Current == null) { continue; } List <ProtoCrewMember> crew = theseVessels.Current.GetVesselCrew(); if (crew.Any(crewMember => crewMember == kerbals.Current)) { rosterDetails = string.Format("{0} - {1}", SMUtils.Localize("#smloc_roster_011"), theseVessels.Current.GetName().Replace("(unloaded)", "")); // "Assigned" } } theseVessels.Dispose(); } else if (InstalledMods.IsDfInstalled && DFWrapper.APIReady && kerbals.Current.type == ProtoCrewMember.KerbalType.Unowned) { // This kerbal could be frozen. Lets find out... rosterDetails = GetFrozenKerbalDetails(kerbals.Current); labelStyle = SMStyle.LabelStyleCyan; } else { // Since the kerbal has no vessel assignment, lets show what their status... rosterDetails = kerbals.Current.rosterStatus.ToString(); } string buttonText; string buttonToolTip; GUILayout.BeginHorizontal(); GUILayout.Label(kerbals.Current.name, labelStyle, GUILayout.Width(140), GUILayout.Height(20)); GUILayout.Label(kerbals.Current.gender.ToString(), labelStyle, GUILayout.Width(50)); GUILayout.Label(kerbals.Current.experienceTrait.Title, labelStyle, GUILayout.Width(70)); GUILayout.Label(kerbals.Current.experienceLevel.ToString(), labelStyle, GUILayout.Width(30)); GUILayout.Label(rosterDetails, labelStyle, GUILayout.Width(215)); SetupEditButton(kerbals.Current, out buttonText, out buttonToolTip); if (GUILayout.Button(new GUIContent(buttonText, buttonToolTip), GUILayout.Width(55), GUILayout.Height(20), GUILayout.Height(20))) { if (SelectedKerbal == null || SelectedKerbal.Kerbal != kerbals.Current) { SelectedKerbal = new ModKerbal(kerbals.Current, false); SetProfessionFlag(); } else { SelectedKerbal = null; } } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, XOffset); } // Setup buttons with gui state, button text and tooltip. SetupActionButton(kerbals.Current, out buttonText, out buttonToolTip); if (GUILayout.Button(new GUIContent(buttonText, buttonToolTip), GUILayout.Width(65), GUILayout.Height(20))) { isAction = true; actionKerbal = kerbals.Current; actionText = buttonText; if (actionText == SMUtils.Localize("#smloc_roster_022")) // "Remove" { actionPart = SMAddon.SmVessel.FindPartByKerbal(kerbals.Current); } } Rect rect2 = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect2, GUI.tooltip, ref ToolTipActive, XOffset); } GUILayout.EndHorizontal(); GUI.enabled = true; } kerbals.Dispose(); GUILayout.EndVertical(); GUILayout.EndScrollView(); // perform action from button press. if (!isAction) { return; } if (actionText == SMUtils.Localize("#smloc_roster_022")) // "Remove" { TransferCrew.RemoveCrewMember(actionKerbal, actionPart); } else if (actionText == SMUtils.Localize("#smloc_roster_023")) // "Add" { TransferCrew.AddCrewMember(actionKerbal, SMAddon.SmVessel.SelectedPartsSource[0]); } else if (actionText == SMUtils.Localize("#smloc_roster_024")) // "Respawn" { RespawnKerbal(actionKerbal); } else if (actionText == SMUtils.Localize("#smloc_roster_025")) // "Thaw" { ThawKerbal(actionKerbal.name); } else if (actionText == SMUtils.Localize("#smloc_roster_026"))// "Freeze" { FreezeKerbal(actionKerbal); } SMAddon.FireEventTriggers(); } catch (Exception ex) { if (!SMAddon.FrameErrTripped) { SMUtils.LogMessage(string.Format(" in RosterListViewer. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } }
internal static void DisplayWindowTabs() { Rect rect; GUILayout.BeginHorizontal(); GUIContent label; if (SMSettings.EnableCls) { label = new GUIContent(SMUtils.Localize("#smloc_control_002"), SMUtils.Localize("#smloc_control_tt_001")); GUIStyle hatchesStyle = _selectedTab == Tab.Hatch ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(label, hatchesStyle, GUILayout.Height(20))) // "Hatches" { try { SMAddon.UpdateClsSpaces(); SMAddon.SmVessel.GetHatches(); _selectedTab = Tab.Hatch; } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Hatches Tab. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } } GUI.enabled = true; label = new GUIContent(SMUtils.Localize("#smloc_control_003"), SMUtils.Localize("#smloc_control_tt_002")); GUIStyle panelsStyle = _selectedTab == Tab.Panel ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(label, panelsStyle, GUILayout.Height(20))) // "Solar Panels" { try { SMAddon.SmVessel.GetSolarPanels(); _selectedTab = Tab.Panel; } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Solar Panels Tab. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } label = new GUIContent(SMUtils.Localize("#smloc_control_004"), SMUtils.Localize("#smloc_control_tt_003")); GUIStyle antennaStyle = _selectedTab == Tab.Antenna ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(label, antennaStyle, GUILayout.Height(20))) // "Antennas" { try { SMAddon.SmVessel.GetAntennas(); _selectedTab = Tab.Antenna; } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Antennas Tab. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } label = new GUIContent(SMUtils.Localize("#smloc_control_005"), SMUtils.Localize("#smloc_control_tt_004")); GUIStyle lightsStyle = _selectedTab == Tab.Light ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(label, lightsStyle, GUILayout.Height(20))) // "Lights" { try { SMAddon.SmVessel.GetLights(); _selectedTab = Tab.Light; } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Lights Tab. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } label = new GUIContent(SMUtils.Localize("#smloc_control_006"), SMUtils.Localize("#smloc_control_tt_005")); GUIStyle labsStyle = _selectedTab == Tab.Lab ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(label, labsStyle, GUILayout.Height(20))) // "Labs" { try { SMAddon.SmVessel.GetLabs(); _selectedTab = Tab.Lab; } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Labs Tab. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.EndHorizontal(); }
private static void EditKerbalViewer() { //GUILayout.Label(SelectedKerbal.IsNew ? "Create Kerbal" : "Edit Kerbal"); GUILayout.Label(SelectedKerbal.IsNew ? SMUtils.Localize("#smloc_roster_002") : SMUtils.Localize("#smloc_roster_027")); if (SMSettings.EnableKerbalRename) { GUILayout.BeginHorizontal(); SelectedKerbal.Name = GUILayout.TextField(SelectedKerbal.Name, GUILayout.MaxWidth(300)); GUILayout.Label(" - (" + SelectedKerbal.Kerbal.experienceTrait.Title + ")"); GUILayout.EndHorizontal(); } else { GUILayout.Label(SelectedKerbal.Name + " - (" + SelectedKerbal.Trait + ")", SMStyle.LabelStyleBold, GUILayout.MaxWidth(300)); } if (!string.IsNullOrEmpty(SMAddon.SaveMessage)) { GUILayout.Label(SMAddon.SaveMessage, SMStyle.ErrorLabelRedStyle); } if (SMSettings.EnableKerbalRename && SMSettings.EnableChangeProfession) { DisplaySelectProfession(); } bool isMale = ProtoCrewMember.Gender.Male == SelectedKerbal.Gender; GUILayout.BeginHorizontal(); GUILayout.Label(SMUtils.Localize("#smloc_roster_017"), GUILayout.Width(85)); // "Gender" isMale = GUILayout.Toggle(isMale, ProtoCrewMember.Gender.Male.ToString(), GUILayout.Width(90)); isMale = GUILayout.Toggle(!isMale, ProtoCrewMember.Gender.Female.ToString()); SelectedKerbal.Gender = isMale ? ProtoCrewMember.Gender.Female : ProtoCrewMember.Gender.Male; GUILayout.EndHorizontal(); GUILayout.Label(SMUtils.Localize("#smloc_roster_029")); // "Courage" SelectedKerbal.Courage = GUILayout.HorizontalSlider(SelectedKerbal.Courage, 0, 1, GUILayout.MaxWidth(300)); GUILayout.Label(SMUtils.Localize("#smloc_roster_030")); // "Stupidity" SelectedKerbal.Stupidity = GUILayout.HorizontalSlider(SelectedKerbal.Stupidity, 0, 1, GUILayout.MaxWidth(300)); SelectedKerbal.Badass = GUILayout.Toggle(SelectedKerbal.Badass, SMUtils.Localize("#smloc_roster_031"), GUILayout.Height(30)); // "Badass" GUILayout.BeginHorizontal(); if (GUILayout.Button(SMUtils.Localize("#smloc_roster_004"), GUILayout.MaxWidth(50))) // "Cancel" { SelectedKerbal = null; } string label = SMUtils.Localize("#smloc_roster_028"); // "Apply" //string toolTip = "Applies the changes made to this Kerbal.\r\nDesired Name and Profession will be Retained after save."; string toolTip = SMUtils.Localize("#smloc_roster_tt_006"); if (GUILayout.Button(new GUIContent(label, toolTip), GUILayout.MaxWidth(50))) { if (SMSettings.EnableKerbalRename && SMSettings.EnableChangeProfession) { if (SelectedKerbal != null) { SelectedKerbal.Trait = KerbalProfession.ToString(); } } if (SelectedKerbal != null) { SMAddon.SaveMessage = SelectedKerbal.SubmitChanges(); GetRosterList(); if (string.IsNullOrEmpty(SMAddon.SaveMessage)) { SelectedKerbal = null; } } } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.EndHorizontal(); }
private static void ResourceButtonsList() { try { // List required here to prevent loop sync errors with live source. List <string> .Enumerator keys = SMAddon.SmVessel.PartsByResource.Keys.ToList().GetEnumerator(); while (keys.MoveNext()) { if (string.IsNullOrEmpty(keys.Current)) { continue; } GUILayout.BeginHorizontal(); // Button Widths int width = 273; if (!SMSettings.RealXfers && SMConditions.IsResourceTypeOther(keys.Current)) { width = 185; } else if (SMConditions.IsResourceTypeOther(keys.Current)) { width = 223; } // Resource Button string displayAmounts = string.Format("{0}{1}", keys.Current, SMUtils.DisplayVesselResourceTotals(keys.Current)); GUIStyle style = SMAddon.SmVessel.SelectedResources.Contains(keys.Current) ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(displayAmounts, style, GUILayout.Width(width), GUILayout.Height(20))) { ResourceButtonToggled(keys.Current); SMHighlighter.Update_Highlighter(); } // Dump Button if (SMConditions.IsResourceTypeOther(keys.Current) && SMAddon.SmVessel.PartsByResource[keys.Current].Count > 0) { uint pumpId = TransferPump.GetPumpIdFromHash(keys.Current, SMAddon.SmVessel.PartsByResource[keys.Current].First(), SMAddon.SmVessel.PartsByResource[keys.Current].Last(), TransferPump.TypePump.Dump, TransferPump.TriggerButton.Manifest); GUIContent dumpContent = !TransferPump.IsPumpInProgress(pumpId) ? new GUIContent(SMUtils.Localize("#smloc_manifest_009"), SMUtils.Localize("#smloc_manifest_tt_001")) // "Dump", "Dumps the selected resource in this vessel" : new GUIContent(SMUtils.Localize("#smloc_manifest_010"), SMUtils.Localize("#smloc_manifest_tt_002")); // "Stop", "Halts the dumping of the selected resource in this vessel" GUI.enabled = SMConditions.CanResourceBeDumped(keys.Current); if (GUILayout.Button(dumpContent, SMStyle.ButtonStyle, GUILayout.Width(45), GUILayout.Height(20))) { SMVessel.ToggleDumpResource(keys.Current, pumpId); } } // Fill Button if (!SMSettings.RealXfers && SMConditions.IsResourceTypeOther(keys.Current) && SMAddon.SmVessel.PartsByResource[keys.Current].Count > 0) { GUI.enabled = SMConditions.CanResourceBeFilled(keys.Current); if (GUILayout.Button(string.Format("{0}", SMUtils.Localize("#smloc_manifest_011")), SMStyle.ButtonStyle, GUILayout.Width(35), GUILayout.Height(20))) // "Fill" { SMAddon.SmVessel.FillResource(keys.Current); } } GUI.enabled = true; GUILayout.EndHorizontal(); } keys.Dispose(); } catch (Exception ex) { if (!SMAddon.FrameErrTripped) { SMUtils.LogMessage( string.Format(" in WindowManifest.ResourceButtonList. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); SMAddon.FrameErrTripped = true; } } }
private static void DisplayTabButtons() { GUILayout.BeginHorizontal(); GUIStyle realismStyle = _selectedTab == Tab.Realism ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; GUIContent label = new GUIContent(SMUtils.Localize("#smloc_settings_004"), SMUtils.Localize("#smloc_settings_tt_004")); if (GUILayout.Button(label, realismStyle, GUILayout.Height(20))) { _selectedTab = Tab.Realism; } GUI.enabled = true; Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUIStyle highlightStyle = _selectedTab == Tab.Highlight ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; //label = new GUIContent("Highlight", "This tab shows all settings related to highlighting."); label = new GUIContent(SMUtils.Localize("#smloc_settings_005"), SMUtils.Localize("#smloc_settings_tt_005")); if (GUILayout.Button(label, highlightStyle, GUILayout.Height(20))) { _selectedTab = Tab.Highlight; } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUIStyle tooltipStyle = _selectedTab == Tab.ToolTips ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; //label = new GUIContent("ToolTip", "This tab shows all settings related to tooltip behavior."); label = new GUIContent(SMUtils.Localize("#smloc_settings_006"), SMUtils.Localize("#smloc_settings_tt_006")); if (GUILayout.Button(label, tooltipStyle, GUILayout.Height(20))) { _selectedTab = Tab.ToolTips; } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUIStyle soundStyle = _selectedTab == Tab.Sounds ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; //label = new GUIContent("Sound", "This tab shows all settings related to sounds."); label = new GUIContent(SMUtils.Localize("#smloc_settings_007"), SMUtils.Localize("#smloc_settings_tt_007")); if (GUILayout.Button(label, soundStyle, GUILayout.Height(20))) { _selectedTab = Tab.Sounds; } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUIStyle configStyle = _selectedTab == Tab.Config ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; //label = new GUIContent("Config", "This tab shows all settings related to sounds."); label = new GUIContent(SMUtils.Localize("#smloc_settings_008"), SMUtils.Localize("#smloc_settings_tt_008")); if (GUILayout.Button(label, configStyle, GUILayout.Height(20))) { _selectedTab = Tab.Config; } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.EndHorizontal(); }
private static void WindowToggleButtons() { GUILayout.BeginHorizontal(); GUIStyle settingsStyle = WindowSettings.ShowWindow ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_012"), settingsStyle, GUILayout.Height(20))) // "Settings" { try { WindowSettings.ShowWindow = !WindowSettings.ShowWindow; if (WindowSettings.ShowWindow) { // Store settings in case we cancel later... SMSettings.MemStoreTempSettings(); } } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Settings Window. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } GUIStyle rosterStyle = WindowRoster.ShowWindow ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_013"), rosterStyle, GUILayout.Height(20))) // "Roster" { try { WindowRoster.ShowWindow = !WindowRoster.ShowWindow; if (WindowRoster.ShowWindow) { WindowRoster.GetRosterList(); } else { WindowRoster.SelectedKerbal = null; WindowRoster.ToolTip = ""; } } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Roster Window. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } GUIStyle controlStyle = WindowControl.ShowWindow ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_014"), controlStyle, GUILayout.Height(20))) // "Control" { try { WindowControl.ShowWindow = !WindowControl.ShowWindow; } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Control Window. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } GUILayout.EndHorizontal(); }
internal static void Display(Vector2 displayViewerPosition) { // Reset Tooltip active flag... ToolTipActive = false; _canShowToolTips = WindowSettings.ShowToolTips && ShowToolTips; Position = WindowSettings.Position; int scrollX = 20; //GUILayout.Label("Configuraton", SMStyle.LabelTabHeader); GUILayout.Label(SMUtils.Localize("#smloc_settings_config_000"), SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); if (!ToolbarManager.ToolbarAvailable) { if (SMSettings.EnableBlizzyToolbar) { SMSettings.EnableBlizzyToolbar = false; } GUI.enabled = false; } else { GUI.enabled = true; } //_label = "Enable Blizzy Toolbar (Replaces Stock Toolbar)"; //_toolTip = "Switches the toolbar Icons over to Blizzy's toolbar, if installed."; //_toolTip += "\r\nIf Blizzy's toolbar is not installed, option is not selectable."; _label = SMUtils.Localize("#smloc_settings_config_001"); _toolTip = SMUtils.Localize("#smloc_settings_config_tt_001"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableBlizzyToolbar = GUILayout.Toggle(SMSettings.EnableBlizzyToolbar, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUI.enabled = true; // UnityStyle Mode //_label = "Enable Unity Style GUI Interface"; //_toolTip = "Changes all window appearances to Unity's Default look (like Mech Jeb)."; //_toolTip += "\r\nWhen Off, all windows look like KSP style windows."; _label = SMUtils.Localize("#smloc_settings_config_002"); _toolTip = SMUtils.Localize("#smloc_settings_config_tt_002"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.UseUnityStyle = GUILayout.Toggle(SMSettings.UseUnityStyle, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } if (SMSettings.UseUnityStyle != SMSettings.PrevUseUnityStyle) { SMStyle.WindowStyle = null; } //_label = "Enable Debug Window"; //_toolTip = "Turns on or off the SM Debug window."; //_toolTip += "\r\nAllows viewing log entries / errors generated by SM."; _label = SMUtils.Localize("#smloc_settings_config_003"); _toolTip = SMUtils.Localize("#smloc_settings_config_tt_003"); _guiLabel = new GUIContent(_label, _toolTip); WindowDebugger.ShowWindow = GUILayout.Toggle(WindowDebugger.ShowWindow, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } //_label = "Enable Verbose Logging"; //_toolTip = "Turns on or off Expanded logging in the Debug Window."; //_toolTip += "\r\nAids in troubleshooting issues in SM"; _label = SMUtils.Localize("#smloc_settings_config_004"); _toolTip = SMUtils.Localize("#smloc_settings_config_tt_004"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.VerboseLogging = GUILayout.Toggle(SMSettings.VerboseLogging, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } //_label = "Enable SM Debug Window On Error"; //_toolTip = "When On, Ship Manifest automatically displays the SM Debug window on an error in SM."; //_toolTip += "\r\nThis is a troubleshooting aid."; _label = SMUtils.Localize("#smloc_settings_config_005"); _toolTip = SMUtils.Localize("#smloc_settings_config_tt_005"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.AutoDebug = GUILayout.Toggle(SMSettings.AutoDebug, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } //_label = "Save Error log on Exit"; //_toolTip = "When On, Ship Manifest automatically saves the SM debug log on game exit."; //_toolTip += "\r\nThis is a troubleshooting aid."; _label = SMUtils.Localize("#smloc_settings_config_006"); _toolTip = SMUtils.Localize("#smloc_settings_config_tt_006"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.SaveLogOnExit = GUILayout.Toggle(SMSettings.SaveLogOnExit, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } // create Limit Error Log Length slider; GUILayout.BeginHorizontal(); //_label = "Error Log Length: "; //_toolTip = "Sets the maximum number of error entries stored in the log."; //_toolTip += "\r\nAdditional entries will cause first entries to be removed from the log (rolling)."; //_toolTip += "\r\nSetting this value to '0' will allow unlimited entries."; _label = SMUtils.Localize("#smloc_settings_config_007") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_config_tt_007"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(110)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } SMSettings.ErrorLogLength = GUILayout.TextField(SMSettings.ErrorLogLength, GUILayout.Width(40)); GUILayout.Label("(lines)", GUILayout.Width(50)); GUILayout.EndHorizontal(); //_label = "Enable AutoSave Settings"; //_toolTip = "When On, SM automatically saves changes made to settings on a regular interval."; _label = SMUtils.Localize("#smloc_settings_config_008"); _toolTip = SMUtils.Localize("#smloc_settings_config_tt_008"); _guiLabel = new GUIContent(_label, _toolTip); SMSettings.AutoSave = GUILayout.Toggle(SMSettings.AutoSave, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUILayout.BeginHorizontal(); //_label = "Save Interval: "; //_toolTip = "Sets the time (in seconds) between automatic saves."; //_toolTip += "\r\nAutosave Settings must be enabled."; _label = SMUtils.Localize("#smloc_settings_config_009") + ":"; _toolTip = SMUtils.Localize("#smloc_settings_config_tt_009"); _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(110)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } TxtSaveInterval = GUILayout.TextField(TxtSaveInterval, GUILayout.Width(40)); //GUILayout.Label("(sec)", GUILayout.Width(40)); GUILayout.Label(SMUtils.Localize("#smloc_settings_config_010"), GUILayout.Width(40)); GUILayout.EndHorizontal(); }