private static void DisplayActionButtons() { GUILayout.BeginHorizontal(); // Save GUIContent label = new GUIContent(Localizer.Format("#autoLOC_RM_1053"), Localizer.Format("#autoLOC_RM_1144")); // #autoLOC_RM_1053 = Save //#autoLOC_RM_1144 Save the current settings to file. if (GUILayout.Button(label, GUILayout.Height(20))) { ToolTip = ""; RMSettings.SaveSettings(); ShowWindow = false; } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } // Cancel label = new GUIContent(Localizer.Format("#autoLOC_RM_1054"), Localizer.Format("#autoLOC_RM_1145")); // #autoLOC_RM_1054 = Cancel // #autoLOC_RM_1145 = Cancel the changes made.\nSettings will revert to before changes were made. if (GUILayout.Button(label, GUILayout.Height(20))) { ToolTip = ""; // We've canclled, so restore original settings. RMSettings.RestoreTempSettings(); ShowWindow = false; } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.EndHorizontal(); }
internal static void Display(int windowId) { // Reset Tooltip active flag... ToolTipActive = false; var rect = new Rect(371, 4, 16, 16); if (GUI.Button(rect, new GUIContent("", "Close Window"))) { ToolTip = ""; RMSettings.RestoreTempSettings(); ShowWindow = false; } if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } // Store settings in case we cancel later... //RMSettings.StoreTempSettings(); GUILayout.BeginVertical(); _scrollViewerPosition = GUILayout.BeginScrollView(_scrollViewerPosition, GUILayout.Height(280), GUILayout.Width(375)); GUILayout.BeginVertical(); DisplayOptions(); DisplayHighlighting(); DisplayToolTips(); DisplayConfiguration(); GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save")) { //If EnableAging has been turned ON when it was previously OFF, we reset age processing, otherwise they could all die instantly. if (RMLifeSpan.Instance.RMGameSettings.EnableAging && RMSettings.PrevEnableAging == false) { Utilities.LogMessage("RosterManagerWindowSettings.Display Save settings, aging has been enabled. Reset all birthdays.", "info", RMSettings.VerboseLogging); var currentTime = Planetarium.GetUniversalTime(); foreach (var rmkerbal in RMLifeSpan.Instance.RMKerbals.AllrmKerbals) { rmkerbal.Value.TimelastBirthday = currentTime; rmkerbal.Value.TimeNextBirthday = RMKerbal.BirthdayNextDue(currentTime); } } //If EnableSalaries has been turned OFF when it was previously ON, reset any kerbals from tourist back to active. if (!RMLifeSpan.Instance.RMGameSettings.EnableSalaries && RMSettings.PrevEnableSalaries) { Utilities.LogMessage("RosterManagerWindowSettings.Display Save settings, salaries have been turned off. Reset all salary related fields for all kerbals.", "info", RMSettings.VerboseLogging); foreach (var rmkerbal in RMLifeSpan.Instance.RMKerbals.AllrmKerbals) { if (rmkerbal.Value.Type == ProtoCrewMember.KerbalType.Tourist && rmkerbal.Value.Kerbal.rosterStatus != ProtoCrewMember.RosterStatus.Dead) { rmkerbal.Value.Type = ProtoCrewMember.KerbalType.Crew; rmkerbal.Value.Kerbal.type = ProtoCrewMember.KerbalType.Crew; rmkerbal.Value.Trait = rmkerbal.Value.RealTrait; rmkerbal.Value.Kerbal.trait = rmkerbal.Value.RealTrait; KerbalRoster.SetExperienceTrait(rmkerbal.Value.Kerbal, rmkerbal.Value.Trait); RMKerbal.RegisterExperienceTrait(rmkerbal.Value); } rmkerbal.Value.SalaryContractDispute = false; rmkerbal.Value.SalaryContractDisputePeriods = 0; rmkerbal.Value.SalaryContractDisputeProcessed = true; } } //If EnableSalaries has been turned ON when it was previously OFF, reset all kerbals salary time to now. if (RMLifeSpan.Instance.RMGameSettings.EnableSalaries && RMSettings.PrevEnableSalaries == false) { Utilities.LogMessage("RosterManagerWindowSettings.Display Save settings, salaries have been turned on. Reset all salary related fields for all kerbals.", "info", RMSettings.VerboseLogging); var currentTime = Planetarium.GetUniversalTime(); foreach (var rmkerbal in RMLifeSpan.Instance.RMKerbals.AllrmKerbals) { rmkerbal.Value.Timelastsalary = currentTime; rmkerbal.Value.TimeSalaryDue = RMKerbal.SalaryNextDue(currentTime); } } RMSettings.SaveSettings(); ShowWindow = false; } if (GUILayout.Button("Cancel")) { // We've canclled, so restore original settings. RMSettings.RestoreTempSettings(); ShowWindow = false; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, Screen.width, 30)); RMSettings.RepositionWindows("WindowSettings"); }