public OrbitAnalyser(PrincipiaPluginAdapter adapter, PredictedVessel predicted_vessel) : base( adapter, predicted_vessel, UnityEngine.GUILayout.MinWidth(0)) { adapter_ = adapter; }
private ExternalInterface(PrincipiaPluginAdapter adapter) { adapter_ = adapter; if (!Loader.loaded_principia_dll_) { throw new DllNotFoundException("The Principia native DLL failed to load"); } }
public MainWindow(PrincipiaPluginAdapter adapter, FlightPlanner flight_planner, ReferenceFrameSelector plotting_frame_selector, PredictedVessel predicted_vessel) : base(adapter) { adapter_ = adapter; flight_planner_ = flight_planner; plotting_frame_selector_ = plotting_frame_selector; predicted_vessel_ = predicted_vessel; Show(); }
public BurnEditor(PrincipiaPluginAdapter adapter, Vessel vessel, double initial_time, int index, Func <int, BurnEditor> get_burn_at_index) { adapter_ = adapter; vessel_ = vessel; initial_time_ = initial_time; this.index = index; get_burn_at_index_ = get_burn_at_index; Δv_tangent_ = new DifferentialSlider( label: L10N.CacheFormat("#Principia_BurnEditor_ΔvTangent"), unit: L10N.CacheFormat("#Principia_BurnEditor_SpeedUnit"), log10_lower_rate: log10_Δv_lower_rate, log10_upper_rate: log10_Δv_upper_rate, text_colour: Style.Tangent); Δv_normal_ = new DifferentialSlider( label: L10N.CacheFormat("#Principia_BurnEditor_ΔvNormal"), unit: L10N.CacheFormat("#Principia_BurnEditor_SpeedUnit"), log10_lower_rate: log10_Δv_lower_rate, log10_upper_rate: log10_Δv_upper_rate, text_colour: Style.Normal); Δv_binormal_ = new DifferentialSlider( label: L10N.CacheFormat("#Principia_BurnEditor_ΔvBinormal"), unit: L10N.CacheFormat("#Principia_BurnEditor_SpeedUnit"), log10_lower_rate: log10_Δv_lower_rate, log10_upper_rate: log10_Δv_upper_rate, text_colour: Style.Binormal); previous_coast_duration_ = new DifferentialSlider( label: L10N.CacheFormat("#Principia_BurnEditor_InitialTime"), unit: null, log10_lower_rate: log10_time_lower_rate, log10_upper_rate: log10_time_upper_rate, // We cannot have a coast of length 0, so let's make it very // short: that will be indistinguishable. zero_value: 0.001, min_value: 0, formatter: FormatPreviousCoastDuration, parser: TryParsePreviousCoastDuration, field_width: 7) { value = initial_time_ - time_base }; reference_frame_selector_ = new ReferenceFrameSelector( adapter_, ReferenceFrameChanged, L10N.CacheFormat("#Principia_BurnEditor_ManœuvringFrame")); reference_frame_selector_.SetFrameParameters( adapter_.plotting_frame_selector_.FrameParameters()); ComputeEngineCharacteristics(); }
public BurnEditor(PrincipiaPluginAdapter adapter, Vessel vessel, double initial_time, int index, BurnEditor previous_burn) { adapter_ = adapter; vessel_ = vessel; initial_time_ = initial_time; index_ = index; previous_burn_ = previous_burn; Δv_tangent_ = new DifferentialSlider(label: "Δv tangent", unit: "m / s", log10_lower_rate: Log10ΔvLowerRate, log10_upper_rate: Log10ΔvUpperRate, text_colour: Style.Tangent); Δv_normal_ = new DifferentialSlider(label: "Δv normal", unit: "m / s", log10_lower_rate: Log10ΔvLowerRate, log10_upper_rate: Log10ΔvUpperRate, text_colour: Style.Normal); Δv_binormal_ = new DifferentialSlider(label: "Δv binormal", unit: "m / s", log10_lower_rate: Log10ΔvLowerRate, log10_upper_rate: Log10ΔvUpperRate, text_colour: Style.Binormal); previous_coast_duration_ = new DifferentialSlider( label: "t initial", unit: null, log10_lower_rate: Log10TimeLowerRate, log10_upper_rate: Log10TimeUpperRate, // We cannot have a coast of length 0, so let's make it very // short: that will be indistinguishable. zero_value: 0.001, min_value: 0, formatter: FormatPreviousCoastDuration, parser: TryParsePreviousCoastDuration, field_width: 7) { value = initial_time_ - time_base }; reference_frame_selector_ = new ReferenceFrameSelector( adapter_, ReferenceFrameChanged, "Manœuvring frame"); reference_frame_selector_.SetFrameParameters( adapter_.plotting_frame_selector_.FrameParameters()); ComputeEngineCharacteristics(); }
public FlightPlanner(PrincipiaPluginAdapter adapter) : base(adapter) { adapter_ = adapter; final_time_ = new DifferentialSlider( label: "Plan length", unit: null, log10_lower_rate: log10_time_lower_rate_, log10_upper_rate: log10_time_upper_rate_, min_value: 10, max_value: double.PositiveInfinity, formatter: FormatPlanLength, parser: TryParsePlanLength); }
public BurnEditor(PrincipiaPluginAdapter adapter, IntPtr plugin, Vessel vessel, double initial_time) { Δv_tangent_ = new DifferentialSlider(label : "Δv tangent", unit : "m / s", log10_lower_rate : Log10ΔvLowerRate, log10_upper_rate : Log10ΔvUpperRate, text_colour : XKCDColors.NeonYellow); Δv_normal_ = new DifferentialSlider(label : "Δv normal", unit : "m / s", log10_lower_rate : Log10ΔvLowerRate, log10_upper_rate : Log10ΔvUpperRate, text_colour : XKCDColors.AquaBlue); Δv_binormal_ = new DifferentialSlider(label : "Δv binormal", unit : "m / s", log10_lower_rate : Log10ΔvLowerRate, log10_upper_rate : Log10ΔvUpperRate, text_colour : XKCDColors.PurplePink); initial_time_ = new DifferentialSlider( label : "t initial", unit : null, log10_lower_rate : Log10TimeLowerRate, log10_upper_rate : Log10TimeUpperRate, min_value : 0, max_value : double.PositiveInfinity, formatter : value => FlightPlanner.FormatTimeSpan( TimeSpan.FromSeconds( Planetarium.GetUniversalTime() - value))); initial_time_.value = initial_time; reference_frame_selector_ = new ReferenceFrameSelector( adapter, plugin, ReferenceFrameChanged, "Manœuvring frame"); plugin_ = plugin; vessel_ = vessel; adapter_ = adapter; reference_frame_selector_.Reset( adapter_.plotting_frame_selector_.get().FrameParameters()); ComputeEngineCharacteristics(); }
public BurnEditor(PrincipiaPluginAdapter adapter, IntPtr plugin, Vessel vessel, double initial_time) { Δv_tangent_ = new DifferentialSlider(label: "Δv tangent", unit: "m / s", log10_lower_rate: Log10ΔvLowerRate, log10_upper_rate: Log10ΔvUpperRate, text_colour: XKCDColors.NeonYellow); Δv_normal_ = new DifferentialSlider(label: "Δv normal", unit: "m / s", log10_lower_rate: Log10ΔvLowerRate, log10_upper_rate: Log10ΔvUpperRate, text_colour: XKCDColors.AquaBlue); Δv_binormal_ = new DifferentialSlider(label: "Δv binormal", unit: "m / s", log10_lower_rate: Log10ΔvLowerRate, log10_upper_rate: Log10ΔvUpperRate, text_colour: XKCDColors.PurplePink); initial_time_ = new DifferentialSlider( label: "t initial", unit: null, log10_lower_rate: Log10TimeLowerRate, log10_upper_rate: Log10TimeUpperRate, min_value: 0, max_value: double.PositiveInfinity, formatter: value => FlightPlanner.FormatTimeSpan( TimeSpan.FromSeconds( Planetarium.GetUniversalTime() - value))); initial_time_.value = initial_time; reference_frame_selector_ = new ReferenceFrameSelector( adapter, plugin, ReferenceFrameChanged, "Manœuvring frame"); plugin_ = plugin; vessel_ = vessel; adapter_ = adapter; reference_frame_selector_.Reset( adapter_.plotting_frame_selector_.get().FrameParameters()); ComputeEngineCharacteristics(); }
public FlightPlanner(PrincipiaPluginAdapter adapter, PredictedVessel predicted_vessel) : base(adapter, predicted_vessel) { adapter_ = adapter; predicted_vessel_ = predicted_vessel; final_time_ = new DifferentialSlider( label: "Plan length", unit: null, log10_lower_rate: log10_time_lower_rate_, log10_upper_rate: log10_time_upper_rate_, min_value: 10, max_value: double.PositiveInfinity, formatter: FormatPlanLength, parser: TryParsePlanLength, field_width: 7); final_trajectory_analyser_ = new PlannedOrbitAnalyser(adapter, predicted_vessel); }
public FlightPlanner(PrincipiaPluginAdapter adapter, IntPtr plugin) : base(adapter) { adapter_ = adapter; plugin_ = plugin; window_rectangle_.x = UnityEngine.Screen.width / 2; window_rectangle_.y = UnityEngine.Screen.height / 3; final_time_ = new DifferentialSlider( label: "Plan length", unit: null, log10_lower_rate: Log10TimeLowerRate, log10_upper_rate: Log10TimeUpperRate, min_value: 10, max_value: double.PositiveInfinity, formatter: value => FormatPositiveTimeSpan( TimeSpan.FromSeconds( value - plugin_.FlightPlanGetInitialTime( vessel_.id.ToString())))); }
public FlightPlanner(PrincipiaPluginAdapter adapter, IntPtr plugin) : base(adapter) { adapter_ = adapter; plugin_ = plugin; window_rectangle_.x = UnityEngine.Screen.width / 2; window_rectangle_.y = UnityEngine.Screen.height / 3; final_time_ = new DifferentialSlider( label : "Plan length", unit : null, log10_lower_rate : Log10TimeLowerRate, log10_upper_rate : Log10TimeUpperRate, min_value : 10, max_value : double.PositiveInfinity, formatter : value => FormatPositiveTimeSpan( TimeSpan.FromSeconds( value - plugin_.FlightPlanGetInitialTime( vessel_.id.ToString())))); }
public PlannedOrbitAnalyser(PrincipiaPluginAdapter adapter, PredictedVessel predicted_vessel) : base(adapter, predicted_vessel) { }
public OrbitAnalyser(PrincipiaPluginAdapter adapter) : base(adapter, UnityEngine.GUILayout.MinWidth(0)) { adapter_ = adapter; }
// Renders the |BurnEditor|. Returns true if and only if the settings were // changed. public Event Render( string header, bool anomalous, double burn_final_time, double?orbital_period) { bool changed = false; previous_coast_duration_.max_value = burn_final_time - time_base; using (new UnityEngine.GUILayout.HorizontalScope()) { if (UnityEngine.GUILayout.Button( minimized ? "+" : "−", GUILayoutWidth(1))) { minimized = !minimized; return(minimized ? Event.Minimized : Event.Maximized); } UnityEngine.GUILayout.Label( minimized ? L10N.CacheFormat("#Principia_BurnEditor_MinimizedHeader", header, Δv().ToString("0.000")) : header); string info = ""; if (!minimized && !reference_frame_selector_.FrameParameters().Equals( adapter_.plotting_frame_selector_.FrameParameters())) { info = L10N.CacheFormat( "#Principia_BurnEditor_Info_InconsistentFrames"); } UnityEngine.GUILayout.Label(info, Style.Info(UnityEngine.GUI.skin.label)); if (UnityEngine.GUILayout.Button( L10N.CacheFormat("#Principia_BurnEditor_Delete"), GUILayoutWidth(2))) { return(Event.Deleted); } } if (minimized) { return(Event.None); } using (new UnityEngine.GUILayout.VerticalScope()) { // When we are first rendered, the |initial_mass_in_tonnes_| will just have // been set. If we have fallen back to instant impulse, we should use this // mass to set the thrust. if (first_time_rendering_) { first_time_rendering_ = false; changed = true; engine_warning_ = ""; ComputeEngineCharacteristics(); ReformatΔv(); } // The frame selector is disabled for an anomalous manœuvre as is has no // effect. if (anomalous) { reference_frame_selector_.Hide(); } else { using (new UnityEngine.GUILayout.HorizontalScope()) { if (UnityEngine.GUILayout.Button( L10N.CacheFormat("#Principia_BurnEditor_ActiveEngines"))) { engine_warning_ = ""; ComputeEngineCharacteristics(); ReformatΔv(); changed = true; } else if (UnityEngine.GUILayout.Button( L10N.CacheFormat("#Principia_BurnEditor_ActiveRCS"))) { engine_warning_ = ""; ComputeRCSCharacteristics(); ReformatΔv(); changed = true; } else if (UnityEngine.GUILayout.Button( L10N.CacheFormat("#Principia_BurnEditor_InstantImpulse"))) { engine_warning_ = ""; UseTheForceLuke(); ReformatΔv(); changed = true; } } reference_frame_selector_.RenderButton(); } if (is_inertially_fixed_ != UnityEngine.GUILayout.Toggle( is_inertially_fixed_, L10N.CacheFormat("#Principia_BurnEditor_InertiallyFixed"))) { changed = true; is_inertially_fixed_ = !is_inertially_fixed_; } changed |= changed_reference_frame_; // The Δv controls are disabled for an anomalous manœuvre as they have no // effect. changed |= Δv_tangent_.Render(enabled: !anomalous); changed |= Δv_normal_.Render(enabled: !anomalous); changed |= Δv_binormal_.Render(enabled: !anomalous); { var render_time_base = time_base; previous_coast_duration_.value_if_different = initial_time_ - render_time_base; // The duration of the previous coast is always enabled as it can make // a manœuvre non-anomalous. if (previous_coast_duration_.Render(enabled: true)) { changed = true; initial_time_ = previous_coast_duration_.value + render_time_base; } } using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Label("", GUILayoutWidth(3)); if (decrement_revolution == null) { PrincipiaPluginAdapter.LoadTextureOrDie(out decrement_revolution, "decrement_revolution.png"); } if (increment_revolution == null) { PrincipiaPluginAdapter.LoadTextureOrDie(out increment_revolution, "increment_revolution.png"); } if (orbital_period is double period) { if (UnityEngine.GUILayout.Button( new UnityEngine.GUIContent( decrement_revolution, L10N.CacheFormat( "#Principia_BurnEditor_DecrementRevolution") + "\n(" + new PrincipiaTimeSpan(-period).Format( with_leading_zeroes: false, with_seconds: false) + ")"), GUILayoutWidth(1))) { changed = true; initial_time_ -= period; } UnityEngine.GUILayout.Space(Width(5)); if (UnityEngine.GUILayout.Button( new UnityEngine.GUIContent( increment_revolution, L10N.CacheFormat( "#Principia_BurnEditor_IncrementRevolution") + "\n(" + new PrincipiaTimeSpan(+period).Format( with_leading_zeroes: false, with_seconds: false) + ")"), GUILayoutWidth(1))) { changed = true; initial_time_ += period; } } else { UnityEngine.GUILayout.Button("", GUILayoutWidth(1)); UnityEngine.GUILayout.Space(Width(5)); UnityEngine.GUILayout.Button("", GUILayoutWidth(1)); } UnityEngine.GUILayout.Label( index == 0 ? L10N.CacheFormat( "#Principia_BurnEditor_TimeBase_StartOfFlightPlan") : L10N.CacheFormat("#Principia_BurnEditor_TimeBase_EndOfManœuvre", index), style: new UnityEngine.GUIStyle(UnityEngine.GUI.skin.label) { alignment = UnityEngine.TextAnchor.UpperLeft }); } using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Label( L10N.CacheFormat("#Principia_BurnEditor_Δv", Δv().ToString("0.000")), GUILayoutWidth(8)); UnityEngine.GUILayout.Label(L10N.CacheFormat( "#Principia_BurnEditor_Duration", duration_.ToString("0.0"))); } UnityEngine.GUILayout.Label(engine_warning_, Style.Warning(UnityEngine.GUI.skin.label)); changed_reference_frame_ = false; } return(changed ? Event.Changed : Event.None); }
public Plotter(PrincipiaPluginAdapter adapter) { adapter_ = adapter; }