diff --git a/ksp_plugin_adapter/interface.cs b/ksp_plugin_adapter/interface.cs index 65c8285689..0b4ba27301 100644 --- a/ksp_plugin_adapter/interface.cs +++ b/ksp_plugin_adapter/interface.cs @@ -95,7 +95,8 @@ internal interface IReferenceFrameParameters { int[] SecondaryIndices { get; set; } } -internal partial class PlottingFrameParameters : IReferenceFrameParameters, IConfigNode { +internal partial class PlottingFrameParameters : IReferenceFrameParameters, + IConfigNode { public PlottingFrameParameters() { primary_index = new int[]{}; secondary_index = new int[]{}; @@ -120,8 +121,7 @@ public override bool Equals(object obj) { } public override int GetHashCode() => - (extension, centre_index, - primary_index.DefaultIfEmpty(-1).First(), + (extension, centre_index, primary_index.DefaultIfEmpty(-1).First(), secondary_index.DefaultIfEmpty(-1).First()).GetHashCode(); public void Load(ConfigNode node) { diff --git a/ksp_plugin_adapter/ksp_plugin_adapter.cs b/ksp_plugin_adapter/ksp_plugin_adapter.cs index 8e94102227..4baf824366 100644 --- a/ksp_plugin_adapter/ksp_plugin_adapter.cs +++ b/ksp_plugin_adapter/ksp_plugin_adapter.cs @@ -286,8 +286,8 @@ internal readonly ReferenceFrameSelector public bool show_celestial_trajectory(CelestialBody celestial) { return plotting_frame_selector_.pinned[celestial] || - !main_window_.frames_that_hide_unpinned_celestials.Contains( - plotting_frame_selector_.FrameParameters()); + !main_window_.frames_that_hide_unpinned_celestials.Contains( + plotting_frame_selector_.FrameParameters()); } public event Action LockClearing; @@ -353,8 +353,9 @@ public bool show_celestial_trajectory(CelestialBody celestial) { map_node_pool_ = new MapNodePool( this, visibility_modifiers: () => new MapNodePool.VisibilityModifiers( - show_unpinned: !main_window_.frames_that_hide_unpinned_markers - .Contains(plotting_frame_selector_.FrameParameters()), + show_unpinned: !main_window_.frames_that_hide_unpinned_markers. + Contains( + plotting_frame_selector_.FrameParameters()), can_hover: !ManœuvreMarker.has_interacting_marker) ); flight_planner_ = new FlightPlanner(this, PredictedVessel); diff --git a/ksp_plugin_adapter/main_window.cs b/ksp_plugin_adapter/main_window.cs index 7c578b1494..742f3960bf 100644 --- a/ksp_plugin_adapter/main_window.cs +++ b/ksp_plugin_adapter/main_window.cs @@ -13,12 +13,12 @@ internal class MainWindow : VesselSupervisedWindowRenderer { private readonly DateTimeOffset next_release_date_ = new DateTimeOffset(2025, 02, 28, 00, 44, 50, TimeSpan.Zero); - public MainWindow( - PrincipiaPluginAdapter adapter, - FlightPlanner flight_planner, - OrbitAnalyser orbit_analyser, - ReferenceFrameSelector plotting_frame_selector, - PredictedVessel predicted_vessel) : base( + public MainWindow(PrincipiaPluginAdapter adapter, + FlightPlanner flight_planner, + OrbitAnalyser orbit_analyser, + ReferenceFrameSelector + plotting_frame_selector, + PredictedVessel predicted_vessel) : base( adapter, predicted_vessel) { adapter_ = adapter; @@ -52,6 +52,7 @@ public HashSet frames_that_hide_unpinned_markers { get; private set; } = new HashSet(); + public HashSet frames_that_hide_unpinned_celestials { get; private set; @@ -83,22 +84,21 @@ public override void Load(ConfigNode node) { } frames_that_hide_unpinned_celestials.Clear(); - foreach (ConfigNode frame_node in - node.GetNodes("frames_that_hide_unpinned_celestials")) { + foreach (ConfigNode frame_node in node.GetNodes( + "frames_that_hide_unpinned_celestials")) { var frame = new PlottingFrameParameters(); frame.Load(frame_node); frames_that_hide_unpinned_celestials.Add(frame); } frames_that_hide_unpinned_markers.Clear(); - foreach (ConfigNode frame_node in - node.GetNodes("frames_that_hide_unpinned_markers")) { + foreach (ConfigNode frame_node in node.GetNodes( + "frames_that_hide_unpinned_markers")) { var frame = new PlottingFrameParameters(); frame.Load(frame_node); frames_that_hide_unpinned_markers.Add(frame); } - string buffered_logging_value = node.GetAtMostOneValue("buffered_logging"); if (buffered_logging_value != null) { buffered_logging_ = Convert.ToInt32(buffered_logging_value); @@ -255,13 +255,13 @@ protected override void RenderWindowContents(int window_id) { bool show_unpinned_markers = !frames_that_hide_unpinned_markers.Contains( plotting_frame_parameters); - if (show_unpinned_markers != UnityEngine.GUILayout.Toggle( - show_unpinned_markers, - L10N.CacheFormat( - "#Principia_MainWindow_Declutter_UnpinnedMarkers"))) { + if (show_unpinned_markers != + UnityEngine.GUILayout.Toggle( + show_unpinned_markers, + L10N.CacheFormat( + "#Principia_MainWindow_Declutter_UnpinnedMarkers"))) { if (show_unpinned_markers) { - frames_that_hide_unpinned_markers.Add( - plotting_frame_parameters); + frames_that_hide_unpinned_markers.Add(plotting_frame_parameters); } else { frames_that_hide_unpinned_markers.Remove( plotting_frame_parameters); @@ -270,10 +270,11 @@ protected override void RenderWindowContents(int window_id) { bool show_unpinned_celestials = !frames_that_hide_unpinned_celestials.Contains( plotting_frame_parameters); - if (show_unpinned_celestials != UnityEngine.GUILayout.Toggle( - show_unpinned_celestials, - L10N.CacheFormat( - "#Principia_MainWindow_Declutter_UnpinnedCelestials"))) { + if (show_unpinned_celestials != + UnityEngine.GUILayout.Toggle( + show_unpinned_celestials, + L10N.CacheFormat( + "#Principia_MainWindow_Declutter_UnpinnedCelestials"))) { if (show_unpinned_celestials) { frames_that_hide_unpinned_celestials.Add( plotting_frame_parameters); @@ -323,8 +324,9 @@ private void RenderKSPFeatures() { target_celestial.Name()), UnityEngine.GUILayout.ExpandWidth(true)); if (UnityEngine.GUILayout.Button( - L10N.CacheFormat("#Principia_MainWindow_TargetCelestial_Clear"), - GUILayoutWidth(2))) { + L10N.CacheFormat( + "#Principia_MainWindow_TargetCelestial_Clear"), + GUILayoutWidth(2))) { selecting_target_celestial_ = false; FlightGlobals.fetch.SetVesselTarget(null); } @@ -439,9 +441,7 @@ private void RenderLoggingSettings() { "#Principia_MainWindow_LoggingSettings_JournalingStatus_ON") : L10N.CacheFormat( "#Principia_MainWindow_LoggingSettings_JournalingStatus_OFF")), - style : Style.Info( - Style.RightAligned( - UnityEngine.GUI.skin.label))); + style : Style.Info(Style.RightAligned(UnityEngine.GUI.skin.label))); } if (journaling_ && !must_record_journal_) { // We can deactivate a recorder at any time, but in order for replaying to @@ -574,7 +574,7 @@ private void RenderToggleableSection(string name, private readonly DifferentialSlider history_length_ = new DifferentialSlider( label : - L10N.CacheFormat("#Principia_MainWindow_HistoryLength"), + L10N.CacheFormat("#Principia_MainWindow_HistoryLength"), unit : null, log10_lower_rate : log10_history_lower_rate, log10_upper_rate : log10_history_upper_rate, @@ -588,9 +588,9 @@ private void RenderToggleableSection(string name, }; private static readonly double[] prediction_length_tolerances_ = - {1e-3, 1e-2, 1e-1, 1e0, 1e1, 1e2, 1e3, 1e4}; + { 1e-3, 1e-2, 1e-1, 1e0, 1e1, 1e2, 1e3, 1e4 }; private static readonly string[] prediction_length_tolerance_names_ = - {"1 mm", "1 cm", "10 cm", "1 m", "10 m", "100 m", "1 km", "10 km"}; + { "1 mm", "1 cm", "10 cm", "1 m", "10 m", "100 m", "1 km", "10 km" }; // Keep this consistent with `max_steps_in_prediction` in `plugin.cpp`. private static readonly long[] prediction_steps_ = { 1 << 2, 1 << 4, 1 << 6, 1 << 8, 1 << 10, 1 << 12, 1 << 14, 1 << 16,