public void DoChooseTimeGUI() { GUILayout.Label("Schedule the burn"); GUILayout.BeginHorizontal(); currentTimeRef = GuiUtils.ComboBox.Box(currentTimeRef, timeRefNames, this); switch (timeReference) { // No additional parameters required case TimeReference.APOAPSIS: case TimeReference.CLOSEST_APPROACH: case TimeReference.EQ_ASCENDING: case TimeReference.EQ_DESCENDING: case TimeReference.PERIAPSIS: case TimeReference.REL_ASCENDING: case TimeReference.REL_DESCENDING: case TimeReference.EQ_NEAREST_AD: case TimeReference.EQ_HIGHEST_AD: case TimeReference.REL_NEAREST_AD: case TimeReference.REL_HIGHEST_AD: break; case TimeReference.X_FROM_NOW: GuiUtils.SimpleTextBox("of", leadTime); break; case TimeReference.ALTITUDE: GuiUtils.SimpleTextBox("of", circularizeAltitude, "km"); break; } GUILayout.EndHorizontal(); }
override public void WindowGUI(int windowID) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.yellow; GUILayout.BeginVertical(sBorder); base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("Repeat", s, GUILayout.ExpandWidth(false)); if (this.isStarted() && !this.isExecuted()) { s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.red; GUILayout.Label(times.val + " times. Executed", GUILayout.ExpandWidth(false)); GUILayout.Label(this.executedTimes + "", s, GUILayout.ExpandWidth(false)); GUILayout.Label("/" + times.val, GUILayout.ExpandWidth(false)); } else { GuiUtils.SimpleTextBox("", times, "times", 30); } base.postWindowGUI(windowID); GUILayout.BeginHorizontal(); GUILayout.Space(50); GUILayout.BeginVertical(); actions.actionsWindowGui(windowID); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
[GeneralInfoItem("#MechJeb_AutostagingSettings", InfoItem.Category.Misc)]//Autostaging settings public void AutostageSettingsInfoItem() { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("Delays: pre:", GUILayout.ExpandWidth(false)); autostagePreDelay.text = GUILayout.TextField(autostagePreDelay.text, GUILayout.Width(35)); GUILayout.Label("s post:", GUILayout.ExpandWidth(false)); autostagePostDelay.text = GUILayout.TextField(autostagePostDelay.text, GUILayout.Width(35)); GUILayout.Label("s", GUILayout.ExpandWidth(true)); GUILayout.EndHorizontal(); ClampAutostageThrust(); GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label38")); //"Stage fairings when:" GuiUtils.SimpleTextBox(" " + Localizer.Format("#MechJeb_Ascent_label39") + " <", fairingMaxDynamicPressure, "kPa", 50); //"dynamic pressure" GuiUtils.SimpleTextBox(" " + Localizer.Format("#MechJeb_Ascent_label40") + " >", fairingMinAltitude, "km", 50); //altitude GuiUtils.SimpleTextBox(" " + Localizer.Format("#MechJeb_Ascent_label41") + " <", fairingMaxAerothermalFlux, "W/m²", 50); //aerothermal flux GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label42"), autostageLimit, ""); //"Stop at stage #" hotStaging = GUILayout.Toggle(hotStaging, Localizer.Format("#MechJeb_Ascent_checkbox21")); //"Support hotstaging" if (hotStaging) { GuiUtils.SimpleTextBox(" " + Localizer.Format("#MechJeb_Ascent_label43"), hotStagingLeadTime, "s");//"lead time" } GUILayout.EndVertical(); }
public void AutostageSettingsInfoItem() { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("Delays: pre:", GUILayout.ExpandWidth(false)); autostagePreDelay.text = GUILayout.TextField(autostagePreDelay.text, GUILayout.Width(35)); GUILayout.Label("s post:", GUILayout.ExpandWidth(false)); autostagePostDelay.text = GUILayout.TextField(autostagePostDelay.text, GUILayout.Width(35)); GUILayout.Label("s", GUILayout.ExpandWidth(true)); GUILayout.EndHorizontal(); ClampAutostageThrust(); GUILayout.Label("Stage fairings when:"); GuiUtils.SimpleTextBox(" dynamic pressure <", fairingMaxDynamicPressure, "kPa", 50); GuiUtils.SimpleTextBox(" altitude >", fairingMinAltitude, "km", 50); GuiUtils.SimpleTextBox(" aerothermal flux <", fairingMaxAerothermalFlux, "W/m²", 50); GuiUtils.SimpleTextBox("Stop at stage #", autostageLimit, ""); hotStaging = GUILayout.Toggle(hotStaging, "Support hotstaging"); if (hotStaging) { GuiUtils.SimpleTextBox(" lead time", hotStagingLeadTime, "s"); } GUILayout.EndVertical(); }
public override void DoParametersGUI(Orbit o, double universalTime, MechJebModuleTargetController target) { _draggable = true; if (worker != null && !target.NormalTargetExists && Event.current.type == EventType.Layout) { worker.stop = true; worker = null; plot = null; } selectionMode = (Mode) GuiUtils.ComboBox.Box((int) selectionMode, modeNames, this); if (Event.current.type == EventType.Repaint) windowWidth = (int)GUILayoutUtility.GetLastRect().width; switch (selectionMode) { case Mode.LimitedTime: GuiUtils.SimpleTextBox("Max arrival time", maxArrivalTime); if (worker != null && !worker.Finished) GuiUtils.SimpleLabel("Computing: " + worker.Progress + "%"); break; case Mode.Porkchop: DoPorkchopGui(o, universalTime, target); break; } if (worker == null || worker.destinationOrbit != target.TargetOrbit || worker.originOrbit != o) ComputeTimes(o, target.TargetOrbit, universalTime); if (GUI.changed || worker == null || worker.destinationOrbit != target.TargetOrbit || worker.originOrbit != o) ComputeStuff(o, universalTime, target); }
public override void DrawItem() { if (val != null) { GuiUtils.SimpleTextBox(Localizer.Format(name), val, rightLabel, width);// } }
public override void DrawItem() { if (val != null) { GuiUtils.SimpleTextBox(name, val, rightLabel, width); } }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("Rendezvous Autopilot"); if (autopilot != null) { if (!autopilot.enabled) { GuiUtils.SimpleTextBox("final distance:", autopilot.desiredDistance, "m"); GuiUtils.SimpleTextBox("Max # of phasing orb.:", autopilot.maxPhasingOrbits); if (autopilot.maxPhasingOrbits < 5) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.yellow; GUILayout.Label("Max # of phasing orb. must be at least 5.", s); } } else { GUILayout.Label("Status: " + autopilot.status); } } base.postWindowGUI(windowID); }
protected override void WindowGUI(int windowID) { if (!core.target.NormalTargetExists) { GUILayout.Label("Select a target to rendezvous with."); base.WindowGUI(windowID); return; } MechJebModuleRendezvousAutopilot autopilot = core.GetComputerModule <MechJebModuleRendezvousAutopilot>(); if (core.target.Orbit.referenceBody != orbit.referenceBody) { GUILayout.Label("Rendezvous target must be in the same sphere of influence."); if (autopilot.enabled) { autopilot.users.Remove(this); } base.WindowGUI(windowID); return; } GUILayout.BeginVertical(); if (autopilot != null) { GuiUtils.SimpleLabel("Rendezvous target", core.target.Name); if (!autopilot.enabled) { if (GUILayout.Button("Engage autopilot")) { autopilot.users.Add(this); } } else { if (GUILayout.Button("Disengage autopilot")) { autopilot.users.Remove(this); } } GuiUtils.SimpleTextBox("Desired final distance:", autopilot.desiredDistance, "m"); if (autopilot.enabled) { GUILayout.Label("Status: " + autopilot.status); } } core.node.autowarp = GUILayout.Toggle(core.node.autowarp, "Auto-warp"); GUILayout.EndVertical(); base.WindowGUI(windowID); }
protected override void WindowGUI(int windowID) { GUILayout.BeginVertical(); GUIStyle s = new GUIStyle(GUI.skin.label); s.alignment = TextAnchor.MiddleCenter; List <Runway> availableRunways = MechJebModuleSpaceplaneAutopilot.runways.Where(p => p.body == mainBody).ToList(); if (runwayIndex > availableRunways.Count) { runwayIndex = 0; } if (availableRunways.Any()) { GUILayout.Label(Localizer.Format("#MechJeb_ApproAndLand_label1"), s);//Landing runwayIndex = GuiUtils.ComboBox.Box(runwayIndex, availableRunways.Select(p => p.name).ToArray(), this); autoland.runway = availableRunways[runwayIndex]; GUILayout.Label(Localizer.Format("#MechJeb_ApproAndLand_label2") + MuUtils.ToSI(Vector3d.Distance(vesselState.CoM, autoland.runway.Start()), 0) + "m"); //Distance to runway: showLandingTarget = GUILayout.Toggle(showLandingTarget, Localizer.Format("#MechJeb_ApproAndLand_label3")); //Show landing navball guidance if (GUILayout.Button(Localizer.Format("#MechJeb_ApproAndLan_button1"))) //Autoland { autoland.Autoland(this); } if (autoland.enabled && GUILayout.Button(Localizer.Format("#MechJeb_ApproAndLan_button2")))//Abort { autoland.AutopilotOff(); } GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_ApproAndLand_label14"), autoland.glideslope, "°"); //Autoland glideslope: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_ApproAndLand_label4"), autoland.approachSpeed, "m/s"); //Approach speed: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_ApproAndLand_label5"), autoland.touchdownSpeed, "m/s"); //Touchdown speed: autoland.bEngageReverseIfAvailable = GUILayout.Toggle(autoland.bEngageReverseIfAvailable, Localizer.Format("#MechJeb_ApproAndLand_label6")); //Reverse thrust upon touchdown autoland.bBreakAsSoonAsLanded = GUILayout.Toggle(autoland.bBreakAsSoonAsLanded, Localizer.Format("#MechJeb_ApproAndLand_label7")); //Brake as soon as landed if (autoland.enabled) { GUILayout.Label(Localizer.Format("#MechJeb_ApproAndLand_label8") + autoland.AutolandApproachStateToHumanReadableDescription()); //State: GUILayout.Label(Localizer.Format("#MechJeb_ApproAndLand_label9", Math.Round(autoland.GetAutolandLateralDistanceToNextWaypoint(), 0))); //Distance to waypoint: {0}m //GUILayout.Label(string.Format("Distance to waypoint: {0} m", Math.Round(autoland.GetAutolandLateralDistanceToNextWaypoint(), 0))); GUILayout.Label(Localizer.Format("#MechJeb_ApproAndLand_label10", Math.Round(autoland.Autopilot.SpeedTarget, 1))); //Target speed: {0} m/s GUILayout.Label(Localizer.Format("#MechJeb_ApproAndLand_label11", Math.Round(autoland.GetAutolandTargetAltitude(autoland.GetAutolandTargetVector()), 0))); //Target altitude: {0} m GUILayout.Label(Localizer.Format("#MechJeb_ApproAndLand_label12", Math.Round(autoland.Autopilot.VertSpeedTarget, 1))); //Target vertical speed: {0} m/s GUILayout.Label(Localizer.Format("#MechJeb_ApproAndLand_label13", Math.Round(autoland.Autopilot.HeadingTarget, 0))); //Target heading: {0}º } } GUILayout.EndVertical(); base.WindowGUI(windowID); }
public override void DoParametersGUI(Orbit o, double universalTime, MechJebModuleTargetController target) { intercept_only = GUILayout.Toggle(intercept_only, Localizer.Format("#MechJeb_Hohm_intercept_only")); //intercept only, no capture burn (impact/flyby) simpleTransfer = GUILayout.Toggle(simpleTransfer, Localizer.Format("#MechJeb_Hohm_simpleTransfer")); //simple coplanar Hohmann transfer GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Hohm_Label1"), periodOffset); //fractional target period offset if (!simpleTransfer) { timeSelector.DoChooseTimeGUI(); } }
public override void DoParametersGUI(Orbit o, double universalTime, MechJebModuleTargetController target) { intercept_only = GUILayout.Toggle(intercept_only, "intercept only, no capture burn (impact/flyby)"); simpleTransfer = GUILayout.Toggle(simpleTransfer, "simple coplanar Hohmann transfer"); GuiUtils.SimpleTextBox("fractional target period offset:", periodOffset); if (!simpleTransfer) { timeSelector.DoChooseTimeGUI(); } }
protected override void WindowGUI(int windowID) { GUILayout.BeginVertical(); GUIStyle s = new GUIStyle(GUI.skin.label); s.alignment = TextAnchor.MiddleCenter; GUILayout.Label("Landing", s); Runway[] runways = MechJebModuleSpaceplaneAutopilot.runways; int runwayIndex = Array.IndexOf(runways, autopilot.runway); runwayIndex = GuiUtils.ArrowSelector(runwayIndex, runways.Length, autopilot.runway.name); autopilot.runway = runways[runwayIndex]; GUILayout.Label("Distance to runway: " + MuUtils.ToSI(Vector3d.Distance(vesselState.CoM, autopilot.runway.Start(vesselState.CoM)), 0) + "m"); showLandingTarget = GUILayout.Toggle(showLandingTarget, "Show landing navball guidance"); if (GUILayout.Button("Autoland")) { autopilot.Autoland(this); } if (autopilot.enabled && autopilot.mode == MechJebModuleSpaceplaneAutopilot.Mode.AUTOLAND && GUILayout.Button("Abort")) { autopilot.AutopilotOff(); } GuiUtils.SimpleTextBox("Autoland glideslope:", autopilot.glideslope, "º"); GUILayout.Label("Hold", s); GUILayout.BeginHorizontal(); if (GUILayout.Button("Initiate hold:")) { autopilot.HoldHeadingAndAltitude(this); } GUILayout.Label("Heading:"); autopilot.targetHeading.text = GUILayout.TextField(autopilot.targetHeading.text, GUILayout.Width(40)); GUILayout.Label("º Altitude:"); autopilot.targetAltitude.text = GUILayout.TextField(autopilot.targetAltitude.text, GUILayout.Width(40)); GUILayout.Label("m"); GUILayout.EndHorizontal(); if (autopilot.enabled && autopilot.mode == MechJebModuleSpaceplaneAutopilot.Mode.HOLD && GUILayout.Button("Abort")) { autopilot.AutopilotOff(); } GUILayout.EndVertical(); base.WindowGUI(windowID); }
protected override void WindowGUI(int windowID) { GUILayout.BeginVertical(); GUIStyle s = new GUIStyle(GUI.skin.label); s.alignment = TextAnchor.MiddleCenter; List <Runway> availableRunways = MechJebModuleSpaceplaneAutopilot.runways.Where(p => p.body == mainBody).ToList(); if (runwayIndex > availableRunways.Count) { runwayIndex = 0; } if (availableRunways.Any()) { GUILayout.Label("Landing", s); runwayIndex = GuiUtils.ComboBox.Box(runwayIndex, availableRunways.Select(p => p.name).ToArray(), this); autoland.runway = availableRunways[runwayIndex]; GUILayout.Label("Distance to runway: " + MuUtils.ToSI(Vector3d.Distance(vesselState.CoM, autoland.runway.Start()), 0) + "m"); showLandingTarget = GUILayout.Toggle(showLandingTarget, "Show landing navball guidance"); if (GUILayout.Button("Autoland")) { autoland.Autoland(this); } if (autoland.enabled && GUILayout.Button("Abort")) { autoland.AutopilotOff(); } GuiUtils.SimpleTextBox("Autoland glideslope:", autoland.glideslope); GuiUtils.SimpleTextBox("Approach speed:", autoland.approachSpeed); GuiUtils.SimpleTextBox("Touchdown speed:", autoland.touchdownSpeed); autoland.bEngageReverseIfAvailable = GUILayout.Toggle(autoland.bEngageReverseIfAvailable, "Reverse thrust upon touchdown"); autoland.bBreakAsSoonAsLanded = GUILayout.Toggle(autoland.bBreakAsSoonAsLanded, "Break As Soon As Landed"); if (autoland.enabled) { GUILayout.Label("State: " + autoland.AutolandApproachStateToHumanReadableDescription()); GUILayout.Label(string.Format("Distance to waypoint: {0} m", Math.Round(autoland.GetAutolandLateralDistanceToNextWaypoint(), 0))); GUILayout.Label(string.Format("Target speed: {0} m/s", Math.Round(autoland.Autopilot.SpeedTarget, 1))); GUILayout.Label(string.Format("Target altitude: {0} m", Math.Round(autoland.GetAutolandTargetAltitude(autoland.GetAutolandTargetVector()), 0))); GUILayout.Label(string.Format("Target vertical speed: {0} m/s", Math.Round(autoland.Autopilot.VertSpeedTarget, 1))); GUILayout.Label(string.Format("Target heading: {0}º", Math.Round(autoland.Autopilot.HeadingTarget, 0))); } } GUILayout.EndVertical(); base.WindowGUI(windowID); }
public override void DoParametersGUI(Orbit o, double universalTime, MechJebModuleTargetController target) { if (target.Target is CelestialBody) { GuiUtils.SimpleTextBox("Approximate final periapsis", courseCorrectFinalPeA, "km"); } else { GuiUtils.SimpleTextBox("Closest approach distance", interceptDistance, "m"); } GUILayout.Label("Schedule the burn to minimize the required ΔV."); }
public override void DoParametersGUI(Orbit o, double universalTime, MechJebModuleTargetController target) { if (target.Target is CelestialBody) { GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_approach_label1"), courseCorrectFinalPeA, "km");//Approximate final periapsis } else { GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_approach_label2"), interceptDistance, "m"); //Closest approach distance } GUILayout.Label(Localizer.Format("#MechJeb_approach_label3")); //Schedule the burn to minimize the required ΔV. }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); if (!this.isStarted()) { GuiUtils.SimpleTextBox("Wait Time", time, "s", 30); } if (!this.isExecuted() && this.isStarted()) { GUILayout.Label("Wait T:-" + spendTime + "s", GUILayout.ExpandWidth(false)); } base.postWindowGUI(windowID); }
override public void WindowGUI(int windowID) { base.preWindowGUI(windowID); base.WindowGUI(windowID); GUILayout.Label("Warp to: ", GUILayout.ExpandWidth(false)); warpTarget = (WarpTarget)GuiUtils.ComboBox.Box((int)warpTarget, warpTargetStrings, this); if (warpTarget == WarpTarget.Time) { GUILayout.Label("Warp for: ", GUILayout.ExpandWidth(true)); timeOffset.text = GUILayout.TextField(timeOffset.text, GUILayout.Width(100)); } else if (warpTarget == WarpTarget.PhaseAngleT) { // I wonder if I should check for target that don't make sense if (!core.target.NormalTargetExists) { GUILayout.Label("You need a target"); } else { GuiUtils.SimpleTextBox("Phase Angle:", phaseAngle, "º", 60); } } if (!warping) { GuiUtils.SimpleTextBox("Lead time: ", leadTime, ""); } if (warping) { if (GUILayout.Button("Abort")) { this.onAbord(); } } if (warping) { GUILayout.Label("Warping to " + (leadTime > 0 ? GuiUtils.TimeToDHMS(leadTime) + " before " : "") + warpTargetStrings[(int)warpTarget] + "."); } if (this.isStarted() && !this.isExecuted() && this.startTime > 0) { GUILayout.Label(" waiting " + this.spendTime + "s"); } base.postWindowGUI(windowID); }
public void AutostageSettingsInfoItem() { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("Delays: pre:", GUILayout.ExpandWidth(false)); autostagePreDelay.text = GUILayout.TextField(autostagePreDelay.text, GUILayout.Width(35)); GUILayout.Label("s post:", GUILayout.ExpandWidth(false)); autostagePostDelay.text = GUILayout.TextField(autostagePostDelay.text, GUILayout.Width(35)); GUILayout.Label("s", GUILayout.ExpandWidth(true)); GUILayout.EndHorizontal(); GuiUtils.SimpleTextBox("Stop at stage #", autostageLimit, ""); GUILayout.EndVertical(); }
public override void DrawItem() { IEditable val = null; if (member is FieldInfo) { val = (IEditable)((FieldInfo)member).GetValue(obj); } else if (member is PropertyInfo) { val = (IEditable)((PropertyInfo)member).GetValue(obj, new object[] { }); } if (val != null) { GuiUtils.SimpleTextBox(name, val, rightLabel, width); } }
protected override void WindowGUI(int windowID) { if (path == null) { GUILayout.Label("Path is null!!!1!!1!1!1111!11eleven"); base.WindowGUI(windowID); } GUILayout.BeginVertical(); double oldTurnStartAltitude = path.turnStartAltitude; double oldTurnEndAltitude = path.turnEndAltitude; double oldTurnShapeExponent = path.turnShapeExponent; double oldTurnEndAngle = path.turnEndAngle; GuiUtils.SimpleTextBox("Turn start altitude:", path.turnStartAltitude, "km"); GuiUtils.SimpleTextBox("Turn end altitude:", path.turnEndAltitude, "km"); GuiUtils.SimpleTextBox("Final flight path angle:", path.turnEndAngle, "°"); GuiUtils.SimpleTextBox("Turn shape:", path.turnShapeExponent, "%"); // Round the slider's value (0..1) to sliderPrecision decimal places. int sliderPrecision = 3; double sliderTurnShapeExponent = GUILayout.HorizontalSlider((float)path.turnShapeExponent, 0.0F, 1.0F); if (Math.Round(Math.Abs(sliderTurnShapeExponent - oldTurnShapeExponent), sliderPrecision) > 0) { path.turnShapeExponent = new EditableDoubleMult(Math.Round(sliderTurnShapeExponent, sliderPrecision), 0.01); } GUILayout.Box(pathTexture); GUILayout.EndVertical(); if (path.turnStartAltitude != oldTurnStartAltitude || path.turnEndAltitude != oldTurnEndAltitude || path.turnShapeExponent != oldTurnShapeExponent || path.turnEndAngle != oldTurnEndAngle || !pathTextureDrawnBefore) { UpdatePathTexture(); } base.WindowGUI(windowID); }
public void AutostageSettingsInfoItem() { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("Delays: pre:", GUILayout.ExpandWidth(false)); autostagePreDelay.text = GUILayout.TextField(autostagePreDelay.text, GUILayout.Width(35)); GUILayout.Label("s post:", GUILayout.ExpandWidth(false)); autostagePostDelay.text = GUILayout.TextField(autostagePostDelay.text, GUILayout.Width(35)); GUILayout.Label("s", GUILayout.ExpandWidth(true)); GUILayout.EndHorizontal(); GUILayout.Label("Stage fairings when:"); GuiUtils.SimpleTextBox(" dynamic pressure <", fairingMaxDynamicPressure, "kPa", 50); GuiUtils.SimpleTextBox(" altitude >", fairingMinAltitude, "km", 50); GuiUtils.SimpleTextBox("Stop at stage #", autostageLimit, ""); GUILayout.EndVertical(); }
protected override void WindowGUI(int windowID) { if (path == null) { GUILayout.Label("Path is null!!!1!!1!1!1111!11eleven"); base.WindowGUI(windowID); return; } GUILayout.BeginVertical(); GuiUtils.SimpleTextBox("Turn start altitude:", path.turnStartAltitude, "km"); GuiUtils.SimpleTextBox("Turn start velocity:", path.turnStartVelocity, "m/s"); GuiUtils.SimpleTextBox("Turn start pitch:", path.turnStartPitch, "deg"); GuiUtils.SimpleTextBox("Intermediate altitude:", path.intermediateAltitude, "km"); GuiUtils.SimpleTextBox("Hold AP Time:", path.holdAPTime, "s"); GUILayout.EndVertical(); base.WindowGUI(windowID); }
protected override void WindowGUI(int windowID) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("Warp to: ", GUILayout.ExpandWidth(false)); warpTarget = (WarpTarget)GuiUtils.ArrowSelector((int)warpTarget, numWarpTargets, warpTargetStrings[(int)warpTarget]); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GuiUtils.SimpleTextBox("Lead time: ", leadTime, ""); if (warping) { if (GUILayout.Button("Abort")) { warping = false; core.warp.MinimumWarp(true); } } else { if (GUILayout.Button("Warp")) { warping = true; } } GUILayout.EndHorizontal(); if (warping) { GUILayout.Label("Warping to " + (leadTime > 0 ? GuiUtils.TimeToDHMS(leadTime) + " before " : "") + warpTargetStrings[(int)warpTarget] + "."); } GUILayout.EndVertical(); GUI.DragWindow(); }
public void WindowGUI(int windowID) { selectedCondition = GuiUtils.ComboBox.Box(selectedCondition, conditionsList.ToArray(), conditionsList); selectedModifier = GuiUtils.ComboBox.Box(selectedModifier, modifiersList.ToArray(), modifiersList); if (!action.isStarted()) { GuiUtils.SimpleTextBox("", value0, "", 100); value0unit = GuiUtils.ComboBox.Box(value0unit, units0list, units0list); if (selectedModifier == 3) { GuiUtils.SimpleTextBox("and", value1, "", 100); value1unit = GuiUtils.ComboBox.Box(value1unit, units1list, units1list); } } else { GUILayout.Label("" + value0.val + " " + units0list[value0unit]); if (selectedModifier == 3) { GUILayout.Label(" and " + value1.val + " " + units1list[value1unit]); } } if (action.isStarted() || action.isExecuted()) { GUIStyle s = new GUIStyle(GUI.skin.label); if (this.conditionVerified) { s.normal.textColor = Color.green; GUILayout.Label("(Verified " + this.getStringWhenConditionCheck() + ")", s, GUILayout.ExpandWidth(false)); } else { s.normal.textColor = Color.red; GUILayout.Label("(NOT Verified " + this.getStringWhenConditionCheck() + ")", s, GUILayout.ExpandWidth(false)); } } }
protected override void WindowGUI(int windowID) { if (btNormal == null) { btNormal = new GUIStyle(GUI.skin.button); btNormal.normal.textColor = btNormal.focused.textColor = Color.white; btNormal.hover.textColor = btNormal.active.textColor = Color.yellow; btNormal.onNormal.textColor = btNormal.onFocused.textColor = btNormal.onHover.textColor = btNormal.onActive.textColor = Color.green; btNormal.padding = new RectOffset(8, 8, 8, 8); btActive = new GUIStyle(btNormal); btActive.active = btActive.onActive; btActive.normal = btActive.onNormal; btActive.onFocused = btActive.focused; btActive.hover = btActive.onHover; btAuto = new GUIStyle(btNormal); btAuto.normal.textColor = Color.red; btAuto.onActive = btAuto.onFocused = btAuto.onHover = btAuto.onNormal = btAuto.active = btAuto.focused = btAuto.hover = btAuto.normal; } // If any other module use the attitude controler then let them do it if (core.attitude.enabled && core.attitude.users.Count(u => !this.Equals(u)) > 0) { if (autoDisableSmartASS) { target = Target.OFF; if (core.attitude.users.Contains(this)) { core.attitude.users.Remove(this); // so we don't suddenly turn on when the other autopilot finishes } } GUILayout.Button("AUTO", btAuto, GUILayout.ExpandWidth(true)); } else { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); TargetButton(Target.OFF); TargetButton(Target.KILLROT); if (vessel.patchedConicsUnlocked()) { TargetButton(Target.NODE); } else { GUILayout.Button("-", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); } GUILayout.EndHorizontal(); GUILayout.Label("Mode:"); GUILayout.BeginHorizontal(); ModeButton(Mode.ORBITAL); ModeButton(Mode.SURFACE); ModeButton(Mode.TARGET); ModeButton(Mode.ADVANCED); GUILayout.EndHorizontal(); switch (mode) { case Mode.ORBITAL: GUILayout.BeginHorizontal(); TargetButton(Target.PROGRADE); TargetButton(Target.NORMAL_PLUS); TargetButton(Target.RADIAL_PLUS); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); TargetButton(Target.RETROGRADE); TargetButton(Target.NORMAL_MINUS); TargetButton(Target.RADIAL_MINUS); GUILayout.EndHorizontal(); ForceRoll(); break; case Mode.SURFACE: double val = (GameSettings.MODIFIER_KEY.GetKey() ? 5 : 1); // change by 5 if the mod_key is held down, else by 1 GUILayout.BeginHorizontal(); TargetButton(Target.SURFACE_PROGRADE); TargetButton(Target.SURFACE_RETROGRADE); TargetButtonNoEngage(Target.SURFACE); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); TargetButton(Target.HORIZONTAL_PLUS); TargetButton(Target.HORIZONTAL_MINUS); TargetButton(Target.VERTICAL_PLUS); GUILayout.EndHorizontal(); if (target == Target.SURFACE) { bool changed = false; GUILayout.BeginHorizontal(); forceYaw = GUILayout.Toggle(forceYaw, "", GUILayout.ExpandWidth(false)); GuiUtils.SimpleTextBox("HDG", srfHdg, "°", 37); if (GUILayout.Button("-", GUILayout.ExpandWidth(false))) { srfHdg -= val; changed = true; } if (GUILayout.Button("+", GUILayout.ExpandWidth(false))) { srfHdg += val; changed = true; } if (GUILayout.Button("0", GUILayout.ExpandWidth(false))) { srfHdg = 0; changed = true; } if (GUILayout.Button("90", GUILayout.Width(35))) { srfHdg = 90; changed = true; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); forcePitch = GUILayout.Toggle(forcePitch, "", GUILayout.ExpandWidth(false)); GuiUtils.SimpleTextBox("PIT", srfPit, "°", 37); if (GUILayout.Button("-", GUILayout.ExpandWidth(false))) { srfPit -= val; changed = true; } if (GUILayout.Button("+", GUILayout.ExpandWidth(false))) { srfPit += val; changed = true; } if (GUILayout.Button("0", GUILayout.ExpandWidth(false))) { srfPit = 0; changed = true; } if (GUILayout.Button("90", GUILayout.Width(35))) { srfPit = 90; changed = true; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); forceRol = GUILayout.Toggle(forceRol, "", GUILayout.ExpandWidth(false)); GuiUtils.SimpleTextBox("ROL", srfRol, "°", 37); if (GUILayout.Button("-", GUILayout.ExpandWidth(false))) { srfRol -= val; changed = true; } if (GUILayout.Button("+", GUILayout.ExpandWidth(false))) { srfRol += val; changed = true; } if (GUILayout.Button("0", GUILayout.ExpandWidth(false))) { srfRol = 0; changed = true; } if (GUILayout.Button("180", GUILayout.Width(35))) { srfRol = 180; changed = true; } GUILayout.EndHorizontal(); if (GUILayout.Button("EXECUTE")) { Engage(); } if (changed) { Engage(false); } core.attitude.AxisControl(forcePitch, forceYaw, forceRol); } else if (target == Target.SURFACE_PROGRADE || target == Target.SURFACE_RETROGRADE) { bool changed = false; GUILayout.BeginHorizontal(); forceRol = GUILayout.Toggle(forceRol, "", GUILayout.ExpandWidth(false)); GuiUtils.SimpleTextBox("ROL", srfVelRol, "°", 37); if (GUILayout.Button("-", GUILayout.ExpandWidth(false))) { srfVelRol -= val; changed = true; } if (GUILayout.Button("+", GUILayout.ExpandWidth(false))) { srfVelRol += val; changed = true; } if (GUILayout.Button("CUR", GUILayout.ExpandWidth(false))) { srfVelRol = -vesselState.vesselRoll.value; changed = true; } if (GUILayout.Button("0", GUILayout.ExpandWidth(false))) { srfVelRol = 0; changed = true; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); forcePitch = GUILayout.Toggle(forcePitch, "", GUILayout.ExpandWidth(false)); GuiUtils.SimpleTextBox("PIT", srfVelPit, "°", 37); if (GUILayout.Button("-", GUILayout.ExpandWidth(false))) { srfVelPit -= val; changed = true; } if (GUILayout.Button("+", GUILayout.ExpandWidth(false))) { srfVelPit += val; changed = true; } if (GUILayout.Button("CUR", GUILayout.ExpandWidth(false))) { srfVelPit = vesselState.AoA.value; changed = true; } if (GUILayout.Button("0", GUILayout.ExpandWidth(false))) { srfVelPit = 0; changed = true; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); forceYaw = GUILayout.Toggle(forceYaw, "", GUILayout.ExpandWidth(false)); GuiUtils.SimpleTextBox("YAW", srfVelYaw, "°", 37); if (GUILayout.Button("-", GUILayout.ExpandWidth(false))) { srfVelYaw -= val; changed = true; } if (GUILayout.Button("+", GUILayout.ExpandWidth(false))) { srfVelYaw += val; changed = true; } if (GUILayout.Button("CUR", GUILayout.ExpandWidth(false))) { srfVelYaw = -vesselState.AoS.value; changed = true; } if (GUILayout.Button("0", GUILayout.ExpandWidth(false))) { srfVelYaw = 0; changed = true; } GUILayout.EndHorizontal(); if (GUILayout.Button("EXECUTE")) { Engage(); } if (changed) { Engage(false); } core.attitude.AxisControl(forcePitch, forceYaw, forceRol); } break; case Mode.TARGET: if (core.target.NormalTargetExists) { GUILayout.BeginHorizontal(); TargetButton(Target.TARGET_PLUS); TargetButton(Target.RELATIVE_PLUS); TargetButton(Target.PARALLEL_PLUS); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); TargetButton(Target.TARGET_MINUS); TargetButton(Target.RELATIVE_MINUS); TargetButton(Target.PARALLEL_MINUS); GUILayout.EndHorizontal(); ForceRoll(); } else { GUILayout.Label("Please select a target"); } break; case Mode.ADVANCED: GUILayout.Label("Reference:"); advReference = (AttitudeReference)GuiUtils.ComboBox.Box((int)advReference, ReferenceTexts, this); GUILayout.Label("Direction:"); advDirection = (Vector6.Direction)GuiUtils.ComboBox.Box((int)advDirection, directionTexts, directionTexts); ForceRoll(); if (GUILayout.Button("EXECUTE", btNormal, GUILayout.ExpandWidth(true))) { target = Target.ADVANCED; Engage(); } break; case Mode.AUTO: break; } GUILayout.EndVertical(); } base.WindowGUI(windowID); }
public override void DoParametersGUI(Orbit o, double universalTime, MechJebModuleTargetController target) { GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ap_label1"), newApA, "km");//New apoapsis: timeSelector.DoChooseTimeGUI(); }
public override void DoParametersGUI(Orbit o, double universalTime, MechJebModuleTargetController target) { GuiUtils.SimpleTextBox("Time after burn to intercept target:", interceptInterval); timeSelector.DoChooseTimeGUI(); }
protected override void WindowGUI(int windowID) { if (vessel.patchedConicSolver.maneuverNodes.Count == 0) { GUILayout.Label(Localizer.Format("#MechJeb_NodeEd_Label1"));//"No maneuver nodes to edit." RelativityModeSelectUI(); base.WindowGUI(windowID); return; } GUILayout.BeginVertical(); ManeuverNode oldNode = node; if (vessel.patchedConicSolver.maneuverNodes.Count == 1) { node = vessel.patchedConicSolver.maneuverNodes[0]; } else { if (!vessel.patchedConicSolver.maneuverNodes.Contains(node)) { node = vessel.patchedConicSolver.maneuverNodes[0]; } int nodeIndex = vessel.patchedConicSolver.maneuverNodes.IndexOf(node); int numNodes = vessel.patchedConicSolver.maneuverNodes.Count; nodeIndex = GuiUtils.ArrowSelector(nodeIndex, numNodes, "Maneuver node #" + (nodeIndex + 1)); node = vessel.patchedConicSolver.maneuverNodes[nodeIndex]; if (nodeIndex < (numNodes - 1) && GUILayout.Button(Localizer.Format("#MechJeb_NodeEd_button1"))) { MergeNext(nodeIndex); //"Merge next node" } } if (node != oldNode) { prograde = node.DeltaV.z; radialPlus = node.DeltaV.x; normalPlus = node.DeltaV.y; } if (gizmo != node.attachedGizmo) { if (gizmo != null) { gizmo.OnGizmoUpdated -= GizmoUpdateHandler; } gizmo = node.attachedGizmo; if (gizmo != null) { gizmo.OnGizmoUpdated += GizmoUpdateHandler; } } GUILayout.BeginHorizontal(); GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_NodeEd_Label2"), prograde, "m/s", 60);//"Prograde:" if (LimitedRepeatButtoon("-")) { prograde -= progradeDelta; node.UpdateNode(new Vector3d(radialPlus, normalPlus, prograde), node.UT); } progradeDelta.text = GUILayout.TextField(progradeDelta.text, GUILayout.Width(50)); if (LimitedRepeatButtoon("+")) { prograde += progradeDelta; node.UpdateNode(new Vector3d(radialPlus, normalPlus, prograde), node.UT); } GUILayout.Label("m/s", GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_NodeEd_Label3"), radialPlus, "m/s", 60);//"Radial+:" if (LimitedRepeatButtoon("-")) { radialPlus -= radialPlusDelta; node.UpdateNode(new Vector3d(radialPlus, normalPlus, prograde), node.UT); } radialPlusDelta.text = GUILayout.TextField(radialPlusDelta.text, GUILayout.Width(50)); if (LimitedRepeatButtoon("+")) { radialPlus += radialPlusDelta; node.UpdateNode(new Vector3d(radialPlus, normalPlus, prograde), node.UT); } GUILayout.Label("m/s", GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_NodeEd_Label4"), normalPlus, "m/s", 60);//"Normal+:" if (LimitedRepeatButtoon("-")) { normalPlus -= normalPlusDelta; node.UpdateNode(new Vector3d(radialPlus, normalPlus, prograde), node.UT); } normalPlusDelta.text = GUILayout.TextField(normalPlusDelta.text, GUILayout.Width(50)); if (LimitedRepeatButtoon("+")) { normalPlus += normalPlusDelta; node.UpdateNode(new Vector3d(radialPlus, normalPlus, prograde), node.UT); } GUILayout.Label("m/s", GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("#MechJeb_NodeEd_Label5"), GUILayout.ExpandWidth(true));//"Set delta to:" if (GUILayout.Button("0.01", GUILayout.ExpandWidth(true))) { progradeDelta = radialPlusDelta = normalPlusDelta = 0.01; } if (GUILayout.Button("0.1", GUILayout.ExpandWidth(true))) { progradeDelta = radialPlusDelta = normalPlusDelta = 0.1; } if (GUILayout.Button("1", GUILayout.ExpandWidth(true))) { progradeDelta = radialPlusDelta = normalPlusDelta = 1; } if (GUILayout.Button("10", GUILayout.ExpandWidth(true))) { progradeDelta = radialPlusDelta = normalPlusDelta = 10; } if (GUILayout.Button("100", GUILayout.ExpandWidth(true))) { progradeDelta = radialPlusDelta = normalPlusDelta = 100; } GUILayout.EndHorizontal(); if (GUILayout.Button(Localizer.Format("#MechJeb_NodeEd_button2"))) { node.UpdateNode(new Vector3d(radialPlus, normalPlus, prograde), node.UT); //"Update" } GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("#MechJeb_NodeEd_Label6"), GUILayout.ExpandWidth(true));//"Shift time" if (GUILayout.Button("-o", GUILayout.ExpandWidth(false))) { node.UpdateNode(node.DeltaV, node.UT - node.patch.period); } if (GUILayout.Button("-", GUILayout.ExpandWidth(false))) { node.UpdateNode(node.DeltaV, node.UT - timeOffset); } timeOffset.text = GUILayout.TextField(timeOffset.text, GUILayout.Width(100)); if (GUILayout.Button("+", GUILayout.ExpandWidth(false))) { node.UpdateNode(node.DeltaV, node.UT + timeOffset); } if (GUILayout.Button("+o", GUILayout.ExpandWidth(false))) { node.UpdateNode(node.DeltaV, node.UT + node.patch.period); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button(Localizer.Format("#MechJeb_NodeEd_button3"), GUILayout.ExpandWidth(true)))//"Snap node to" { Orbit o = node.patch; double UT = node.UT; switch (snap) { case Snap.PERIAPSIS: UT = o.NextPeriapsisTime(o.eccentricity < 1 ? UT - o.period / 2 : UT); break; case Snap.APOAPSIS: if (o.eccentricity < 1) { UT = o.NextApoapsisTime(UT - o.period / 2); } break; case Snap.EQ_ASCENDING: if (o.AscendingNodeEquatorialExists()) { UT = o.TimeOfAscendingNodeEquatorial(UT - o.period / 2); } break; case Snap.EQ_DESCENDING: if (o.DescendingNodeEquatorialExists()) { UT = o.TimeOfDescendingNodeEquatorial(UT - o.period / 2); } break; case Snap.REL_ASCENDING: if (core.target.NormalTargetExists && core.target.TargetOrbit.referenceBody == o.referenceBody) { if (o.AscendingNodeExists(core.target.TargetOrbit)) { UT = o.TimeOfAscendingNode(core.target.TargetOrbit, UT - o.period / 2); } } break; case Snap.REL_DESCENDING: if (core.target.NormalTargetExists && core.target.TargetOrbit.referenceBody == o.referenceBody) { if (o.DescendingNodeExists(core.target.TargetOrbit)) { UT = o.TimeOfDescendingNode(core.target.TargetOrbit, UT - o.period / 2); } } break; } node.UpdateNode(node.DeltaV, UT); } snap = (Snap)GuiUtils.ArrowSelector((int)snap, numSnaps, snapStrings[(int)snap]); GUILayout.EndHorizontal(); RelativityModeSelectUI(); if (core.node != null) { if (vessel.patchedConicSolver.maneuverNodes.Count > 0 && !core.node.enabled) { if (GUILayout.Button(Localizer.Format("#MechJeb_NodeEd_button4")))//"Execute next node" { core.node.ExecuteOneNode(this); } if (MechJebModuleGuidanceController.isLoadedPrincipia && GUILayout.Button(Localizer.Format("#MechJeb_NodeEd_button7")))//Execute next Principia node { core.node.ExecuteOnePNode(this); } if (vessel.patchedConicSolver.maneuverNodes.Count > 1) { if (GUILayout.Button(Localizer.Format("#MechJeb_NodeEd_button5")))//"Execute all nodes" { core.node.ExecuteAllNodes(this); } } } else if (core.node.enabled) { if (GUILayout.Button(Localizer.Format("#MechJeb_NodeEd_button6")))//"Abort node execution" { core.node.Abort(); } } GUILayout.BeginHorizontal(); core.node.autowarp = GUILayout.Toggle(core.node.autowarp, Localizer.Format("#MechJeb_NodeEd_checkbox1"), GUILayout.ExpandWidth(true)); //"Auto-warp" GUILayout.Label(Localizer.Format("#MechJeb_NodeEd_Label7"), GUILayout.ExpandWidth(false)); //"Tolerance:" core.node.tolerance.text = GUILayout.TextField(core.node.tolerance.text, GUILayout.Width(35), GUILayout.ExpandWidth(false)); GUILayout.Label("m/s", GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); base.WindowGUI(windowID); }
protected override void WindowGUI(int windowID) { if (btNormal == null) { btNormal = new GUIStyle(GUI.skin.button); btNormal.normal.textColor = btNormal.focused.textColor = Color.white; btNormal.hover.textColor = btNormal.active.textColor = Color.yellow; btNormal.onNormal.textColor = btNormal.onFocused.textColor = btNormal.onHover.textColor = btNormal.onActive.textColor = Color.green; btNormal.padding = new RectOffset(8, 8, 8, 8); btActive = new GUIStyle(btNormal); btActive.active = btActive.onActive; btActive.normal = btActive.onNormal; btActive.onFocused = btActive.focused; btActive.hover = btActive.onHover; } GUILayout.BeginVertical(); if (autopilot != null) { if (autopilot.enabled) { if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button1")))//Disengage autopilot { autopilot.users.Remove(this); } } else { if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button2")))//Engage autopilot { autopilot.users.Add(this); } } if (ascentPathIdx == ascentType.PVG) { if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button3")))//Reset Guidance (DO NOT PRESS) { core.guidance.Reset(); } GUILayout.BeginHorizontal(); // EditorStyles.toolbar); if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button4"), autopilot.showTargeting ? btActive : btNormal, GUILayout.ExpandWidth(true))) //"TARG" { autopilot.showTargeting = !autopilot.showTargeting; } if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button5"), autopilot.showGuidanceSettings ? btActive : btNormal, GUILayout.ExpandWidth(true))) //GUID { autopilot.showGuidanceSettings = !autopilot.showGuidanceSettings; } if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button6"), autopilot.showSettings ? btActive : btNormal, GUILayout.ExpandWidth(true))) //OPTS { autopilot.showSettings = !autopilot.showSettings; } if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button7"), autopilot.showStatus ? btActive : btNormal, GUILayout.ExpandWidth(true))) //STATUS { autopilot.showStatus = !autopilot.showStatus; } GUILayout.EndHorizontal(); } else if (ascentPathIdx == ascentType.GRAVITYTURN) { GUILayout.BeginHorizontal(); // EditorStyles.toolbar); if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button8"), autopilot.showTargeting ? btActive : btNormal, GUILayout.ExpandWidth(true))) //TARG { autopilot.showTargeting = !autopilot.showTargeting; } if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button9"), autopilot.showGuidanceSettings ? btActive : btNormal, GUILayout.ExpandWidth(true))) //GUID { autopilot.showGuidanceSettings = !autopilot.showGuidanceSettings; } if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button10"), autopilot.showSettings ? btActive : btNormal, GUILayout.ExpandWidth(true))) //OPTS { autopilot.showSettings = !autopilot.showSettings; } GUILayout.EndHorizontal(); } else if (ascentPathIdx == ascentType.BREATHING_GT) { GUILayout.BeginHorizontal(); // EditorStyles.toolbar); if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button8"), autopilot.showTargeting ? btActive : btNormal, GUILayout.ExpandWidth(true))) //TARG { autopilot.showTargeting = !autopilot.showTargeting; } if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button9"), autopilot.showGuidanceSettings ? btActive : btNormal, GUILayout.ExpandWidth(true)))//GUID { autopilot.showGuidanceSettings = !autopilot.showGuidanceSettings; } if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button10"), autopilot.showSettings ? btActive : btNormal, GUILayout.ExpandWidth(true)))//OPTS { autopilot.showSettings = !autopilot.showSettings; } GUILayout.EndHorizontal(); } else if (ascentPathIdx == ascentType.CLASSIC) { GUILayout.BeginHorizontal(); // EditorStyles.toolbar); if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button11"), autopilot.showTargeting ? btActive : btNormal, GUILayout.ExpandWidth(true))) //TARG { autopilot.showTargeting = !autopilot.showTargeting; } if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button12"), autopilot.showSettings ? btActive : btNormal, GUILayout.ExpandWidth(true))) //OPTS { autopilot.showSettings = !autopilot.showSettings; } GUILayout.EndHorizontal(); } if (autopilot.showTargeting) { if (ascentPathIdx == ascentType.PVG) { GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label1"), autopilot.desiredOrbitAltitude, "km"); //Target Periapsis GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label2"), pvgascent.desiredApoapsis, "km"); //Target Apoapsis: if (pvgascent.desiredApoapsis >= 0 && pvgascent.desiredApoapsis < autopilot.desiredOrbitAltitude) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.yellow; GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label3"), s);//Ap < Pe: circularizing orbit } if (pvgascent.desiredApoapsis < 0) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = XKCDColors.Orange; GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label4"), s);//Hyperbolic target orbit (neg Ap) } } else { GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label5"), autopilot.desiredOrbitAltitude, "km");//Orbit altitude } GUIStyle si = new GUIStyle(GUI.skin.label); if (Math.Abs(desiredInclination) < Math.Abs(vesselState.latitude) - 2.001) { si.onHover.textColor = si.onNormal.textColor = si.normal.textColor = XKCDColors.Orange; } GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label6"), si, GUILayout.ExpandWidth(true));//Orbit inc. desiredInclination.text = GUILayout.TextField(desiredInclination.text, GUILayout.ExpandWidth(true), GUILayout.Width(100)); GUILayout.Label("º", GUILayout.ExpandWidth(false)); if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button13")))//Current { desiredInclination.val = vesselState.latitude; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (Math.Abs(desiredInclination) < Math.Abs(vesselState.latitude) - 2.001) { GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label7", Math.Abs(vesselState.latitude) - Math.Abs(desiredInclination)), si);//inc {0:F1}º below current latitude } GUILayout.EndHorizontal(); autopilot.desiredInclination = desiredInclination; } if (autopilot.showGuidanceSettings) { if (ascentPathIdx == ascentType.GRAVITYTURN) { GUILayout.BeginVertical(); GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label8"), gtascent.turnStartAltitude, "km"); //Turn start altitude: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label9"), gtascent.turnStartVelocity, "m/s"); //Turn start velocity: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label10"), gtascent.turnStartPitch, "deg"); //Turn start pitch: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label11"), gtascent.intermediateAltitude, "km"); //Intermediate altitude: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label12"), gtascent.holdAPTime, "s"); //Hold AP Time: GUILayout.EndVertical(); } else if (ascentPathIdx == ascentType.BREATHING_GT) { GUILayout.BeginVertical(); //GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label8"), bgtascent.turnStartAltitude, "km");//Turn start altitude: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label9"), bgtascent.turnStartVelocity, "m/s"); //Turn start velocity: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label10"), bgtascent.turnStartPitch, "deg"); //Turn start pitch: GuiUtils.SimpleTextBox(Localizer.Format("speed for breathing mode:"), bgtascent.startBreathingSpeed, "m/s"); //speed for breathing mode: GuiUtils.SimpleTextBox(Localizer.Format("TWR to throttle other:"), bgtascent.minTWRthrottle, "s"); //TWR to throttle other: GUILayout.EndVertical(); } else if (ascentPathIdx == ascentType.PVG) { GUILayout.BeginVertical(); GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label13"), pvgascent.pitchStartVelocity, "m/s"); //Booster Pitch start: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label14"), pvgascent.pitchRate, "°/s"); //Booster Pitch rate: GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label15"), core.guidance.pvgInterval, "s"); //Guidance Interval: if (core.guidance.pvgInterval < 1 || core.guidance.pvgInterval > 30) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.yellow; GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label16"), s); //Guidance intervals are limited to between 1s and 30s } GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label17"), autopilot.limitQa, "Pa-rad"); //Qα limit if (autopilot.limitQa < 100 || autopilot.limitQa > 4000) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.yellow; if (autopilot.limitQa < 100) { GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label18"), s);//Qα limit cannot be set to lower than 100 Pa-rad } else if (autopilot.limitQa > 10000) { GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label19"), s);//Qα limit cannot be set to higher than 10000 Pa-rad } else { GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label20"), s);//Qα limit is recommended to be 1000 to 4000 Pa-rad } } pvgascent.omitCoast = GUILayout.Toggle(pvgascent.omitCoast, Localizer.Format("#MechJeb_Ascent_checkbox1"));//Omit Coast GUILayout.EndVertical(); } } autopilot.limitQaEnabled = (ascentPathIdx == ascentType.PVG); // this is mandatory for PVG if (autopilot.showSettings) { ToggleAscentNavballGuidanceInfoItem(); if (ascentPathIdx != ascentType.PVG) { core.thrust.LimitToPreventOverheatsInfoItem(); //core.thrust.LimitToTerminalVelocityInfoItem(); core.thrust.LimitToMaxDynamicPressureInfoItem(); core.thrust.LimitAccelerationInfoItem(); core.thrust.LimitThrottleInfoItem(); core.thrust.LimiterMinThrottleInfoItem(); core.thrust.LimitElectricInfoItem(); } else { core.thrust.LimitToPreventOverheatsInfoItem(); //core.thrust.LimitToTerminalVelocityInfoItem(); core.thrust.LimitToMaxDynamicPressureInfoItem(); //core.thrust.LimitAccelerationInfoItem(); //core.thrust.LimitThrottleInfoItem(); core.thrust.LimiterMinThrottleInfoItem(); //core.thrust.LimitElectricInfoItem(); GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label21")); //FIXME: g-limiter is down for maintenance core.thrust.limitAcceleration = false; core.thrust.limitThrottle = false; core.thrust.limitToTerminalVelocity = false; core.thrust.electricThrottle = false; } GUILayout.BeginHorizontal(); autopilot.forceRoll = GUILayout.Toggle(autopilot.forceRoll, Localizer.Format("#MechJeb_Ascent_checkbox2"));//Force Roll if (autopilot.forceRoll) { GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label22"), autopilot.verticalRoll, "º", 30f); //climb GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label23"), autopilot.turnRoll, "º", 30f); //turn } GUILayout.EndHorizontal(); if (ascentPathIdx != ascentType.PVG) { GUILayout.BeginHorizontal(); GUIStyle s = new GUIStyle(GUI.skin.toggle); if (autopilot.limitingAoA) { s.onHover.textColor = s.onNormal.textColor = Color.green; } autopilot.limitAoA = GUILayout.Toggle(autopilot.limitAoA, Localizer.Format("#MechJeb_Ascent_checkbox3"), s, GUILayout.ExpandWidth(true));//Limit AoA to autopilot.maxAoA.text = GUILayout.TextField(autopilot.maxAoA.text, GUILayout.Width(30)); GUILayout.Label("º (" + autopilot.currentMaxAoA.ToString("F1") + "°)", GUILayout.ExpandWidth(true)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(25); if (autopilot.limitAoA) { GUIStyle sl = new GUIStyle(GUI.skin.label); if (autopilot.limitingAoA && vesselState.dynamicPressure < autopilot.aoALimitFadeoutPressure) { sl.normal.textColor = sl.hover.textColor = Color.green; } GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_Ascent_label24"), autopilot.aoALimitFadeoutPressure, "Pa", 50, sl);//Dynamic Pressure Fadeout } GUILayout.EndHorizontal(); autopilot.limitQaEnabled = false; // this is only for PVG } if (ascentPathIdx == ascentType.CLASSIC) { // corrective steering only applies to Classic GUILayout.BeginHorizontal(); autopilot.correctiveSteering = GUILayout.Toggle(autopilot.correctiveSteering, Localizer.Format("#MechJeb_Ascent_checkbox4"), GUILayout.ExpandWidth(false));//Corrective steering if (autopilot.correctiveSteering) { GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label25"), GUILayout.ExpandWidth(false));//Gain autopilot.correctiveSteeringGain.text = GUILayout.TextField(autopilot.correctiveSteeringGain.text, GUILayout.Width(40)); } GUILayout.EndHorizontal(); } autopilot.autostage = GUILayout.Toggle(autopilot.autostage, Localizer.Format("#MechJeb_Ascent_checkbox5"));//Autostage if (autopilot.autostage) { core.staging.AutostageSettingsInfoItem(); } autopilot.autodeploySolarPanels = GUILayout.Toggle(autopilot.autodeploySolarPanels, Localizer.Format("#MechJeb_Ascent_checkbox6"));//Auto-deploy solar panels autopilot.autoDeployAntennas = GUILayout.Toggle(autopilot.autoDeployAntennas, Localizer.Format("#MechJeb_Ascent_checkbox7"));//Auto-deploy antennas GUILayout.BeginHorizontal(); core.node.autowarp = GUILayout.Toggle(core.node.autowarp, Localizer.Format("#MechJeb_Ascent_checkbox8"));//Auto-warp if (ascentPathIdx != ascentType.PVG) { autopilot.skipCircularization = GUILayout.Toggle(autopilot.skipCircularization, Localizer.Format("#MechJeb_Ascent_checkbox9"));//Skip Circularization } else { // skipCircularization is always true for Optimizer autopilot.skipCircularization = true; } GUILayout.EndHorizontal(); } if (autopilot.showStatus) { if (ascentPathIdx == ascentType.PVG) { if (core.guidance.solution != null) { for (int i = core.guidance.solution.num_segments; i > 0; i--) { GUILayout.Label(String.Format("{0}: {1}", i, core.guidance.solution.ArcString(vesselState.time, i - 1))); } } GUILayout.BeginHorizontal(); GUILayout.Label(String.Format("vgo: {0:F1}", core.guidance.vgo), GUILayout.Width(100)); GUILayout.Label(String.Format("heading: {0:F1}", core.guidance.heading), GUILayout.Width(100)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(String.Format("tgo: {0:F3}", core.guidance.tgo), GUILayout.Width(100)); GUILayout.Label(String.Format("pitch: {0:F1}", core.guidance.pitch), GUILayout.Width(100)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUIStyle si = new GUIStyle(GUI.skin.label); if (core.guidance.isStable()) { si.onHover.textColor = si.onNormal.textColor = si.normal.textColor = XKCDColors.Green; } else if (core.guidance.isInitializing() || core.guidance.status == PVGStatus.FINISHED) { si.onHover.textColor = si.onNormal.textColor = si.normal.textColor = XKCDColors.Orange; } else { si.onHover.textColor = si.onNormal.textColor = si.normal.textColor = XKCDColors.Red; } GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label26") + core.guidance.status, si);//Guidance Status: GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label27") + core.guidance.successful_converges, GUILayout.Width(100)); //converges: GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label28") + core.guidance.last_lm_status, GUILayout.Width(100)); //status: GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("n: " + core.guidance.last_lm_iteration_count + "(" + core.guidance.max_lm_iteration_count + ")", GUILayout.Width(100)); GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label29") + GuiUtils.TimeToDHMS(core.guidance.staleness));//staleness: GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(String.Format("znorm: {0:G5}", core.guidance.last_znorm)); GUILayout.EndHorizontal(); if (core.guidance.last_failure_cause != null) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.red; GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label30") + core.guidance.last_failure_cause, s);//LAST FAILURE: GUILayout.EndHorizontal(); } if (vessel.situation != Vessel.Situations.LANDED && vessel.situation != Vessel.Situations.PRELAUNCH && vessel.situation != Vessel.Situations.SPLASHED) { double m0 = atmoStats[vessel.currentStage].startMass; double thrust = atmoStats[vessel.currentStage].startThrust; if (Math.Abs(vesselState.mass - m0) / m0 > 0.01) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.yellow; GUILayout.BeginHorizontal(); GUILayout.Label(String.Format(Localizer.Format("#MechJeb_Ascent_label31") + "{0:F1}%", (vesselState.mass - m0) / m0 * 100.0), s);//MASS IS OFF BY GUILayout.EndHorizontal(); } if (Math.Abs(vesselState.thrustCurrent - thrust) / thrust > 0.01) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.yellow; GUILayout.BeginHorizontal(); GUILayout.Label(String.Format(Localizer.Format("#MechJeb_Ascent_label32") + "{0:F1}%", (vesselState.thrustCurrent - thrust) / thrust * 100.0), s);//THRUST IS OFF BY GUILayout.EndHorizontal(); } } } } if (vessel.LandedOrSplashed) { if (core.target.NormalTargetExists) { if (core.node.autowarp) { GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label33"), GUILayout.ExpandWidth(true)); //Launch countdown: autopilot.warpCountDown.text = GUILayout.TextField(autopilot.warpCountDown.text, GUILayout.Width(60)); GUILayout.Label("s", GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); } if (!launchingToPlane && !launchingToRendezvous && !launchingToInterplanetary) { // disable plane/rendezvous/interplanetary for now if (ascentPathIdx != ascentType.PVG) { GUILayout.BeginHorizontal(); if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button14"), GUILayout.ExpandWidth(false))) //Launch to rendezvous: { launchingToRendezvous = true; autopilot.StartCountdown(vesselState.time + LaunchTiming.TimeToPhaseAngle(autopilot.launchPhaseAngle, mainBody, vesselState.longitude, core.target.TargetOrbit)); } autopilot.launchPhaseAngle.text = GUILayout.TextField(autopilot.launchPhaseAngle.text, GUILayout.Width(60)); GUILayout.Label("º", GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button15"), GUILayout.ExpandWidth(false))) //Launch into plane of target { launchingToPlane = true; autopilot.StartCountdown(vesselState.time + LaunchTiming.TimeToPlane(autopilot.launchLANDifference, mainBody, vesselState.latitude, vesselState.longitude, core.target.TargetOrbit)); } autopilot.launchLANDifference.text = GUILayout.TextField( autopilot.launchLANDifference.text, GUILayout.Width(60)); GUILayout.Label("º", GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (core.target.TargetOrbit.referenceBody == orbit.referenceBody.referenceBody) { if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button16"))) //Launch at interplanetary window { launchingToInterplanetary = true; //compute the desired launch date OrbitalManeuverCalculator.DeltaVAndTimeForHohmannTransfer(mainBody.orbit, core.target.TargetOrbit, vesselState.time, out interplanetaryWindowUT); double desiredOrbitPeriod = 2 * Math.PI * Math.Sqrt( Math.Pow(mainBody.Radius + autopilot.desiredOrbitAltitude, 3) / mainBody.gravParameter); //launch just before the window, but don't try to launch in the past interplanetaryWindowUT -= 3 * desiredOrbitPeriod; interplanetaryWindowUT = Math.Max(vesselState.time + autopilot.warpCountDown, interplanetaryWindowUT); autopilot.StartCountdown(interplanetaryWindowUT); } } } } else { launchingToInterplanetary = launchingToPlane = launchingToRendezvous = false; GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label34")); //Select a target for a timed launch. } if (launchingToInterplanetary || launchingToPlane || launchingToRendezvous) { string message = ""; if (launchingToInterplanetary) { message = Localizer.Format("#MechJeb_Ascent_msg1"); //Launching at interplanetary window } else if (launchingToPlane) { desiredInclination = MuUtils.Clamp(core.target.TargetOrbit.inclination, Math.Abs(vesselState.latitude), 180 - Math.Abs(vesselState.latitude)); desiredInclination *= Math.Sign(Vector3d.Dot(core.target.TargetOrbit.SwappedOrbitNormal(), Vector3d.Cross(vesselState.CoM - mainBody.position, mainBody.transform.up))); message = Localizer.Format("#MechJeb_Ascent_msg2"); //Launching to target plane } else if (launchingToRendezvous) { message = "#MechJeb_Ascent_msg3"; //Launching to rendezvous } if (autopilot.tMinus > 3 * vesselState.deltaT) { message += ": T-" + GuiUtils.TimeToDHMS(autopilot.tMinus, 1); } GUILayout.Label(message); if (GUILayout.Button(Localizer.Format("#MechJeb_Ascent_button17")))//Abort { launchingToInterplanetary = launchingToPlane = launchingToRendezvous = autopilot.timedLaunch = false; } } } if (autopilot.enabled) { GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label35") + autopilot.status);//Autopilot status: } if (core.DeactivateControl) { GUIStyle s = new GUIStyle(GUI.skin.label); s.normal.textColor = Color.red; GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label36"), s);//CONTROL DISABLED (AVIONICS) } } if (!vessel.patchedConicsUnlocked() && ascentPathIdx != ascentType.PVG) { GUILayout.Label(Localizer.Format("#MechJeb_Ascent_label37"));//"Warning: MechJeb is unable to circularize without an upgraded Tracking Station." } GUILayout.BeginHorizontal(); autopilot.ascentPathIdxPublic = (ascentType)GuiUtils.ComboBox.Box((int)autopilot.ascentPathIdxPublic, autopilot.ascentPathList, this); GUILayout.EndHorizontal(); if (autopilot.ascentMenu != null) { autopilot.ascentMenu.enabled = GUILayout.Toggle(autopilot.ascentMenu.enabled, Localizer.Format("#MechJeb_Ascent_checkbox10")); //Edit ascent path } GUILayout.EndVertical(); base.WindowGUI(windowID); }