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 = 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(guiRuleWidth)); 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(guiToggleWidth), 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)) { SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, iLights.Current.SPart, Event.current.mousePosition); } } iLights.Dispose(); // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SmUtils.LogMessage( $" in Light Tab at step {step}. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } GUILayout.EndVertical(); }
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(); }
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.SmTags["#smloc_control_lab_000"], SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(guiRuleWidth)); string step = "start"; try { // Display all Labs List <ModuleScienceLab> .Enumerator iLabs = SMAddon.SmVessel.Labs.GetEnumerator(); while (iLabs.MoveNext()) { if (iLabs.Current == null) { continue; } step = "gui enable"; GUI.enabled = true; string label = $"{iLabs.Current.name} - ({(iLabs.Current.IsOperational() ? SmUtils.SmTags["#smloc_control_lab_001"] : SmUtils.SmTags["#smloc_control_lab_002"])})"; // Operational, InOp GUILayout.Label(label, GUILayout.Width(guiLabelWidth), GUILayout.Height(40)); Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, iLabs.Current.part, Event.current.mousePosition); } } iLabs.Dispose(); // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SmUtils.LogMessage( $" in Solar Panel Tab at step {step}. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } GUILayout.EndVertical(); }
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; } } }
private static void ResourceButtonToggled(string resourceName) { try { if (SMConditions.IsTransferInProgress()) { return; } // First, lets clear any highlighting... SMHighlighter.ClearResourceHighlighting(SMAddon.SmVessel.SelectedResourcesParts); // Now let's update our lists... SMAddon.SmVessel.RefreshLists(); if (!SMAddon.SmVessel.SelectedResources.Contains(resourceName)) { // now lets determine what to do with selection if (SMConditions.ResourceIsSingleton(resourceName)) { SMAddon.SmVessel.SelectedResources.Clear(); SMAddon.SmVessel.SelectedResources.Add(resourceName); } else { if (SMConditions.ResourcesContainSingleton(SMAddon.SmVessel.SelectedResources)) { SMAddon.SmVessel.SelectedResources.Clear(); SMAddon.SmVessel.SelectedResources.Add(resourceName); } else if (SMAddon.SmVessel.SelectedResources.Count > 1) { SMAddon.SmVessel.SelectedResources.RemoveRange(0, 1); SMAddon.SmVessel.SelectedResources.Add(resourceName); } else { SMAddon.SmVessel.SelectedResources.Add(resourceName); } } } else if (SMAddon.SmVessel.SelectedResources.Contains(resourceName)) { SMAddon.SmVessel.SelectedResources.Remove(resourceName); } // Now, refresh the resources parts list SMAddon.SmVessel.GetSelectedResourcesParts(); // now lets reconcile the selected parts based on the new list of resources... ResolveResourcePartSelections(SMAddon.SmVessel.SelectedResources); // Now, based on the resourceselection, do we show the Transfer window? WindowTransfer.ShowWindow = SMAddon.SmVessel.SelectedResources.Count > 0; } catch (Exception ex) { SMUtils.LogMessage( string.Format(" in WindowManifest.ResourceButtonToggled. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); // in, Error } SMAddon.SmVessel.RefreshLists(); }
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; } } }
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.SmTags["#smloc_settings_realism_001"], SMStyle.LabelTabHeader); } else { // "Realism Settings / Options (Locked. To unlock, edit SMSettings.dat file)" GUILayout.Label( new GUIContent(SmUtils.SmTags["#smloc_settings_realism_002"], SmUtils.SmTags["#smloc_settings_realism_tt_001"]), SMStyle.LabelTabHeader); } GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(guiRuleWidth)); bool isEnabled = !SMSettings.LockSettings; //RealismMode Buttons. DisplayRealismButtons(); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(guiRuleWidth)); // 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.SmTags["#smloc_settings_realism_008"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_007"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.RealXfers = GUILayout.Toggle(SMSettings.RealXfers, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_009"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_008"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.RealControl = GUILayout.Toggle(SMSettings.RealControl, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_010"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_009"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableCrewModify = GUILayout.Toggle(SMSettings.EnableCrewModify, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_011"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_010"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableKerbalRename = GUILayout.Toggle(SMSettings.EnableKerbalRename, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_012"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_011"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableChangeProfession = GUILayout.Toggle(SMSettings.EnableChangeProfession, _guiLabel, GUILayout.Width(guiToggleWidth)); 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.SmTags["#smloc_settings_realism_013"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_012"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableStockCrewXfer = GUILayout.Toggle(SMSettings.EnableStockCrewXfer, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_014"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_013"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableCrew = GUILayout.Toggle(SMSettings.EnableCrew, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_015"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_014"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnablePfCrews = GUILayout.Toggle(SMSettings.EnablePfCrews, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_016"]; _toolTip = SmUtils.SmTags["#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.SmTags["#smloc_settings_realism_017"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_016"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableCls = GUILayout.Toggle(SMSettings.EnableCls, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_018"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_017"]; _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Space(20); SMSettings.EnableClsAllowTransfer = GUILayout.Toggle(SMSettings.EnableClsAllowTransfer, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_019"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_018"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableScience = GUILayout.Toggle(SMSettings.EnableScience, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_020"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_019"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableResources = GUILayout.Toggle(SMSettings.EnableResources, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_021"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_020"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnablePfResources = GUILayout.Toggle(SMSettings.EnablePfResources, _guiLabel, GUILayout.Width(guiToggleWidth)); _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.SmTags["#smloc_settings_realism_022"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_021"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableXferCost = GUILayout.Toggle(SMSettings.EnableXferCost, _guiLabel, GUILayout.Width(guiToggleWidth)); _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 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.SmTags["#smloc_settings_realism_023"]}:"; _toolTip = SmUtils.SmTags["#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.SmTags["#smloc_settings_realism_024"]; _toolTip = SmUtils.SmTags["#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 float 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(); // 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.SmTags["#smloc_settings_realism_025"]}:"; _toolTip = SmUtils.SmTags["#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.SmTags["#smloc_settings_realism_026"]; _toolTip = SmUtils.SmTags["#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 float 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.SmTags["#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.SmTags["#smloc_settings_realism_027"]}:"; _toolTip = SmUtils.SmTags["#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.SmTags["#smloc_settings_realism_026"]; _toolTip = SmUtils.SmTags["#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.SmTags["#smloc_settings_realism_028"]}:"; _toolTip = SmUtils.SmTags["#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.SmTags["#smloc_settings_realism_026"]; _toolTip = SmUtils.SmTags["#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.SmTags["#smloc_settings_realism_029"]}:"; _toolTip = SmUtils.SmTags["#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.SmTags["#smloc_settings_realism_030"]; _toolTip = SmUtils.SmTags["#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(guiRuleWidth)); // 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.SmTags["#smloc_settings_realism_031"]; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_028"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.LockSettings = GUILayout.Toggle(SMSettings.LockSettings, _guiLabel, GUILayout.Width(guiToggleWidth)); _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(guiRuleWidth)); }
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.SmTags["#smloc_settings_highlight_000"], SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(guiRuleWidth)); // 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.SmTags["#smloc_settings_highlight_001"]; _toolTip = SmUtils.SmTags["#smloc_settings_highlight_tt_001"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableHighlighting = GUILayout.Toggle(SMSettings.EnableHighlighting, _guiLabel, GUILayout.Width(guiToggleWidth)); 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(guiIndent); //_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.SmTags["#smloc_settings_highlight_002"]; _toolTip = SmUtils.SmTags["#smloc_settings_highlight_tt_002"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.OnlySourceTarget = GUILayout.Toggle(SMSettings.OnlySourceTarget, _guiLabel, GUILayout.Width(guiToggleWidth)); 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(guiIndent); //_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.SmTags["#smloc_settings_highlight_003"]; _toolTip = SmUtils.SmTags["#smloc_settings_highlight_tt_003"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableClsHighlighting = GUILayout.Toggle(SMSettings.EnableClsHighlighting, _guiLabel, GUILayout.Width(guiToggleWidth)); 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.SmTags["#smloc_settings_highlight_004"]; _toolTip = SmUtils.SmTags["#smloc_settings_highlight_tt_004"]; _guiLabel = new GUIContent(_label, _toolTip); SMSettings.EnableEdgeHighlighting = GUILayout.Toggle(SMSettings.EnableEdgeHighlighting, _guiLabel, GUILayout.Width(guiToggleWidth)); 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(Vector2 displayViewerPosition) { //float scrollX = WindowControl.Position.x; //float scrollY = WindowControl.Position.y + 50 - displayViewerPosition.y; float scrollX = 0; float scrollY = 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(guiRuleWidth)); 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(guiToggleWidth), 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.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, iAntennas.Current.SPart, Event.current.mousePosition); } } iAntennas.Dispose(); // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SmUtils.LogMessage( $" in Antenna Tab at step {step}. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } GUILayout.EndVertical(); }
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 = displayViewerPosition.y; // Reset Tooltip active flag... ToolTipActive = false; SMHighlighter.IsMouseOver = false; // Reset Tooltip active flag... ToolTipActive = false; _canShowToolTips = WindowSettings.ShowToolTips && ShowToolTips; Position = WindowControl.Position; GUILayout.BeginVertical(); GUI.enabled = true; //GUILayout.Label("Vessel Control Center", SMStyle.LabelTabHeader); GUILayout.Label(SmUtils.SmTags["#smloc_control_vessel_000"], SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(guiRuleWidth)); string step = "start"; try { int combineVesselcount = 0; // Display all Vessels Docked together // ReSharper disable once ForCanBeConvertedToForeach for (int v = 0; v < SMAddon.SmVessel.DockedVessels.Count; v++) { ModDockedVessel mdv = SMAddon.SmVessel.DockedVessels[v]; GUI.enabled = mdv.IsDocked; GUILayout.BeginHorizontal(); GUIContent content = new GUIContent("", SmUtils.SmTags["#smloc_control_vessel_tt_001"]); //"Include in list of vessels to combine into a single docked vessel" bool isChecked = mdv.Combine; // temporary commenting of comnbine code to allow release. Will work for next version. //isChecked = GUILayout.Toggle(isChecked, content, GUILayout.Width(20)); if (isChecked) { combineVesselcount += 1; } if (isChecked != mdv.Combine) { mdv.Combine = isChecked; } // temporary commenting to allow release. Will work on comnbine code for next version. //Rect rect = GUILayoutUtility.GetLastRect(); //if (Event.current.type == EventType.Repaint && _canShowToolTips) // ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, scrollX); //if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) //{ // SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, mdv, // Event.current.mousePosition); //} content = new GUIContent(SmUtils.SmTags["#smloc_control_vessel_001"], SmUtils.SmTags["#smloc_control_vessel_tt_005"]); if (GUILayout.Button(content, GUILayout.Width(guiBtnWidth))) //"UnDock" { // close hatches If CLS applies if (SMConditions.IsClsEnabled()) { CloseVesselHatches(mdv); } // Decouple/undock selected vessel. UndockSelectedVessel(mdv); } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, scrollX); } if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, mdv, Event.current.mousePosition); } GUI.enabled = true; if (mdv.IsEditing) { mdv.RenameVessel = GUILayout.TextField(mdv.RenameVessel, GUILayout.Width(guiLabelWidth - (guiBtnWidth + 5))); } else { GUILayout.Label($"{mdv.VesselInfo.name}", GUILayout.Width(guiLabelWidth)); } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, mdv, Event.current.mousePosition); } // now editing buttons. content = mdv.IsEditing ? new GUIContent(SmUtils.SmTags["#smloc_control_vessel_002"], SmUtils.SmTags["#smloc_control_vessel_tt_002"]) : new GUIContent(SmUtils.SmTags["#smloc_control_vessel_003"], SmUtils.SmTags["#smloc_control_vessel_tt_003"]); // "Save" // "Saves the changes to the docked vessel name." // Edit // "Change the docked vessel name." if (GUILayout.Button(content, GUILayout.Width(50))) { if (SMAddon.SmVessel.DockedVessels[v].IsEditing) { mdv.VesselInfo.name = mdv.RenameVessel; mdv.RenameVessel = null; mdv.IsEditing = false; } else { mdv.IsEditing = true; mdv.RenameVessel = SMAddon.SmVessel.DockedVessels[v].VesselInfo.name; } } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, scrollX); } if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, mdv, Event.current.mousePosition); } if (mdv.IsEditing) { GUIContent cancelContent = new GUIContent(SmUtils.SmTags["#smloc_control_vessel_004"], SmUtils.SmTags["#smloc_control_vessel_tt_004"]); // "Cancel","Cancel changes to docked vessel name" if (GUILayout.Button(cancelContent, GUILayout.Width(guiBtnWidth))) { mdv.RenameVessel = null; mdv.IsEditing = false; } } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, scrollX); } if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, mdv, Event.current.mousePosition); } GUILayout.EndHorizontal(); } // update static count for control window action buttons. CombineVesselCount = combineVesselcount; // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SmUtils.LogMessage( $" in Vessels Tab at step {step}. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } GUI.enabled = true; GUILayout.EndVertical(); }
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 = displayViewerPosition.y; // Reset Tooltip active flag... ToolTipActive = false; SMHighlighter.IsMouseOver = false; GUILayout.BeginVertical(); GUI.enabled = true; //GUILayout.Label("Hatch Control Center ", SMStyle.LabelTabHeader); GUILayout.Label(SmUtils.SmTags["#smloc_control_hatch_000"], SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(guiRuleWidth)); string step = "start"; try { // Display all hatches // ReSharper disable once ForCanBeConvertedToForeach for (int x = 0; x < SMAddon.SmVessel.Hatches.Count; x++) { ModHatch iHatch = SMAddon.SmVessel.Hatches[x]; bool isEnabled = true; bool open = false; // get hatch state if (!iHatch.IsDocked) { isEnabled = false; } if (iHatch.HatchOpen) { open = true; } step = "gui enable"; GUI.enabled = isEnabled; bool newOpen = GUILayout.Toggle(open, $"{iHatch.HatchStatus} - {iHatch.Title}", GUILayout.Width(guiToggleWidth)); step = "button toggle check"; if (!open && newOpen) { iHatch.OpenHatch(true); } else if (open && !newOpen) { iHatch.CloseHatch(true); } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, iHatch.ClsPart.Part, Event.current.mousePosition); } } // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SmUtils.LogMessage( $" in Hatches Tab at step {step}. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } GUI.enabled = true; GUILayout.EndVertical(); }
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 = 10; float scrollY = 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(guiRuleWidth)); 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} - ({SmUtils.Localize("#smloc_module_004")}) - {iPanels.Current.Title}"; // "Broken" } 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} - ({SmUtils.Localize("#smloc_module_005")}) - {iPanels.Current.Title}"; // "Locked" } bool newOpen = GUILayout.Toggle(open, label, GUILayout.Width(guiToggleWidth), 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.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, iPanels.Current.SPart, Event.current.mousePosition); } } iPanels.Dispose(); // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SmUtils.LogMessage( $" in Solar Panel Tab at step {step}. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } GUILayout.EndVertical(); }
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 = displayViewerPosition.y; // Reset Tooltip active flag... ToolTipActive = false; SMHighlighter.IsMouseOver = false; GUILayout.BeginVertical(); GUI.enabled = true; //GUILayout.Label("Vessel Control Center", SMStyle.LabelTabHeader); GUILayout.Label(SmUtils.Localize("#smloc_control_vessel_000"), SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(guiRuleWidth)); string step = "start"; try { // Display all Vessels Docked together // ReSharper disable once ForCanBeConvertedToForeach for (int v = 0; v < SMAddon.SmVessel.DockedVessels.Count; v++) { GUI.enabled = SMAddon.SmVessel.DockedVessels[v].IsDocked; GUILayout.BeginHorizontal(); if (GUILayout.Button("UnDock", GUILayout.Width(guiBtnWidth))) { // close hatches If CLS applies if (SMConditions.IsClsEnabled()) { CloseVesselHatches(SMAddon.SmVessel.DockedVessels[v]); } // Decouple/undock selected vessel. UndockSelectedVessel(SMAddon.SmVessel.DockedVessels[v]); } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, SMAddon.SmVessel.DockedVessels[v], Event.current.mousePosition); } GUI.enabled = true; if (SMAddon.SmVessel.DockedVessels[v].IsEditing) { SMAddon.SmVessel.DockedVessels[v].renameVessel = GUILayout.TextField(SMAddon.SmVessel.DockedVessels[v].renameVessel, GUILayout.Width(guiLabelWidth - (guiBtnWidth + 5))); } else { GUILayout.Label($"{SMAddon.SmVessel.DockedVessels[v].VesselInfo.name}", GUILayout.Width(guiLabelWidth)); } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && rect.Contains(Event.current.mousePosition)) { SMHighlighter.SetMouseOverData(rect, scrollY, scrollX, WindowControl.TabBox.height, SMAddon.SmVessel.DockedVessels[v], Event.current.mousePosition); } // now editing buttons. GUIContent content = SMAddon.SmVessel.DockedVessels[v].IsEditing ? new GUIContent("Save", "Saves the changes to the docked vessel name.") : new GUIContent("Edit", "Change the docked vessel name."); if (GUILayout.Button(content, GUILayout.Width(50))) { if (SMAddon.SmVessel.DockedVessels[v].IsEditing) { SMAddon.SmVessel.DockedVessels[v].VesselInfo.name = SMAddon.SmVessel.DockedVessels[v].renameVessel; SMAddon.SmVessel.DockedVessels[v].renameVessel = null; SMAddon.SmVessel.DockedVessels[v].IsEditing = false; } else { SMAddon.SmVessel.DockedVessels[v].IsEditing = true; SMAddon.SmVessel.DockedVessels[v].renameVessel = SMAddon.SmVessel.DockedVessels[v].VesselInfo.name; } } if (SMAddon.SmVessel.DockedVessels[v].IsEditing) { GUIContent cancelContent = new GUIContent("Cancel", "Cancel changes to docked vessel name"); if (GUILayout.Button(cancelContent, GUILayout.Width(guiBtnWidth))) { SMAddon.SmVessel.DockedVessels[v].renameVessel = null; SMAddon.SmVessel.DockedVessels[v].IsEditing = false; } } GUILayout.EndHorizontal(); } // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SmUtils.LogMessage( $" in Vessels Tab at step {step}. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } GUI.enabled = true; GUILayout.EndVertical(); }
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(); }
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("Hatch Control Center ", SMStyle.LabelTabHeader); GUILayout.Label(SMUtils.Localize("#smloc_control_hatch_000"), SMStyle.LabelTabHeader); GUILayout.Label("____________________________________________________________________________________________", SMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); string step = "start"; try { // Display all hatches // ReSharper disable once ForCanBeConvertedToForeach for (int x = 0; x < SMAddon.SmVessel.Hatches.Count; x++) { ModHatch iHatch = SMAddon.SmVessel.Hatches[x]; bool isEnabled = true; bool open = false; // get hatch state if (!iHatch.IsDocked) { isEnabled = false; } if (iHatch.HatchOpen) { open = true; } step = "gui enable"; GUI.enabled = isEnabled; bool newOpen = GUILayout.Toggle(open, iHatch.HatchStatus + " - " + iHatch.Title, GUILayout.Width(325)); step = "button toggle check"; if (!open && newOpen) { iHatch.OpenHatch(true); } else if (open && !newOpen) { iHatch.CloseHatch(true); } 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 = iHatch.ClsPart.Part; SMHighlighter.MouseOverParts = null; } } // Display MouseOverHighlighting, if any SMHighlighter.MouseOverHighlight(); } catch (Exception ex) { SMUtils.LogMessage( string.Format(" in Hatches Tab at step {0}. Error: {1} \r\n\r\n{2}", step, ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } GUI.enabled = true; GUILayout.EndVertical(); }