diff --git a/Assets/Plugins/KerbalEngineer.Unity.dll b/Assets/Plugins/KerbalEngineer.Unity.dll
index 064741e1..5c7bb91d 100644
Binary files a/Assets/Plugins/KerbalEngineer.Unity.dll and b/Assets/Plugins/KerbalEngineer.Unity.dll differ
diff --git a/Documents/Alternate HUD - 1440p 1.5 UI Scale - GuiDisplaySize.xml b/Documents/Alternate HUD - 1440p 1.5 UI Scale - GuiDisplaySize.xml
new file mode 100644
index 00000000..3b288f47
--- /dev/null
+++ b/Documents/Alternate HUD - 1440p 1.5 UI Scale - GuiDisplaySize.xml
@@ -0,0 +1,11 @@
+
+
+
+ multiplier
+ 1.1
+
+
+ increment
+ 2
+
+
\ No newline at end of file
diff --git a/Documents/Alternate HUD - 1440p 1.5 UI Scale - ReadoutsConfig.xml b/Documents/Alternate HUD - 1440p 1.5 UI Scale - ReadoutsConfig.xml
new file mode 100644
index 00000000..4bd5b7b4
--- /dev/null
+++ b/Documents/Alternate HUD - 1440p 1.5 UI Scale - ReadoutsConfig.xml
@@ -0,0 +1,528 @@
+
+
+
+ Biome
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 28
+ 17
+ -90
+ -90
+ false
+ true
+ false
+ true
+
+
+
+ Situation
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 17
+ -90
+ -90
+ false
+ true
+ false
+ true
+
+
+
+ Critical Part
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 26
+ 26
+ -90
+ -90
+ false
+ false
+ false
+ true
+
+
+
+ Atmos. Efficiency
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Angle-of-Attack
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Heading
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ DeltaV (Current/Total)
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 23
+ 23
+ -9000
+ -9000
+ false
+ false
+ true
+ true
+
+
+
+ Electric Charge
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Critical Thermal Percentage
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Mach Number
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Horizontal Speed
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Vertical Speed
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Vertical Acceleration
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Altitude (Terrain)
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -1
+ 0
+ false
+ false
+ false
+ true
+
+
+
+ Altitude (Sea Level)
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -90
+ 0
+ false
+ false
+ false
+ true
+
+
+
+ LF:Ox Ratio
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Apoapsis Height
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -1
+ 0
+ false
+ false
+ false
+ true
+
+
+
+ Periapsis Height
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -90
+ 0
+ false
+ false
+ false
+ true
+
+
+
+ Time to Apoapsis
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Time to Periapsis
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -9000
+ -9000
+ false
+ false
+ false
+ true
+
+
+
+ Suicide Burn Countdown
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+
+ 0.7176471
+ 0.996078432
+ 0
+ 1
+
+ 20
+ 20
+ -90
+ -90
+ false
+ false
+ false
+ true
+
+
+
\ No newline at end of file
diff --git a/Documents/Alternate HUD - 1440p 1.5 UI Scale - SectionLibrary.xml b/Documents/Alternate HUD - 1440p 1.5 UI Scale - SectionLibrary.xml
new file mode 100644
index 00000000..e25cb434
--- /dev/null
+++ b/Documents/Alternate HUD - 1440p 1.5 UI Scale - SectionLibrary.xml
@@ -0,0 +1,588 @@
+
+
+
+ StockSections
+
+
+ true
+ ORBT
+ 1030
+ 470
+ 1155
+ 100
+ true
+ true
+ false
+ false
+ false
+ false
+ false
+ false
+ 0
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.5
+
+ false
+ ORBITAL
+
+ Orbital.ApoapsisHeight
+ Orbital.TimeToApoapsis
+ Miscellaneous.Separator
+ Orbital.PeriapsisHeight
+ Orbital.TimeToPeriapsis
+ Miscellaneous.Separator
+ Orbital.Eccentricity
+ Orbital.Inclination
+ Orbital.OrbitalPeriod
+ Orbital.SemiMajorAxis
+
+
+
+ true
+ SURF
+ 1030
+ 470
+ 1155
+ 100
+ true
+ true
+ false
+ false
+ false
+ false
+ false
+ false
+ 6
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.5
+
+ false
+ SURFACE
+
+ Surface.AltitudeSeaLevel
+ Surface.AltitudeTerrain
+ Surface.Biome
+ Miscellaneous.Separator
+ Surface.VerticalSpeed
+ Surface.HorizontalSpeed
+ Miscellaneous.Separator
+ Surface.Slope
+
+
+
+ true
+ VESL
+ 1030
+ 470
+ 1155
+ 100
+ true
+ true
+ false
+ false
+ false
+ false
+ false
+ false
+ 12
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.5
+
+ false
+ VESSEL
+
+ Vessel.Name
+ Vessel.Mass
+ Vessel.Gravity
+ Miscellaneous.Separator
+ Vessel.DeltaVStaged
+ Vessel.DeltaVTotal
+ Miscellaneous.Separator
+ Vessel.ThrustToWeight
+ Vessel.Acceleration
+ Miscellaneous.Separator
+ Vessel.RCSDeltaV
+ Vessel.RCSTWR
+ Miscellaneous.Separator
+ Vessel.Heading
+ Vessel.Pitch
+ Vessel.Roll
+
+
+
+ true
+ RDZV
+ 1030
+ 470
+ 660
+ 161
+ true
+ true
+ false
+ true
+ true
+ false
+ true
+ false
+ 12
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.5
+
+ false
+ RENDEZVOUS
+
+ Rendezvous.TargetSelector
+ Rendezvous.PhaseAngle
+ Rendezvous.InterceptAngle
+ Rendezvous.TimeToTransferAngleTime
+ Rendezvous.Distance
+ Miscellaneous.Separator
+ Rendezvous.TimeToRelativeAscendingNode
+ Rendezvous.TimeToRelativeDescendingNode
+ Rendezvous.RelativeInclination
+ Miscellaneous.Separator
+ Rendezvous.ApoapsisHeight
+ Rendezvous.PeriapsisHeight
+ Rendezvous.OrbitalPeriod
+ Rendezvous.SemiMajorAxis
+
+
+
+ true
+ HEAT
+ 1002
+ 228
+ 1078
+ 176
+ true
+ true
+ false
+ false
+ false
+ false
+ false
+ true
+ 13
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.5
+
+ false
+ THERMAL
+
+ Thermal.InternalFlux
+ Thermal.ConvectionFlux
+ Thermal.RadiationFlux
+ Thermal.CriticalPart
+ Thermal.CriticalTemperature
+ Thermal.CriticalSkinTemperature
+ Thermal.CriticalThermalPercentage
+ Thermal.HottestPart
+ Thermal.HottestTemperature
+ Thermal.HottestSkinTemperature
+ Thermal.CoolestPart
+ Thermal.CoolestTemperature
+ Thermal.CoolestSkinTemperature
+
+
+
+ true
+ BODY
+ 1030
+ 470
+ 1155
+ 100
+ true
+ true
+ false
+ false
+ false
+ false
+ false
+ true
+ 10
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.5
+
+ false
+ BODY
+
+ Body.MinOrbitHeight
+ Body.HighAtmosphereHeight
+ Body.LowSpaceHeight
+ Body.HighSpaceHeight
+ Body.GeostationaryHeight
+ Body.CurrentSoi
+ Body.BodyRotationPeriod
+ Body.BodyOrbitalPeriod
+ Body.EscapeVelocity
+ Body.BodyGravity
+
+
+
+ true
+ BURN
+ 1030
+ 470
+ 1155
+ 100
+ true
+ true
+ false
+ false
+ false
+ false
+ false
+ false
+ 0
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.5
+
+ false
+ MANEUVER
+
+ Orbital.NodeProgradeDeltaV
+ Orbital.NodeNormalDeltaV
+ Orbital.NodeRadialDeltaV
+ Orbital.NodeTotalDeltaV
+ Miscellaneous.Separator
+ Orbital.NodeBurnTime
+ Orbital.NodeTimeToHalfBurn
+ Miscellaneous.Separator
+ Orbital.PostBurnApoapsis
+ Orbital.PostBurnPeriapsis
+ Orbital.PostBurnInclination
+ Orbital.PostBurnRealtiveInclination
+ Orbital.PostBurnPeriod
+ Orbital.PostBurnEccentricity
+
+
+
+ true
+ LAND
+ 1030
+ 470
+ 371
+ 161
+ true
+ true
+ false
+ true
+ true
+ false
+ true
+ false
+ 10
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.5
+
+ false
+ LANDING
+
+ Surface.ImpactAltitude
+ Surface.ImpactTime
+ Surface.ImpactLatitude
+ Surface.ImpactLongitude
+ Surface.ImpactBiome
+ Surface.ImpactMarker
+ Miscellaneous.Separator
+ Vessel.SuicideBurnAltitude
+ Vessel.SuicideBurnDeltaV
+ Vessel.SuicideBurnLength
+ Vessel.SuicideBurnCountdown
+
+
+
+ true
+ HUD 1_
+ 1033
+ 470
+ 664
+ 4
+ true
+ true
+ false
+ true
+ true
+ false
+ true
+ false
+ 8
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.5
+
+ false
+ HUD 1_
+
+ Orbital.ApoapsisHeight
+ Orbital.TimeToApoapsis
+ Miscellaneous.ClearSeparator
+ Orbital.PeriapsisHeight
+ Orbital.TimeToPeriapsis
+ Miscellaneous.ClearSeparator
+ Vessel.DeltaVCurrentTotal
+ Vessel.ElectricCharge
+ Miscellaneous.ClearSeparator
+ Thermal.CriticalPart
+ Thermal.CriticalThermalPercentage
+
+
+
+ true
+ HUD 2_
+ 1036
+ 473
+ 1484
+ 4
+ true
+ true
+ false
+ true
+ true
+ false
+ true
+ true
+ 7
+ 230
+ 128
+
+ 0
+ 0
+ 0
+ 0.42
+
+ false
+ HUD 2_
+
+ Surface.MachNumber
+ Surface.Slope
+ Surface.HorizontalSpeed
+ Miscellaneous.ClearSeparator
+ Surface.VerticalSpeed
+ Surface.VerticalAcceleration
+ Miscellaneous.ClearSeparator
+ Surface.AltitudeTerrain
+ Surface.AltitudeSeaLevel
+
+
+
+
+
+ CustomSections
+
+
+ true
+ HUD 3
+ 586
+ 459
+ 1648
+ 4
+ true
+ true
+ false
+ true
+ true
+ false
+ true
+ true
+ 7
+ 230
+ 105
+
+ 0
+ 0
+ 0
+ 0.42
+
+ false
+ HUD 3
+
+ Surface.Biome
+ Surface.Situation
+ Miscellaneous.ClearSeparator
+ Surface.AtmosphericEfficiency
+ Miscellaneous.ClearSeparator
+ Vessel.AngleOfAttack
+ Vessel.Pitch
+ Vessel.Roll
+ Vessel.Heading
+
+
+
+ true
+ HUD NAV
+ 955
+ 371
+ 1054
+ 1038
+ true
+ true
+ false
+ true
+ true
+ false
+ true
+ true
+ 3
+ 230
+ 96
+
+ 0
+ 0
+ 0
+ 0.27
+
+ false
+ HUD Navball
+
+ Vessel.Heading
+ Vessel.AngleOfAttack
+ Surface.AltitudeTerrain
+
+
+
+ true
+ HUD LL
+ 1030
+ 470
+ 676
+ 75
+ true
+ true
+ false
+ true
+ true
+ false
+ true
+ true
+ 4
+ 230
+ 95
+
+ 0
+ 0
+ 0
+ 0.42
+
+ false
+ HUD Left-Left
+
+ Orbital.ApoapsisHeight
+ Orbital.TimeToApoapsis
+ Miscellaneous.ClearSeparator
+ Orbital.PeriapsisHeight
+ Orbital.TimeToPeriapsis
+
+
+
+ true
+ HUD LR
+ 626
+ 387
+ 800
+ 75
+ true
+ true
+ false
+ true
+ true
+ false
+ true
+ true
+ 2
+ 230
+ 127
+
+ 0
+ 0
+ 0
+ 0.42
+
+ false
+ HUD Left-Right
+
+ Vessel.ElectricCharge
+ Thermal.CriticalThermalPercentage
+ Vessel.SuicideBurnCountdown
+
+
+
+ true
+ HUD LT
+ 1030
+ 470
+ 676
+ 4
+ true
+ true
+ false
+ true
+ true
+ false
+ true
+ true
+ 3
+ 230
+ 230
+
+ 0
+ 0
+ 0
+ 0.42
+
+ false
+ HUD Left-Top
+
+ Vessel.DeltaVCurrentTotal
+ Vessel.LfOxRatio
+ Miscellaneous.ClearSeparator
+ Thermal.CriticalPart
+
+
+
+
+
\ No newline at end of file
diff --git a/Documents/CHANGES.txt b/Documents/CHANGES.txt
index 578bce63..09bf70ec 100644
--- a/Documents/CHANGES.txt
+++ b/Documents/CHANGES.txt
@@ -1,3 +1,18 @@
+1.1.9.3, 2024-5-30, KSP 1.12.5
+ - Added hotkeys for toggling visibility of groups of HUD sections. Edit /GameData/KerbalEngineer/Settings/SectionLibrary.xml to change which HudGroup each section is in.
+ - Added glideslope readout
+ - LF:Ox ratio readout now displays how much excess LF you have
+ - Fixed pitch/yaw/roll rate readouts not taking delta-time into account and not using the decimal-place override
+
+1.1.9.2, 2024-5-23, KSP 1.12.5
+ - Fixed editor backgrounds disappearing after leaving and re-entering editor mode, editor resources window staying visible during the loading screen, and editor part overlay not resizing
+ - Editor overlay keyprompt now shows MouseMiddle instead of Mouse2
+
+1.1.9.1, 2024-5-22, KSP 1.12.5
+ - More-adjustable UI: section width and background color; readout character limit, decimal places, and short/no name
+ - More readouts: Angle-of-attack/sideslip/displacement, bearing and distance to targets and waypoints, electric charge, LF:Ox ratio
+ - Fixed windows staying visible during scene changes
+
1.1.9.0, 2021-6-27, KSP 1.12.0 #3140
- Fix backwards compatibility
diff --git a/KerbalEngineer.Unity/Flight/ISectionModule.cs b/KerbalEngineer.Unity/Flight/ISectionModule.cs
index f83875ed..3cc872d4 100644
--- a/KerbalEngineer.Unity/Flight/ISectionModule.cs
+++ b/KerbalEngineer.Unity/Flight/ISectionModule.cs
@@ -18,6 +18,13 @@
namespace KerbalEngineer.Unity.Flight
{
+ using UnityEngine;
+
+ public struct OOPSux {
+ public const float DEFAULT_SECTION_WIDTH = 230.0f;
+ public static Color DEFAULT_HUD_BACKGROUND_COLOR = new Color(0.0f, 0.0f, 0.0f, 0.5f);
+ }
+
public interface ISectionModule
{
bool IsDeleted { get; }
@@ -25,9 +32,19 @@ public interface ISectionModule
bool IsEditorVisible { get; set; }
bool IsVisible { get; set; }
+ bool IsHudVisible { get; set; }
bool IsHud { get; set; }
+
+ float Width { get; set; }
+ float HudWidth { get; set; }
+
+ Color HudBackgroundColor { get; set; }
+
+ bool HideHudReadoutNames { get; set; }
string Name { get; }
+
+ int HudGroup { get; set; }
}
}
\ No newline at end of file
diff --git a/KerbalEngineer.Unity/KerbalEngineer.Unity.csproj b/KerbalEngineer.Unity/KerbalEngineer.Unity.csproj
index ad618cda..d433e292 100644
--- a/KerbalEngineer.Unity/KerbalEngineer.Unity.csproj
+++ b/KerbalEngineer.Unity/KerbalEngineer.Unity.csproj
@@ -9,8 +9,9 @@
Properties
KerbalEngineer.Unity
KerbalEngineer.Unity
- v3.5
+ v4.8
512
+
false
@@ -20,6 +21,7 @@
DEBUG;TRACE
prompt
4
+ false
none
@@ -29,6 +31,7 @@
prompt
4
+ false
@@ -44,16 +47,32 @@
+
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\Assembly-CSharp.dll
+ False
+
..\..\game\KSP_Data\Managed\System.dll
False
- ..\..\..\KSP-Environment\KSP_x64_Data\Managed\UnityEngine.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.dll
+ False
+
+
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.CoreModule.dll
+ False
+
+
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.TextRenderingModule.dll
False
- ..\..\..\KSP-Environment\KSP_x64_Data\Managed\UnityEngine.UI.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.UI.dll
+ False
+
+
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.UIModule.dll
False
diff --git a/KerbalEngineer/Editor/BuildAdvanced.cs b/KerbalEngineer/Editor/BuildAdvanced.cs
index 9783cf66..f1a65a6e 100644
--- a/KerbalEngineer/Editor/BuildAdvanced.cs
+++ b/KerbalEngineer/Editor/BuildAdvanced.cs
@@ -387,7 +387,7 @@ private void DrawBody(CelestialBodies.BodyInfo bodyInfo, int depth = 0)
{
CelestialBodies.SetSelectedBody(bodyInfo.Name);
Altitude = 0.0f;
- bodiesList.Resize = true;
+ bodiesList.ResizeCounter = 1;
}
GUILayout.EndHorizontal();
diff --git a/KerbalEngineer/Editor/BuildOverlay.cs b/KerbalEngineer/Editor/BuildOverlay.cs
index ce0d2377..37995725 100644
--- a/KerbalEngineer/Editor/BuildOverlay.cs
+++ b/KerbalEngineer/Editor/BuildOverlay.cs
@@ -81,7 +81,7 @@ public static GUIStyle NameStyle
{
get
{
- return (nameStyle !=null && !hasChanged) ? nameStyle : (nameStyle = new GUIStyle
+ return (nameStyle != null && !hasChanged) ? nameStyle : (nameStyle = new GUIStyle
{
normal =
{
@@ -105,7 +105,7 @@ public static GUIStyle TabStyle
{
get
{
- return (tabStyle !=null & !hasChanged) ? tabStyle : (tabStyle = new GUIStyle
+ return (tabStyle != null && !hasChanged) ? tabStyle : (tabStyle = new GUIStyle
{
normal =
{
@@ -154,17 +154,20 @@ public static GUIStyle TitleStyle
}
}
- private static bool hasChanged;
+ private static bool hasChanged = false, resetHasChanged = false;
protected void OnGUI() {
- // hasChanged = false;
+ if (hasChanged && Event.current.type == EventType.Repaint) {
+ if (resetHasChanged) hasChanged = resetHasChanged = false;
+ else resetHasChanged = true;
+ }
}
public static GUIStyle ValueStyle
{
get
{
- return (valueStyle !=null && !hasChanged) ? valueStyle : (valueStyle = new GUIStyle
+ return (valueStyle != null && !hasChanged) ? valueStyle : (valueStyle = new GUIStyle
{
normal =
{
@@ -188,7 +191,7 @@ public static GUIStyle WindowStyle
{
get
{
- return windowStyle ?? (windowStyle = new GUIStyle
+ return (windowStyle != null && !hasChanged) ? windowStyle : (windowStyle = new GUIStyle
{
normal =
{
@@ -237,6 +240,7 @@ protected void Awake()
return;
}
instance = this;
+ tabStyle = windowStyle = null; //The background textures need to be reinitialized each scene change
buildOverlayPartInfo = this.gameObject.AddComponent();
buildOverlayVessel = this.gameObject.AddComponent();
buildOverlayResources = this.gameObject.AddComponent();
diff --git a/KerbalEngineer/Editor/BuildOverlayPartInfo.cs b/KerbalEngineer/Editor/BuildOverlayPartInfo.cs
index c5172374..d793945d 100644
--- a/KerbalEngineer/Editor/BuildOverlayPartInfo.cs
+++ b/KerbalEngineer/Editor/BuildOverlayPartInfo.cs
@@ -39,7 +39,7 @@ public class BuildOverlayPartInfo : MonoBehaviour
private Rect position;
private Part selectedPart;
private bool showInfo;
- private bool skipFrame;
+ private bool skipFrame, resizeWindowNextFrame = false;
private PointerHoverDetector stageUiPointerHoverDetector;
public static bool ClickToOpen
@@ -145,9 +145,15 @@ protected void Update()
if (NamesOnly || skipFrame)
{
skipFrame = false;
+ resizeWindowNextFrame = true;
return;
}
+ if (resizeWindowNextFrame) {
+ position.height = 0.0f;
+ resizeWindowNextFrame = false;
+ }
+
if (!showInfo && Input.GetKeyDown(KeyBinder.PartInfoShowHide))
{
showInfo = true;
@@ -486,7 +492,7 @@ private void Window(int windowId)
else if (clickToOpen && namesOnly == false)
{
GUILayout.Space(2.0f);
- GUILayout.Label("Click [" + KeyBinder.PartInfoShowHide + "] to show more info...", BuildOverlay.NameStyle);
+ GUILayout.Label("Click [" + ToString(KeyBinder.PartInfoShowHide) + "] to show more info...", BuildOverlay.NameStyle);
}
}
catch (Exception ex)
@@ -494,5 +500,19 @@ private void Window(int windowId)
MyLogger.Exception(ex);
}
}
+
+ private string ToString(KeyCode keyCode) {
+ switch (keyCode) {
+ case KeyCode.Mouse0: return "Left Mouse";
+ case KeyCode.Mouse1: return "Right Mouse";
+ case KeyCode.Mouse2: return "Middle Mouse";
+ case KeyCode.Mouse3: return "Mouse Button 4";
+ case KeyCode.Mouse4: return "Mouse Button 5";
+ case KeyCode.Mouse5: return "Mouse Button 6";
+ case KeyCode.Mouse6: return "Mouse Button 7";
+ }
+
+ return keyCode.ToString();
+ }
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Editor/BuildOverlayResources.cs b/KerbalEngineer/Editor/BuildOverlayResources.cs
index d266b402..8dc2feb8 100644
--- a/KerbalEngineer/Editor/BuildOverlayResources.cs
+++ b/KerbalEngineer/Editor/BuildOverlayResources.cs
@@ -36,7 +36,7 @@ public class BuildOverlayResources : MonoBehaviour
private readonly Dictionary resources = new Dictionary();
private bool open = true;
- private float openPercent;
+ private float openPercent = 0.0f;
private GUIContent tabContent;
private Rect tabPosition;
private Vector2 tabSize;
@@ -74,7 +74,7 @@ protected void OnGUI()
{
try
{
- if (!Visible || resources.Count == 0)
+ if (!Visible || resources.Count == 0 || EditorLogic.RootPart == null)
{
return;
}
diff --git a/KerbalEngineer/Editor/BuildOverlayVessel.cs b/KerbalEngineer/Editor/BuildOverlayVessel.cs
index b149bd98..1770fe81 100644
--- a/KerbalEngineer/Editor/BuildOverlayVessel.cs
+++ b/KerbalEngineer/Editor/BuildOverlayVessel.cs
@@ -49,7 +49,7 @@ public class BuildOverlayVessel : MonoBehaviour
private Stage lastStage;
private bool open = true;
- private float openPercent;
+ private float openPercent = 0.0f;
private GUIContent tabContent;
private Rect tabPosition;
private Vector2 tabSize;
diff --git a/KerbalEngineer/EngineerGlobals.cs b/KerbalEngineer/EngineerGlobals.cs
index 6da31518..8a601b29 100644
--- a/KerbalEngineer/EngineerGlobals.cs
+++ b/KerbalEngineer/EngineerGlobals.cs
@@ -21,7 +21,7 @@ public static class EngineerGlobals
///
/// Current version of the Kerbal Engineer assembly.
///
- public const string ASSEMBLY_VERSION = "1.1.9.0";
+ public const string ASSEMBLY_VERSION = "1.1.9.3";
private static string assemblyFile;
private static string assemblyName;
diff --git a/KerbalEngineer/Extensions/DoubleExtensions.cs b/KerbalEngineer/Extensions/DoubleExtensions.cs
index f83c09c6..65b61f6f 100644
--- a/KerbalEngineer/Extensions/DoubleExtensions.cs
+++ b/KerbalEngineer/Extensions/DoubleExtensions.cs
@@ -29,67 +29,67 @@ public static bool IsValid(this double value)
return double.IsNaN(value) == false && double.IsInfinity(value) == false;
}
- public static string ToAcceleration(this double value)
+ public static string ToAcceleration(this double value, int decimals = -9000)
{
- return Units.ToAcceleration(value);
+ return Units.ToAcceleration(value, decimals);
}
- public static string ToAngle(this double value)
+ public static string ToAngle(this double value, int decimals = -9000)
{
- return Units.ToAngle(value);
+ return Units.ToAngle(value, decimals);
}
- public static string ToDistance(this double value)
+ public static string ToDistance(this double value, int decimals = -9000)
{
- return Units.ToDistance(value);
+ return Units.ToDistance(value, decimals);
}
- public static string ToFlux(this double value)
+ public static string ToFlux(this double value, int decimals = -9000)
{
return Units.ToFlux(value);
}
- public static string ToForce(this double value)
+ public static string ToForce(this double value, int decimals = -9000)
{
return Units.ToForce(value);
}
- public static string ToMach(this double value)
+ public static string ToMach(this double value, int decimals = -9000)
{
return Units.ToMach(value);
}
- public static string ToMass(this double value)
+ public static string ToMass(this double value, int decimals = -9000)
{
- return Units.ToMass(value);
+ return Units.ToMass(value, decimals);
}
- public static string ToPercent(this double value)
+ public static string ToPercent(this double value, int decimals = -9000)
{
- return Units.ToPercent(value);
+ return Units.ToPercent(value, decimals);
}
- public static string ToPressure(this double value)
+ public static string ToPressure(this double value, int decimals = -9000)
{
return Units.ToPressure(value);
}
- public static string ToRate(this double value)
+ public static string ToRate(this double value, int decimals = -9000)
{
- return Units.ToRate(value);
+ return Units.ToRate(value, decimals);
}
- public static string ToSpeed(this double value)
+ public static string ToSpeed(this double value, int decimals = -9000)
{
- return Units.ToSpeed(value);
+ return Units.ToSpeed(value, decimals);
}
- public static string ToTemperature(this double value)
+ public static string ToTemperature(this double value, int decimals = -9000)
{
return Units.ToTemperature(value);
}
- public static string ToTorque(this double value)
+ public static string ToTorque(this double value, int decimals = -9000)
{
return Units.ToTorque(value);
}
diff --git a/KerbalEngineer/Extensions/FloatExtensions.cs b/KerbalEngineer/Extensions/FloatExtensions.cs
index 42da0f24..d09b16a4 100644
--- a/KerbalEngineer/Extensions/FloatExtensions.cs
+++ b/KerbalEngineer/Extensions/FloatExtensions.cs
@@ -23,62 +23,62 @@ namespace KerbalEngineer.Extensions
public static class FloatExtensions
{
- public static string ToAcceleration(this float value)
+ public static string ToAcceleration(this float value, int decimals = -9000)
{
- return Units.ToAcceleration(value);
+ return Units.ToAcceleration(value, decimals);
}
- public static string ToAngle(this float value)
+ public static string ToAngle(this float value, int decimals = -9000)
{
- return Units.ToAngle(value);
+ return Units.ToAngle(value, decimals);
}
- public static string ToDistance(this float value)
+ public static string ToDistance(this float value, int decimals = -9000)
{
- return Units.ToDistance(value);
+ return Units.ToDistance(value, decimals);
}
- public static string ToFlux(this float value)
+ public static string ToFlux(this float value, int decimals = -9000)
{
return Units.ToFlux(value);
}
- public static string ToForce(this float value)
+ public static string ToForce(this float value, int decimals = -9000)
{
return Units.ToForce(value);
}
- public static string ToMach(this float value)
+ public static string ToMach(this float value, int decimals = -9000)
{
return Units.ToMach(value);
}
- public static string ToMass(this float value)
+ public static string ToMass(this float value, int decimals = -9000)
{
- return Units.ToMass(value);
+ return Units.ToMass(value, decimals);
}
- public static string ToPercent(this float value)
+ public static string ToPercent(this float value, int decimals = -9000)
{
- return Units.ToPercent(value);
+ return Units.ToPercent(value, decimals);
}
- public static string ToRate(this float value)
+ public static string ToRate(this float value, int decimals = -9000)
{
- return Units.ToRate(value);
+ return Units.ToRate(value, decimals);
}
- public static string ToSpeed(this float value)
+ public static string ToSpeed(this float value, int decimals = -9000)
{
- return Units.ToSpeed(value);
+ return Units.ToSpeed(value, decimals);
}
- public static string ToTemperature(this float value)
+ public static string ToTemperature(this float value, int decimals = -9000)
{
return Units.ToTemperature(value);
}
- public static string ToTorque(this float value)
+ public static string ToTorque(this float value, int decimals = -9000)
{
return Units.ToTorque(value);
}
diff --git a/KerbalEngineer/Extensions/PartExtensions.cs b/KerbalEngineer/Extensions/PartExtensions.cs
index ad5de690..897d8e51 100644
--- a/KerbalEngineer/Extensions/PartExtensions.cs
+++ b/KerbalEngineer/Extensions/PartExtensions.cs
@@ -684,8 +684,8 @@ private void SetModuleEngines()
return;
}
- MaximumThrust = engine.maxThrust * (engine.thrustPercentage * 0.01);
- MinimumThrust = engine.minThrust;
+ MaximumThrust = engine.MaxThrustOutputVac();
+ MinimumThrust = engine.MaxThrustOutputAtm();
Propellants = engine.propellants;
}
}
diff --git a/KerbalEngineer/Flight/DisplayStack.cs b/KerbalEngineer/Flight/DisplayStack.cs
index 59a3aedf..bd460778 100644
--- a/KerbalEngineer/Flight/DisplayStack.cs
+++ b/KerbalEngineer/Flight/DisplayStack.cs
@@ -34,6 +34,7 @@
namespace KerbalEngineer.Flight
{
using KeyBinding;
+ using UnityEngine.UI;
using Upgradeables;
///
@@ -44,14 +45,14 @@ public class DisplayStack : MonoBehaviour
{
#region Fields
- private GUIStyle buttonStyle;
- private int numberOfStackSections;
- private bool resizeRequested;
- private bool showControlBar = true;
- private GUIStyle titleStyle;
- private int windowId;
- private Rect windowPosition;
- private GUIStyle windowStyle;
+ protected GUIStyle buttonStyle;
+ protected int numberOfStackSections;
+ protected bool resizeRequested;
+ protected bool showControlBar = true;
+ protected GUIStyle titleStyle;
+ protected int windowId;
+ protected Rect windowPosition;
+ protected GUIStyle windowStyle;
#endregion
@@ -99,7 +100,7 @@ public void RequestResize()
///
/// Sets the instance to this object.
///
- protected void Awake()
+ protected virtual void Awake()
{
try
{
@@ -107,7 +108,7 @@ protected void Awake()
{
Instance = this;
GuiDisplaySize.OnSizeChanged += this.OnSizeChanged;
- MyLogger.Log("ActionMenu->Awake");
+ //MyLogger.Log("[KerbalEngineer]: DisplayStack->Awake");
}
else
{
@@ -133,20 +134,20 @@ protected void OnDestroy()
{
MyLogger.Exception(ex);
}
- MyLogger.Log("ActionMenu->OnDestroy");
+ //MyLogger.Log("[KerbalEngineer]: DisplayStack->OnDestroy");
}
///
/// Initialises the object's state on creation.
///
- protected void Start()
+ protected virtual void Start()
{
try
{
this.windowId = this.GetHashCode();
this.InitialiseStyles();
this.Load();
- MyLogger.Log("ActionMenu->Start");
+ //MyLogger.Log("[KerbalEngineer]: DisplayStack->Start");
}
catch (Exception ex)
{
@@ -154,7 +155,7 @@ protected void Start()
}
}
- protected void Update()
+ protected virtual void Update()
{
try
{
@@ -162,114 +163,100 @@ protected void Update()
{
return;
}
-
- if (Input.GetKeyDown(KeyBinder.FlightShowHide))
- {
- this.Hidden = !this.Hidden;
- }
+
+ if (Input.GetKeyDown(KeyBinder.FlightShowHide)) this.Hidden = !this.Hidden;
+ if (Input.GetKeyDown(KeyBinder.HudGroup1ShowHide)) ToggleHudGroup(1);
+ if (Input.GetKeyDown(KeyBinder.HudGroup2ShowHide)) ToggleHudGroup(2);
+ if (Input.GetKeyDown(KeyBinder.HudGroup3ShowHide)) ToggleHudGroup(3);
+ if (Input.GetKeyDown(KeyBinder.HudGroup4ShowHide)) ToggleHudGroup(4);
}
catch (Exception ex)
{
MyLogger.Exception(ex);
}
}
-
- #endregion
-
- #region Methods: private
-
+
///
- /// Called to draw the display stack when the UI is enabled.
+ /// Load the stack's state.
///
- private void OnGUI()
+ protected virtual void Load()
{
try
{
- if (!FlightEngineerCore.IsDisplayable)
- {
- return;
- }
-
- if (this.resizeRequested || this.numberOfStackSections != SectionLibrary.NumberOfStackSections)
- {
- this.numberOfStackSections = SectionLibrary.NumberOfStackSections;
- this.windowPosition.width = 0;
- this.windowPosition.height = 0;
- this.resizeRequested = false;
- }
-
- if (!this.Hidden && (SectionLibrary.NumberOfStackSections > 0 || this.ShowControlBar))
- {
- var shouldCentre = this.windowPosition.min == Vector2.zero;
- GUI.skin = null;
- this.windowPosition = GUILayout.Window(this.windowId, this.windowPosition, this.Window, string.Empty, this.windowStyle).ClampToScreen();
- if (shouldCentre)
- {
- this.windowPosition.center = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f);
- }
- }
+ var handler = SettingHandler.Load("DisplayStack.xml");
+ this.Hidden = handler.Get("hidden", this.Hidden);
+ this.ShowControlBar = handler.Get("showControlBar", this.ShowControlBar);
+ this.windowPosition.x = handler.Get("windowPositionX", this.windowPosition.x);
+ this.windowPosition.y = handler.Get("windowPositionY", this.windowPosition.y);
}
catch (Exception ex)
{
- MyLogger.Exception(ex);
+ MyLogger.Exception(ex, "DisplayStack->Load");
}
}
///
- /// Draws the control bar.
+ /// Saves the stack's state.
///
- private void DrawControlBar()
+ protected virtual void Save()
{
- GUILayout.Label("FLIGHT ENGINEER " + EngineerGlobals.ASSEMBLY_VERSION, this.titleStyle);
- var list = new List();
- list.AddRange(SectionLibrary.StockSections);
- list.AddRange(SectionLibrary.CustomSections);
- this.DrawControlBarButtons(list);
+ try
+ {
+ var handler = new SettingHandler();
+ handler.Set("hidden", this.Hidden);
+ handler.Set("showControlBar", this.ShowControlBar);
+ handler.Set("windowPositionX", this.windowPosition.x);
+ handler.Set("windowPositionY", this.windowPosition.y);
+ handler.Save("DisplayStack.xml");
+ }
+ catch (Exception ex)
+ {
+ MyLogger.Exception(ex, "DisplayStack->Save");
+ }
}
///
- /// Draws a button list for a set of sections.
+ /// Draws the display stack window.
///
- private void DrawControlBarButtons(IEnumerable sections)
+ protected virtual void Window(int windowId)
{
- var index = 0;
- foreach (var section in sections.Where(s => s.showButton))
+ try
{
- if (index % 4 == 0)
+ if (this.ShowControlBar)
{
- if (index > 0)
- {
- GUILayout.EndHorizontal();
- }
- GUILayout.BeginHorizontal();
+ this.DrawControlBar();
}
- section.IsVisible = GUILayout.Toggle(section.IsVisible, section.Abbreviation.ToUpper(), this.buttonStyle);
- index++;
+
+ if (SectionLibrary.NumberOfStackSections > 0)
+ {
+ this.DrawSections(SectionLibrary.StockSections);
+ this.DrawSections(SectionLibrary.CustomSections);
+ }
+
+ GUI.DragWindow();
}
- if (index > 0)
+ catch (Exception ex)
{
- GUILayout.EndHorizontal();
+ MyLogger.Exception(ex, "DisplayStack->Window");
}
}
-
+
///
- /// Draws a list of sections.
+ /// Draws the control bar.
///
- private void DrawSections(IEnumerable sections)
+ protected virtual void DrawControlBar()
{
- foreach (var section in sections)
- {
- if (!section.IsFloating)
- {
- section.Draw();
- }
- }
+ GUILayout.Label("FLIGHT ENGINEER " + EngineerGlobals.ASSEMBLY_VERSION, this.titleStyle);
+ var list = new List();
+ list.AddRange(SectionLibrary.StockSections);
+ list.AddRange(SectionLibrary.CustomSections);
+ this.DrawControlBarButtons(list);
}
-
+
///
/// Initialises all the styles required for this object.
///
- private void InitialiseStyles()
+ protected void InitialiseStyles()
{
this.windowStyle = new GUIStyle(HighLogic.Skin.window)
{
@@ -302,75 +289,109 @@ private void InitialiseStyles()
fixedHeight = 25.0f * GuiDisplaySize.Offset,
};
}
+
+ protected void OnSizeChanged()
+ {
+ this.InitialiseStyles();
+ this.RequestResize();
+ }
+
+ #endregion
+
+ #region Methods: private
///
- /// Load the stack's state.
+ /// Called to draw the display stack when the UI is enabled.
///
- private void Load()
+ protected virtual void OnGUI()
{
+ if (!HighLogic.LoadedSceneIsFlight) return;
+
try
{
- var handler = SettingHandler.Load("DisplayStack.xml");
- this.Hidden = handler.Get("hidden", this.Hidden);
- this.ShowControlBar = handler.Get("showControlBar", this.ShowControlBar);
- this.windowPosition.x = handler.Get("windowPositionX", this.windowPosition.x);
- this.windowPosition.y = handler.Get("windowPositionY", this.windowPosition.y);
+ if (!FlightEngineerCore.IsDisplayable)
+ {
+ return;
+ }
+
+ if (this.resizeRequested || this.numberOfStackSections != SectionLibrary.NumberOfStackSections)
+ {
+ this.numberOfStackSections = SectionLibrary.NumberOfStackSections;
+ this.windowPosition.width = 0;
+ this.windowPosition.height = 0;
+ this.resizeRequested = false;
+ }
+
+ if (!this.Hidden && (SectionLibrary.NumberOfStackSections > 0 || this.ShowControlBar))
+ {
+ var shouldCentre = this.windowPosition.min == Vector2.zero;
+ GUI.skin = null;
+ this.windowPosition = GUILayout.Window(this.windowId, this.windowPosition, this.Window, string.Empty, this.windowStyle).ClampToScreen();
+ if (shouldCentre)
+ {
+ this.windowPosition.center = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f);
+ }
+ }
}
catch (Exception ex)
{
- MyLogger.Exception(ex, "DisplayStack->Load");
+ MyLogger.Exception(ex);
}
}
- private void OnSizeChanged()
- {
- this.InitialiseStyles();
- this.RequestResize();
- }
-
///
- /// Saves the stack's state.
+ /// Draws a button list for a set of sections.
///
- private void Save()
+ private void DrawControlBarButtons(IEnumerable sections)
{
- try
+ var index = 0;
+ foreach (var section in sections.Where(s => s.showButton))
{
- var handler = new SettingHandler();
- handler.Set("hidden", this.Hidden);
- handler.Set("showControlBar", this.ShowControlBar);
- handler.Set("windowPositionX", this.windowPosition.x);
- handler.Set("windowPositionY", this.windowPosition.y);
- handler.Save("DisplayStack.xml");
+ if (index % 4 == 0)
+ {
+ if (index > 0)
+ {
+ GUILayout.EndHorizontal();
+ }
+ GUILayout.BeginHorizontal();
+ }
+ section.IsVisible = GUILayout.Toggle(section.IsVisible, section.Abbreviation.ToUpper(), this.buttonStyle);
+ index++;
}
- catch (Exception ex)
+ if (index > 0)
{
- MyLogger.Exception(ex, "DisplayStack->Save");
+ GUILayout.EndHorizontal();
}
}
///
- /// Draws the display stack window.
+ /// Draws a list of sections.
///
- private void Window(int windowId)
+ private void DrawSections(IEnumerable sections)
{
- try
+ foreach (var section in sections)
{
- if (this.ShowControlBar)
- {
- this.DrawControlBar();
- }
-
- if (SectionLibrary.NumberOfStackSections > 0)
+ if (!section.IsFloating)
{
- this.DrawSections(SectionLibrary.StockSections);
- this.DrawSections(SectionLibrary.CustomSections);
+ section.Draw();
}
+ }
+ }
- GUI.DragWindow();
+ private void ToggleHudGroup(int group) {
+ bool groupVisible = IsHudGroupVisible(group, SectionLibrary.StockSections) || IsHudGroupVisible(group, SectionLibrary.CustomSections);
+ SetHudGroupVisibility(group, SectionLibrary.StockSections, !groupVisible);
+ SetHudGroupVisibility(group, SectionLibrary.CustomSections, !groupVisible);
+ }
+ private bool IsHudGroupVisible(int group, IEnumerable modules) {
+ foreach (SectionModule section in modules) {
+ if (section.HudGroup == group && section.IsHud && section.IsHudVisible) return true;
}
- catch (Exception ex)
- {
- MyLogger.Exception(ex, "DisplayStack->Window");
+ return false;
+ }
+ private void SetHudGroupVisibility(int group, IEnumerable modules, bool visible) {
+ foreach (SectionModule section in modules) {
+ if (section.HudGroup == group) section.IsHudVisible = visible;
}
}
diff --git a/KerbalEngineer/Flight/FlightAppLauncher.cs b/KerbalEngineer/Flight/FlightAppLauncher.cs
index 62caba8c..92995823 100644
--- a/KerbalEngineer/Flight/FlightAppLauncher.cs
+++ b/KerbalEngineer/Flight/FlightAppLauncher.cs
@@ -36,12 +36,8 @@ public class FlightAppLauncher : AppLauncherButton, IFlightAppLauncher
///
/// Gets the current instance of the FlightAppLauncher object.
///
- public static FlightAppLauncher Instance
- {
- get
- {
- return instance;
- }
+ public static FlightAppLauncher Instance {
+ get { return instance; }
}
///
@@ -214,19 +210,18 @@ protected virtual void Update()
}
}
+ protected override void OnDestroy() {
+ base.OnDestroy();
+ Close();
+ }
+
///
/// Closes the menu.
///
private void Close()
{
- if (flightMenu != null)
- {
- flightMenu.Close();
- }
- else if (menuObject != null)
- {
- Destroy(menuObject);
- }
+ if (flightMenu != null) flightMenu.Close();
+ else if (menuObject != null) Destroy(menuObject);
}
///
@@ -241,17 +236,11 @@ private void Open()
return;
}
- if (menuPrefab == null || menuObject != null)
- {
- return;
- }
+ if (menuPrefab == null || menuObject != null) return;
// create object
menuObject = Instantiate(menuPrefab, GetAnchor(), Quaternion.identity) as GameObject;
- if (menuObject == null)
- {
- return;
- }
+ if (menuObject == null) return;
StyleManager.Process(menuObject);
@@ -260,10 +249,7 @@ private void Open()
// set menu's reference to this object for cross-communication
flightMenu = menuObject.GetComponent();
- if (flightMenu != null)
- {
- flightMenu.SetFlightAppLauncher(this);
- }
+ if (flightMenu != null) flightMenu.SetFlightAppLauncher(this);
}
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/FlightEngineerCore.cs b/KerbalEngineer/Flight/FlightEngineerCore.cs
index c1d9337f..acff0a64 100644
--- a/KerbalEngineer/Flight/FlightEngineerCore.cs
+++ b/KerbalEngineer/Flight/FlightEngineerCore.cs
@@ -19,14 +19,15 @@
#region Using Directives
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
#endregion
namespace KerbalEngineer.Flight {
#region Using Directives
- using System;
- using System.Collections.Generic;
- using System.Linq;
using Extensions;
using Readouts;
using Sections;
@@ -277,16 +278,16 @@ private void OnDestroy() {
SectionLibrary.Save();
foreach (var window in this.SectionWindows) {
- print("[FlightEngineer]: Destroying Floating Window for " + window.ParentSection.Name);
+ //print("[FlightEngineer]: Destroying Floating Window for " + window.ParentSection.Name);
Destroy(window);
}
foreach (var editor in this.SectionEditors) {
- print("[FlightEngineer]: Destroying Editor Window for " + editor.ParentSection.Name);
+ //print("[FlightEngineer]: Destroying Editor Window for " + editor.ParentSection.Name);
Destroy(editor);
}
- MyLogger.Log("FlightEngineerCore->OnDestroy");
+ //MyLogger.Log("FlightEngineerCore->OnDestroy");
} catch (Exception ex) {
MyLogger.Exception(ex);
}
@@ -295,15 +296,13 @@ private void OnDestroy() {
public static int markerDeadman = 0;
-void OnRenderObject() {
-
- if(Camera.current.name.Contains("00"))
+ void OnRenderObject() {
+ if (Camera.current.name.Contains("00"))
Readouts.Surface.ImpactProcessor.drawImpact(Color.red);
if (Camera.current.name.Contains("01"))
Readouts.Surface.ImpactProcessor.drawImpact(Color.red);
if (MapView.MapIsEnabled && Camera.current.name.Contains("UIVec"))
Readouts.Surface.ImpactProcessor.drawImpact(Color.red);
-
}
diff --git a/KerbalEngineer/Flight/Readouts/Body/BodyName.cs b/KerbalEngineer/Flight/Readouts/Body/BodyName.cs
index 8a1b28c5..dd53ec23 100644
--- a/KerbalEngineer/Flight/Readouts/Body/BodyName.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/BodyName.cs
@@ -26,9 +26,9 @@ public BodyName() {
public override void Draw(Unity.Flight.ISectionModule section) {
if (FlightGlobals.ActiveVessel.mainBody == null)
- DrawLine("N/A", section.IsHud);
+ DrawLine("N/A", section);
else
- DrawLine(FlightGlobals.ActiveVessel.mainBody.bodyDisplayName.LocalizeRemoveGender(), section.IsHud);
+ DrawLine(FlightGlobals.ActiveVessel.mainBody.bodyDisplayName.LocalizeRemoveGender(), section);
}
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Body/BodyRadius.cs b/KerbalEngineer/Flight/Readouts/Body/BodyRadius.cs
index 1b1fc271..84a2549b 100644
--- a/KerbalEngineer/Flight/Readouts/Body/BodyRadius.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/BodyRadius.cs
@@ -41,9 +41,9 @@ public BodyRadius() {
public override void Draw(Unity.Flight.ISectionModule section) {
if (FlightGlobals.ActiveVessel.mainBody == null)
- DrawLine("N/A", section.IsHud);
+ DrawLine("N/A", section);
else
- this.DrawLine(Helpers.Units.ToDistance(FlightGlobals.ActiveVessel.mainBody.Radius), section.IsHud);
+ this.DrawLine(Helpers.Units.ToDistance(FlightGlobals.ActiveVessel.mainBody.Radius, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/CurrentSoi.cs b/KerbalEngineer/Flight/Readouts/Body/CurrentSoi.cs
index 6b780047..c169b054 100644
--- a/KerbalEngineer/Flight/Readouts/Body/CurrentSoi.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/CurrentSoi.cs
@@ -43,9 +43,9 @@ public CurrentSoi() {
public override void Draw(Unity.Flight.ISectionModule section) {
if (!Double.IsInfinity(FlightGlobals.currentMainBody.sphereOfInfluence))
- this.DrawLine(FlightGlobals.currentMainBody.sphereOfInfluence.ToDistance(), section.IsHud);
+ this.DrawLine(FlightGlobals.currentMainBody.sphereOfInfluence.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
else
- this.DrawLine("N/A", section.IsHud);
+ this.DrawLine("N/A", section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/EscapeVelocity.cs b/KerbalEngineer/Flight/Readouts/Body/EscapeVelocity.cs
index c15962bf..98115ac8 100644
--- a/KerbalEngineer/Flight/Readouts/Body/EscapeVelocity.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/EscapeVelocity.cs
@@ -42,7 +42,7 @@ public EscapeVelocity() {
public override void Draw(Unity.Flight.ISectionModule section) {
var ev = Math.Sqrt(2 * FlightGlobals.currentMainBody.gravParameter / FlightGlobals.currentMainBody.Radius);
- this.DrawLine(Helpers.Units.ToSpeed(ev), section.IsHud);
+ this.DrawLine(Helpers.Units.ToSpeed(ev, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/GeostationaryHeight.cs b/KerbalEngineer/Flight/Readouts/Body/GeostationaryHeight.cs
index c486817c..004a1ce2 100644
--- a/KerbalEngineer/Flight/Readouts/Body/GeostationaryHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/GeostationaryHeight.cs
@@ -43,7 +43,7 @@ public GeostationaryHeight() {
public override void Draw(Unity.Flight.ISectionModule section) {
var T = FlightGlobals.currentMainBody.rotationPeriod;
var geo = System.Math.Pow(T * T * FlightGlobals.currentMainBody.gravParameter / (4 * Math.PI * Math.PI), 1.0 / 3.0);
- this.DrawLine((geo - FlightGlobals.currentMainBody.Radius).ToDistance(), section.IsHud);
+ this.DrawLine((geo - FlightGlobals.currentMainBody.Radius).ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/Gravity.cs b/KerbalEngineer/Flight/Readouts/Body/Gravity.cs
index 59f7acfd..a7560e81 100644
--- a/KerbalEngineer/Flight/Readouts/Body/Gravity.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/Gravity.cs
@@ -41,7 +41,7 @@ public BodyGravity() {
#region Methods: public
public override void Draw(Unity.Flight.ISectionModule section) {
- this.DrawLine(Helpers.Units.ToSpeed(FlightGlobals.ActiveVessel.mainBody.gravParameter / Math.Pow(FlightGlobals.currentMainBody.Radius , 2)), section.IsHud);
+ this.DrawLine(Helpers.Units.ToSpeed(FlightGlobals.ActiveVessel.mainBody.gravParameter / Math.Pow(FlightGlobals.currentMainBody.Radius , 2), section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/HasAtmosphere.cs b/KerbalEngineer/Flight/Readouts/Body/HasAtmosphere.cs
index 556b5a55..d3637d59 100644
--- a/KerbalEngineer/Flight/Readouts/Body/HasAtmosphere.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/HasAtmosphere.cs
@@ -43,7 +43,7 @@ public HasAtmosphere()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ActiveVessel.mainBody.atmosphere ? "Yes" : "No", section.IsHud);
+ this.DrawLine(FlightGlobals.ActiveVessel.mainBody.atmosphere ? "Yes" : "No", section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/HasOxygen.cs b/KerbalEngineer/Flight/Readouts/Body/HasOxygen.cs
index 72db69f9..548cb3df 100644
--- a/KerbalEngineer/Flight/Readouts/Body/HasOxygen.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/HasOxygen.cs
@@ -29,7 +29,7 @@ public HasOxygen()
public override void Draw(Unity.Flight.ISectionModule section)
{
- DrawLine(FlightGlobals.ActiveVessel.mainBody.atmosphereContainsOxygen ? "Yes" : "No", section.IsHud);
+ DrawLine(FlightGlobals.ActiveVessel.mainBody.atmosphereContainsOxygen ? "Yes" : "No", section);
}
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Body/HighAtmosphereHeight.cs b/KerbalEngineer/Flight/Readouts/Body/HighAtmosphereHeight.cs
index 44d937f9..9e1df55c 100644
--- a/KerbalEngineer/Flight/Readouts/Body/HighAtmosphereHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/HighAtmosphereHeight.cs
@@ -41,9 +41,9 @@ public HighAtmosphereHeight() {
public override void Draw(Unity.Flight.ISectionModule section) {
if (FlightGlobals.ActiveVessel.mainBody.atmosphere) {
- this.DrawLine(FlightGlobals.ActiveVessel.mainBody.scienceValues.flyingAltitudeThreshold.ToDistance(), section.IsHud);
+ this.DrawLine(FlightGlobals.ActiveVessel.mainBody.scienceValues.flyingAltitudeThreshold.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
} else
- this.DrawLine("N/A", section.IsHud);
+ this.DrawLine("N/A", section);
}
diff --git a/KerbalEngineer/Flight/Readouts/Body/HighSpaceHeight.cs b/KerbalEngineer/Flight/Readouts/Body/HighSpaceHeight.cs
index 71a36b68..63e54a84 100644
--- a/KerbalEngineer/Flight/Readouts/Body/HighSpaceHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/HighSpaceHeight.cs
@@ -44,7 +44,7 @@ public HighSpaceHeight()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ActiveVessel.mainBody.scienceValues.spaceAltitudeThreshold.ToDistance(), section.IsHud);
+ this.DrawLine(FlightGlobals.ActiveVessel.mainBody.scienceValues.spaceAltitudeThreshold.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/LowSpaceHeight.cs b/KerbalEngineer/Flight/Readouts/Body/LowSpaceHeight.cs
index 38105fd7..4d3cc779 100644
--- a/KerbalEngineer/Flight/Readouts/Body/LowSpaceHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/LowSpaceHeight.cs
@@ -42,9 +42,9 @@ public LowSpaceHeight() {
public override void Draw(Unity.Flight.ISectionModule section) {
if (FlightGlobals.ActiveVessel.mainBody.atmosphere) {
- this.DrawLine(FlightGlobals.ActiveVessel.mainBody.atmosphereDepth.ToDistance(), section.IsHud);
+ this.DrawLine(FlightGlobals.ActiveVessel.mainBody.atmosphereDepth.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
} else
- this.DrawLine(0.0.ToDistance(), section.IsHud);
+ this.DrawLine(0.0.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
diff --git a/KerbalEngineer/Flight/Readouts/Body/Mass.cs b/KerbalEngineer/Flight/Readouts/Body/Mass.cs
index ea2d3494..867310e9 100644
--- a/KerbalEngineer/Flight/Readouts/Body/Mass.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/Mass.cs
@@ -40,7 +40,7 @@ public BodyMass() {
#region Methods: public
public override void Draw(Unity.Flight.ISectionModule section) {
- this.DrawLine(Helpers.Units.ToMass(FlightGlobals.ActiveVessel.mainBody.Mass), section.IsHud);
+ this.DrawLine(Helpers.Units.ToMass(FlightGlobals.ActiveVessel.mainBody.Mass, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/MinOrbitHeight.cs b/KerbalEngineer/Flight/Readouts/Body/MinOrbitHeight.cs
index 3da03e70..0b2063d5 100644
--- a/KerbalEngineer/Flight/Readouts/Body/MinOrbitHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/MinOrbitHeight.cs
@@ -42,7 +42,7 @@ public MinOrbitHeight() {
public override void Draw(Unity.Flight.ISectionModule section) {
CelestialBody b = FlightGlobals.ActiveVessel.mainBody;
double h = b.minOrbitalDistance - FlightGlobals.ActiveVessel.mainBody.Radius;
- this.DrawLine(h.ToDistance(), section.IsHud);
+ this.DrawLine(h.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/OrbitalPeriod.cs b/KerbalEngineer/Flight/Readouts/Body/OrbitalPeriod.cs
index 3cdc3d9e..44de05e8 100644
--- a/KerbalEngineer/Flight/Readouts/Body/OrbitalPeriod.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/OrbitalPeriod.cs
@@ -41,9 +41,9 @@ public BodyOrbitalPeriod() {
public override void Draw(Unity.Flight.ISectionModule section) {
if (FlightGlobals.ActiveVessel.mainBody.orbit == null)
- this.DrawLine("N/A", section.IsHud);
+ this.DrawLine("N/A", section);
else
- this.DrawLine(Helpers.Units.ToTime(FlightGlobals.ActiveVessel.mainBody.orbit.period), section.IsHud);
+ this.DrawLine(Helpers.Units.ToTime(FlightGlobals.ActiveVessel.mainBody.orbit.period), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Body/RotationPeriod.cs b/KerbalEngineer/Flight/Readouts/Body/RotationPeriod.cs
index 78ce208a..35124278 100644
--- a/KerbalEngineer/Flight/Readouts/Body/RotationPeriod.cs
+++ b/KerbalEngineer/Flight/Readouts/Body/RotationPeriod.cs
@@ -40,7 +40,7 @@ public BodyRotationPeriod() {
#region Methods: public
public override void Draw(Unity.Flight.ISectionModule section) {
- this.DrawLine(Helpers.Units.ToTime(FlightGlobals.ActiveVessel.mainBody.rotationPeriod), section.IsHud);
+ this.DrawLine(Helpers.Units.ToTime(FlightGlobals.ActiveVessel.mainBody.rotationPeriod), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Miscellaneous/SimulationDelay.cs b/KerbalEngineer/Flight/Readouts/Miscellaneous/SimulationDelay.cs
index e0044a72..d25e939c 100644
--- a/KerbalEngineer/Flight/Readouts/Miscellaneous/SimulationDelay.cs
+++ b/KerbalEngineer/Flight/Readouts/Miscellaneous/SimulationDelay.cs
@@ -19,26 +19,33 @@
#region Using Directives
+using System;
+using UnityEngine;
+
using KerbalEngineer.Flight.Sections;
using KerbalEngineer.VesselSimulator;
-using UnityEngine;
-
#endregion
namespace KerbalEngineer.Flight.Readouts.Miscellaneous
{
- using System;
-
public class SimulationDelay : ReadoutModule
{
+ private static readonly GUIStyle sliderStyle = new GUIStyle(HighLogic.Skin.horizontalSlider) {
+ margin = new RectOffset(5, 0, 6, 6),
+ stretchHeight = false
+ };
+ private static readonly GUIStyle sliderThumbStyle = new GUIStyle(HighLogic.Skin.horizontalSliderThumb);
+
#region Constructors
public SimulationDelay()
{
this.Name = "Minimum Simulation Delay";
+ this.ShortName = "Sim Delay";
+ this.UseShortName = this.HudUseShortName = true;
this.Category = ReadoutCategory.GetCategory("Miscellaneous");
- this.HelpString = "Controls the minimum delay between processing vessel simulations.";
+ this.HelpString = "Controls the minimum delay between processing vessel simulations required for certain readouts. Does not affect the game's \"Max Physics Delta-Time per Frame\" option.";
this.IsDefault = true;
}
@@ -48,11 +55,18 @@ public SimulationDelay()
public override void Draw(Unity.Flight.ISectionModule section)
{
- GUILayout.BeginHorizontal();
- GUILayout.Label("Sim Delay", this.NameStyle);
- GUI.skin = HighLogic.Skin;
- SimManager.minSimTime = TimeSpan.FromMilliseconds(GUILayout.HorizontalSlider((float)SimManager.minSimTime.TotalMilliseconds, 0, 2000.0f));
- GUI.skin = null;
+ if (!section.IsHud) {
+ GUILayout.BeginHorizontal(GUILayout.Width(section.Width * GuiDisplaySize.Offset));
+ if (!this.HideName) GUILayout.Label((this.UseShortName && !string.IsNullOrEmpty(this.ShortName)) ? this.ShortName : this.Name, NameStyle);
+ } else {
+ GUILayout.BeginHorizontal(GUILayout.Width(section.HudWidth * GuiDisplaySize.Offset));
+ if (!this.HudHideName && !section.HideHudReadoutNames) GUILayout.Label((this.HudUseShortName && !string.IsNullOrEmpty(this.ShortName)) ? this.ShortName : this.Name, NameStyle, GUILayout.Height(NameStyle.fontSize * 1.2f));
+ }
+ //GUILayout.BeginVertical();
+ //GUILayout.FlexibleSpace(); //Doesn't work :(
+ SimManager.minSimTime = TimeSpan.FromMilliseconds(GUILayout.HorizontalSlider((float)SimManager.minSimTime.TotalMilliseconds, 0.0f, 2000.0f, sliderStyle, sliderThumbStyle));
+ //GUILayout.FlexibleSpace();
+ //GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
diff --git a/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemDateTime.cs b/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemDateTime.cs
index 9f5a8ca0..e8847dad 100644
--- a/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemDateTime.cs
+++ b/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemDateTime.cs
@@ -50,7 +50,7 @@ public SystemDateTime()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(DateTime.Now.ToString("yyyy-MM-dd, HH:mm:ss"), section.IsHud);
+ this.DrawLine(DateTime.Now.ToString("yyyy-MM-dd, HH:mm:ss"), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime.cs b/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime.cs
index 8b11e4b2..25086964 100644
--- a/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime.cs
+++ b/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime.cs
@@ -50,7 +50,7 @@ public SystemTime()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(DateTime.Now.ToString("h:mm:ss tt"), section.IsHud);
+ this.DrawLine(DateTime.Now.ToString("h:mm:ss tt"), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime24.cs b/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime24.cs
index 24ff9116..205dd078 100644
--- a/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime24.cs
+++ b/KerbalEngineer/Flight/Readouts/Miscellaneous/SystemTime24.cs
@@ -50,7 +50,7 @@ public SystemTime24()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(DateTime.Now.ToString("HH:mm:ss"), section.IsHud);
+ this.DrawLine(DateTime.Now.ToString("HH:mm:ss"), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs
index 6a641d83..712c68ec 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs
@@ -44,7 +44,7 @@ public AngleToEquatorialAscendingNode()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(OrbitExtensions.GetAngleToAscendingNode(FlightGlobals.ActiveVessel.orbit).ToAngle(), section.IsHud);
+ this.DrawLine(OrbitExtensions.GetAngleToAscendingNode(FlightGlobals.ActiveVessel.orbit).ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs
index e4decab6..57861483 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs
@@ -44,7 +44,7 @@ public AngleToEquatorialDescendingNode()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(OrbitExtensions.GetAngleToDescendingNode(FlightGlobals.ActiveVessel.orbit).ToAngle(), section.IsHud);
+ this.DrawLine(OrbitExtensions.GetAngleToDescendingNode(FlightGlobals.ActiveVessel.orbit).ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs b/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs
index fd72923e..e7808f53 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs
@@ -46,7 +46,7 @@ public AngleToPrograde()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(OrbitExtensions.GetAngleToPrograde(FlightGlobals.ship_orbit).ToAngle(), section.IsHud);
+ this.DrawLine(OrbitExtensions.GetAngleToPrograde(FlightGlobals.ship_orbit).ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs b/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs
index 7e35fdd9..70b54c7e 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs
@@ -46,7 +46,7 @@ public AngleToRetrograde()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(OrbitExtensions.GetAngleToRetrograde(FlightGlobals.ship_orbit).ToAngle(), section.IsHud);
+ this.DrawLine(OrbitExtensions.GetAngleToRetrograde(FlightGlobals.ship_orbit).ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ApoapsisHeight.cs b/KerbalEngineer/Flight/Readouts/Orbital/ApoapsisHeight.cs
index fb45bf74..badfdd2e 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ApoapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ApoapsisHeight.cs
@@ -33,6 +33,7 @@ public class ApoapsisHeight : ReadoutModule
public ApoapsisHeight()
{
this.Name = "Apoapsis Height";
+ this.ShortName = "Ap";
this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = "Shows the vessel's apoapsis height relative to sea level. (Apoapsis is the highest point of an orbit.)";
this.IsDefault = true;
@@ -44,7 +45,7 @@ public ApoapsisHeight()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ship_orbit.ApA.ToDistance(), section.IsHud);
+ this.DrawLine(FlightGlobals.ship_orbit.ApA.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ArgumentOfPeriapsis.cs b/KerbalEngineer/Flight/Readouts/Orbital/ArgumentOfPeriapsis.cs
index e3aeddb0..79f0ee63 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ArgumentOfPeriapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ArgumentOfPeriapsis.cs
@@ -46,7 +46,7 @@ public ArgumentOfPeriapsis()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ship_orbit.argumentOfPeriapsis.ToAngle(), section.IsHud);
+ this.DrawLine(FlightGlobals.ship_orbit.argumentOfPeriapsis.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/EccentricAnomaly.cs b/KerbalEngineer/Flight/Readouts/Orbital/EccentricAnomaly.cs
index 635645ba..4cb38d89 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/EccentricAnomaly.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/EccentricAnomaly.cs
@@ -35,7 +35,7 @@ public EccentricAnomaly()
public override void Draw(Unity.Flight.ISectionModule section)
{
- DrawLine((FlightGlobals.ship_orbit.eccentricAnomaly * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
+ DrawLine((FlightGlobals.ship_orbit.eccentricAnomaly * Units.RAD_TO_DEG).ToAngle(), section);
}
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/Eccentricity.cs b/KerbalEngineer/Flight/Readouts/Orbital/Eccentricity.cs
index 7e4cb7f1..1a3cce02 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/Eccentricity.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/Eccentricity.cs
@@ -43,7 +43,7 @@ public Eccentricity()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ship_orbit.eccentricity.ToString("F5"), section.IsHud);
+ this.DrawLine(FlightGlobals.ship_orbit.eccentricity.ToString("F5"), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/Inclination.cs b/KerbalEngineer/Flight/Readouts/Orbital/Inclination.cs
index 78d3ca92..303fa7a8 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/Inclination.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/Inclination.cs
@@ -44,7 +44,7 @@ public Inclination()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ship_orbit.inclination.ToAngle(), section.IsHud);
+ this.DrawLine(FlightGlobals.ship_orbit.inclination.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfAscendingNode.cs b/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfAscendingNode.cs
index d0f61c88..e9da8dcf 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfAscendingNode.cs
@@ -44,7 +44,7 @@ public LongitudeOfAscendingNode()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ship_orbit.LAN.ToAngle(), section.IsHud);
+ this.DrawLine(FlightGlobals.ship_orbit.LAN.ToAngle(), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfPeriapsis.cs b/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfPeriapsis.cs
index 012e5ed0..1f14fdc3 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfPeriapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfPeriapsis.cs
@@ -44,7 +44,7 @@ public LongitudeOfPeriapsis()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine((FlightGlobals.ship_orbit.LAN + FlightGlobals.ship_orbit.argumentOfPeriapsis).ToAngle(), section.IsHud);
+ this.DrawLine((FlightGlobals.ship_orbit.LAN + FlightGlobals.ship_orbit.argumentOfPeriapsis).ToAngle(), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToPrograde.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToPrograde.cs
index fc4a261d..045dd98e 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToPrograde.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToPrograde.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Node Angle to Prograde", ManoeuvreProcessor.AngleToPrograde.ToAngle(), section.IsHud);
+ this.DrawLine("Node Angle to Prograde", ManoeuvreProcessor.AngleToPrograde.ToAngle(), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToRetrograde.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToRetrograde.cs
index 6842dd55..16ad7f71 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToRetrograde.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeAngleToRetrograde.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Node Angle to Retrograde", ManoeuvreProcessor.AngleToRetrograde.ToAngle(), section.IsHud);
+ this.DrawLine("Node Angle to Retrograde", ManoeuvreProcessor.AngleToRetrograde.ToAngle(), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeBurnTime.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeBurnTime.cs
index f1f7c4ac..8b9cd36b 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeBurnTime.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeBurnTime.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Node Burn Time", TimeFormatter.ConvertToString(ManoeuvreProcessor.BurnTime), section.IsHud);
+ this.DrawLine("Node Burn Time", TimeFormatter.ConvertToString(ManoeuvreProcessor.BurnTime), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeHalfBurnTime.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeHalfBurnTime.cs
index 308c0d28..4a144884 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeHalfBurnTime.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeHalfBurnTime.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Node Burn Time (½)", TimeFormatter.ConvertToString(ManoeuvreProcessor.HalfBurnTime), section.IsHud);
+ this.DrawLine("Node Burn Time (½)", TimeFormatter.ConvertToString(ManoeuvreProcessor.HalfBurnTime), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeNormalDeltaV.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeNormalDeltaV.cs
index ab139d6b..43de8dff 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeNormalDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeNormalDeltaV.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Node DeltaV (Normal)", ManoeuvreProcessor.NormalDeltaV.ToSpeed(), section.IsHud);
+ this.DrawLine("Node DeltaV (Normal)", ManoeuvreProcessor.NormalDeltaV.ToSpeed(), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeProgradeDeltaV.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeProgradeDeltaV.cs
index fe4b21ef..be982c30 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeProgradeDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeProgradeDeltaV.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Node DeltaV (Prograde)", ManoeuvreProcessor.ProgradeDeltaV.ToSpeed(), section.IsHud);
+ this.DrawLine("Node DeltaV (Prograde)", ManoeuvreProcessor.ProgradeDeltaV.ToSpeed(), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeRadialDeltaV.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeRadialDeltaV.cs
index 27f8effa..063e7fb5 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeRadialDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeRadialDeltaV.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Node DeltaV (Radial)", ManoeuvreProcessor.RadialDeltaV.ToSpeed(), section.IsHud);
+ this.DrawLine("Node DeltaV (Radial)", ManoeuvreProcessor.RadialDeltaV.ToSpeed(), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToHalfBurn.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToHalfBurn.cs
index 869e24a2..964bc70f 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToHalfBurn.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToHalfBurn.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Time to Node Burn", TimeFormatter.ConvertToString(ManoeuvreProcessor.UniversalTime - ManoeuvreProcessor.HalfBurnTime - Planetarium.GetUniversalTime()), section.IsHud);
+ this.DrawLine("Time to Node Burn", TimeFormatter.ConvertToString(ManoeuvreProcessor.UniversalTime - ManoeuvreProcessor.HalfBurnTime - Planetarium.GetUniversalTime()), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToManoeuvre.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToManoeuvre.cs
index 6995571f..10d577df 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToManoeuvre.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTimeToManoeuvre.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Time to Node", TimeFormatter.ConvertToString(ManoeuvreProcessor.UniversalTime - Planetarium.GetUniversalTime()), section.IsHud);
+ this.DrawLine("Time to Node", TimeFormatter.ConvertToString(ManoeuvreProcessor.UniversalTime - Planetarium.GetUniversalTime()), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTotalDeltaV.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTotalDeltaV.cs
index 2a68b9a6..58eebf7d 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTotalDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/NodeTotalDeltaV.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Node DeltaV (Total)", ManoeuvreProcessor.TotalDeltaV.ToSpeed() + " (" + (ManoeuvreProcessor.HasDeltaV ? "S" + ManoeuvreProcessor.FinalStage : "X") + ")", section.IsHud);
+ this.DrawLine("Node DeltaV (Total)", ManoeuvreProcessor.TotalDeltaV.ToSpeed() + " (" + (ManoeuvreProcessor.HasDeltaV ? "S" + ManoeuvreProcessor.FinalStage : "X") + ")", section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnApoapsis.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnApoapsis.cs
index 8c23bea7..b6f1be41 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnApoapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnApoapsis.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Post-burn Apoapsis", ManoeuvreProcessor.PostBurnAp.ToDistance(), section.IsHud);
+ this.DrawLine("Post-burn Apoapsis", ManoeuvreProcessor.PostBurnAp.ToDistance(), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnEccentricity.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnEccentricity.cs
index ed49cb1d..6ee90a17 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnEccentricity.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnEccentricity.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine(ManoeuvreProcessor.PostBurnEcc.ToString("F5"), section.IsHud);
+ this.DrawLine(ManoeuvreProcessor.PostBurnEcc.ToString("F5"), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnInclination.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnInclination.cs
index a867726d..4830c7d6 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnInclination.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnInclination.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine(ManoeuvreProcessor.PostBurnInclination.ToAngle(), section.IsHud);
+ this.DrawLine(ManoeuvreProcessor.PostBurnInclination.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnPeriapsis.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnPeriapsis.cs
index 27338743..88c25640 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnPeriapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnPeriapsis.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Post-burn Periapsis", ManoeuvreProcessor.PostBurnPe.ToDistance(), section.IsHud);
+ this.DrawLine("Post-burn Periapsis", ManoeuvreProcessor.PostBurnPe.ToDistance(), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnPeriod.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnPeriod.cs
index b20a82f7..94f6a88d 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnPeriod.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnPeriod.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine(TimeFormatter.ConvertToString(ManoeuvreProcessor.PostBurnPeriod, "F3"), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(ManoeuvreProcessor.PostBurnPeriod, "F3"), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnRelativeInclination.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnRelativeInclination.cs
index 8f755d24..2bbfcb2b 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnRelativeInclination.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/PostBurnRelativeInclination.cs
@@ -46,9 +46,9 @@ public override void Draw(Unity.Flight.ISectionModule section) {
return;
}
if (FlightGlobals.ActiveVessel.targetObject == null || FlightGlobals.ActiveVessel.targetObject.GetOrbit() == null)
- this.DrawLine("N/A", section.IsHud);
+ this.DrawLine("N/A", section);
else
- this.DrawLine(ManoeuvreProcessor.PostBurnRelativeInclination.ToAngle(), section.IsHud);
+ this.DrawLine(ManoeuvreProcessor.PostBurnRelativeInclination.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void Reset() {
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/TripTotalDeltaV.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/TripTotalDeltaV.cs
index 2525d784..9d5fedf0 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/TripTotalDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/TripTotalDeltaV.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine("Trip Total DeltaV ", ManoeuvreProcessor.TripDeltaV.ToSpeed(), section.IsHud);
+ this.DrawLine("Trip Total DeltaV ", ManoeuvreProcessor.TripDeltaV.ToSpeed(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomaly.cs b/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomaly.cs
index f7869897..e9729846 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomaly.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomaly.cs
@@ -35,7 +35,7 @@ public MeanAnomaly()
public override void Draw(Unity.Flight.ISectionModule section)
{
- DrawLine((FlightGlobals.ship_orbit.meanAnomaly * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
+ DrawLine((FlightGlobals.ship_orbit.meanAnomaly * Units.RAD_TO_DEG).ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomalyAtEpoc.cs b/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomalyAtEpoc.cs
index 2b0ad304..95fee580 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomalyAtEpoc.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/MeanAnomalyAtEpoc.cs
@@ -35,7 +35,7 @@ public MeanAnomalyAtEpoc()
public override void Draw(Unity.Flight.ISectionModule section)
{
- DrawLine((FlightGlobals.ship_orbit.meanAnomalyAtEpoch * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
+ DrawLine((FlightGlobals.ship_orbit.meanAnomalyAtEpoch * Units.RAD_TO_DEG).ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/OrbitalPeriod.cs b/KerbalEngineer/Flight/Readouts/Orbital/OrbitalPeriod.cs
index af0ecadc..ece0e51a 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/OrbitalPeriod.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/OrbitalPeriod.cs
@@ -44,7 +44,7 @@ public OrbitalPeriod()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ship_orbit.period, "F3"), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ship_orbit.period, "F3"), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/OrbitalSpeed.cs b/KerbalEngineer/Flight/Readouts/Orbital/OrbitalSpeed.cs
index 0cc1f63f..c71e01c2 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/OrbitalSpeed.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/OrbitalSpeed.cs
@@ -44,7 +44,7 @@ public OrbitalSpeed()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ship_obtSpeed.ToSpeed(), section.IsHud);
+ this.DrawLine(FlightGlobals.ship_obtSpeed.ToSpeed(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/PeriapsisHeight.cs b/KerbalEngineer/Flight/Readouts/Orbital/PeriapsisHeight.cs
index e2657faf..2cb1794f 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/PeriapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/PeriapsisHeight.cs
@@ -33,6 +33,7 @@ public class PeriapsisHeight : ReadoutModule
public PeriapsisHeight()
{
this.Name = "Periapsis Height";
+ this.ShortName = "Pe";
this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = "Shows the vessel's periapsis height relative to sea level. (Periapsis is the lowest point of an orbit.)";
this.IsDefault = true;
@@ -44,7 +45,7 @@ public PeriapsisHeight()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ship_orbit.PeA.ToDistance(), section.IsHud);
+ this.DrawLine(FlightGlobals.ship_orbit.PeA.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/SemiMajorAxis.cs b/KerbalEngineer/Flight/Readouts/Orbital/SemiMajorAxis.cs
index 3d39ac57..b289ed28 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/SemiMajorAxis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/SemiMajorAxis.cs
@@ -44,7 +44,8 @@ public SemiMajorAxis()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToDistance(FlightGlobals.ship_orbit.semiMajorAxis, 3), section.IsHud);
+ int dec = section.IsHud ? HudDecimalPlaces : DecimalPlaces;
+ this.DrawLine(Units.ToDistance(FlightGlobals.ship_orbit.semiMajorAxis, dec < 0 ? 3 : dec), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/SemiMinorAxis.cs b/KerbalEngineer/Flight/Readouts/Orbital/SemiMinorAxis.cs
index d01836fb..59b9e59f 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/SemiMinorAxis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/SemiMinorAxis.cs
@@ -44,7 +44,8 @@ public SemiMinorAxis()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToDistance(FlightGlobals.ship_orbit.semiMinorAxis, 3), section.IsHud);
+ int dec = section.IsHud ? HudDecimalPlaces : DecimalPlaces;
+ this.DrawLine(Units.ToDistance(FlightGlobals.ship_orbit.semiMinorAxis, dec < 0 ? 3 : dec), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtApoapsis.cs b/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtApoapsis.cs
index ab449876..8356bf4a 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtApoapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtApoapsis.cs
@@ -60,7 +60,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
else
str = Math.Sqrt(speedsqr).ToSpeed();
}
- this.DrawLine(str, section.IsHud);
+ this.DrawLine(str, section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtPeriapsis.cs b/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtPeriapsis.cs
index c1b8bf96..6caf3ad6 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtPeriapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtPeriapsis.cs
@@ -56,7 +56,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
str = "---m/s";
else
str = Math.Sqrt(speedsqr).ToSpeed();
- this.DrawLine(str, section.IsHud);
+ this.DrawLine(str, section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/TimeToApoapsis.cs b/KerbalEngineer/Flight/Readouts/Orbital/TimeToApoapsis.cs
index 15954641..61b23877 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToApoapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToApoapsis.cs
@@ -33,6 +33,7 @@ public class TimeToApoapsis : ReadoutModule
public TimeToApoapsis()
{
this.Name = "Time to Apoapsis";
+ this.ShortName = "TtAp";
this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = "Shows the time until the vessel reaches apoapsis, the highest point of the orbit.";
this.IsDefault = true;
@@ -44,7 +45,7 @@ public TimeToApoapsis()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ship_orbit.timeToAp), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ship_orbit.timeToAp), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/TimeToAtmosphere.cs b/KerbalEngineer/Flight/Readouts/Orbital/TimeToAtmosphere.cs
index 85a56ffa..2d277044 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToAtmosphere.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToAtmosphere.cs
@@ -91,7 +91,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
}
//log.Flush();
- this.DrawLine(str, section.IsHud);
+ this.DrawLine(str, section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs
index a41f89a2..7241d684 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs
@@ -45,7 +45,7 @@ public TimeToEquatorialAscendingNode()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(TimeFormatter.ConvertToString(OrbitExtensions.GetTimeToAscendingNode(FlightGlobals.ActiveVessel.orbit)), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(OrbitExtensions.GetTimeToAscendingNode(FlightGlobals.ActiveVessel.orbit)), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs
index 7e93dbce..1c2e9b71 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs
@@ -45,7 +45,7 @@ public TimeToEquatorialDescendingNode()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(TimeFormatter.ConvertToString(OrbitExtensions.GetTimeToDescendingNode(FlightGlobals.ActiveVessel.orbit)), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(OrbitExtensions.GetTimeToDescendingNode(FlightGlobals.ActiveVessel.orbit)), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/TimeToPeriapsis.cs b/KerbalEngineer/Flight/Readouts/Orbital/TimeToPeriapsis.cs
index dd6041a1..c962a65e 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToPeriapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToPeriapsis.cs
@@ -33,6 +33,7 @@ public class TimeToPeriapsis : ReadoutModule
public TimeToPeriapsis()
{
this.Name = "Time to Periapsis";
+ this.ShortName = "TtPe";
this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = "Shows the time until the vessel reaches periapsis, the lowest point of the orbit.";
this.IsDefault = true;
@@ -44,7 +45,7 @@ public TimeToPeriapsis()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ship_orbit.timeToPe), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ship_orbit.timeToPe), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Orbital/TrueAnomaly.cs b/KerbalEngineer/Flight/Readouts/Orbital/TrueAnomaly.cs
index 8109f453..7fc0ab42 100644
--- a/KerbalEngineer/Flight/Readouts/Orbital/TrueAnomaly.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TrueAnomaly.cs
@@ -47,7 +47,7 @@ public TrueAnomaly()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine((FlightGlobals.ship_orbit.trueAnomaly * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
+ this.DrawLine((FlightGlobals.ship_orbit.trueAnomaly * Units.RAD_TO_DEG).ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs b/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
index 03271041..ccbe9310 100644
--- a/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
@@ -119,6 +119,8 @@ static ReadoutLibrary() {
readouts.Add(new ImpactMarker());
readouts.Add(new ImpactAltitude());
readouts.Add(new ImpactBiome());
+ readouts.Add(new SurfaceDistanceToWaypoint());
+ readouts.Add(new BearingToWaypoint());
// Vessel
readouts.Add(new Name());
@@ -140,12 +142,18 @@ static ReadoutLibrary() {
readouts.Add(new SuicideBurnDeltaV());
readouts.Add(new SuicideBurnCountdown());
readouts.Add(new SuicideBurnLength());
+ readouts.Add(new ElectricCharge());
+ readouts.Add(new LfOxRatio());
readouts.Add(new IntakeAirUsage());
readouts.Add(new IntakeAirDemand());
readouts.Add(new IntakeAirSupply());
readouts.Add(new IntakeAirDemandSupply());
readouts.Add(new PartCount());
readouts.Add(new Throttle());
+ readouts.Add(new Glideslope());
+ readouts.Add(new AngleOfAttack());
+ readouts.Add(new AngleOfSideslip());
+ readouts.Add(new AngleOfDisplacement());
readouts.Add(new Heading());
readouts.Add(new Pitch());
readouts.Add(new Roll());
@@ -183,6 +191,8 @@ static ReadoutLibrary() {
readouts.Add(new Rendezvous.SpeedAtClosestApproach());
readouts.Add(new TargetLatitude());
readouts.Add(new TargetLongitude());
+ readouts.Add(new SurfaceDistanceToTarget());
+ readouts.Add(new BearingToTarget());
// Thermal
readouts.Add(new InternalFlux());
@@ -292,27 +302,31 @@ private static void LoadReadoutConfig() {
try {
SettingHandler handler = SettingHandler.Load("ReadoutsConfig.xml", new Type[] { typeof(ReadoutModuleConfigNode)});
foreach (ReadoutModule readout in readouts) {
- ReadoutModuleConfigNode r = handler.Get(readout.Name, null);
- if (r != null) {
- readout.ValueStyle.normal.textColor = r.Color;
+ ReadoutModuleConfigNode readoutNode = handler.Get(readout.Name, null);
+ if (readoutNode != null) {
+ readout.CopyFrom(readoutNode);
+ readout.ValueStyle.normal.textColor = readoutNode.TextColor;
+ readout.HudValueStyle.normal.textColor = readoutNode.HudTextColor;
}
}
+
handler.Save("ReadoutsConfig.xml");
} catch (Exception ex) {
MyLogger.Exception(ex);
}
}
-
- public static void RemoveReadoutConfig(ReadoutModule readout) {
+
+ public static void SaveReadoutConfig(ReadoutModule readout) {
try {
SettingHandler handler = SettingHandler.Load("ReadoutsConfig.xml", new Type[] { typeof(ReadoutModuleConfigNode)});
- var r = handler.Get(readout.Name, null);
+ var readoutNode = handler.Get(readout.Name, null);
+ if (readoutNode == null) readoutNode = new ReadoutModuleConfigNode();
- if (r == null) {
- return;
- }
+ readoutNode.CopyFrom(readout);
+ readoutNode.TextColor = readout.ValueStyle.normal.textColor;
+ readoutNode.HudTextColor = readout.HudValueStyle.normal.textColor;
- handler.Items.Remove(handler.Items.Find(i => i.Name == readout.Name));
+ handler.Set(readout.Name, readoutNode);
handler.Save("ReadoutsConfig.xml");
} catch (Exception ex) {
@@ -320,25 +334,21 @@ public static void RemoveReadoutConfig(ReadoutModule readout) {
}
}
-
- public static void SaveReadoutConfig(ReadoutModule readout) {
+ public static void RemoveReadoutConfig(ReadoutModule readout) {
try {
SettingHandler handler = SettingHandler.Load("ReadoutsConfig.xml", new Type[] { typeof(ReadoutModuleConfigNode)});
var r = handler.Get(readout.Name, null);
if (r == null) {
- r = new ReadoutModuleConfigNode();
+ return;
}
- r.Name = readout.Name;
- r.Color = readout.ValueStyle.normal.textColor;
+ handler.Items.Remove(handler.Items.Find(i => i.Name == readout.Name));
- handler.Set(r.Name, r);
handler.Save("ReadoutsConfig.xml");
} catch (Exception ex) {
MyLogger.Exception(ex);
}
}
-
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/ReadoutModule.cs b/KerbalEngineer/Flight/Readouts/ReadoutModule.cs
index 704868c7..94593468 100644
--- a/KerbalEngineer/Flight/Readouts/ReadoutModule.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutModule.cs
@@ -31,7 +31,7 @@ namespace KerbalEngineer.Flight.Readouts {
using Extensions;
using Unity.Flight;
- public abstract class ReadoutModule {
+ public abstract class ReadoutModule : ReadoutModuleConfigNode {
#region Fields
private int lineCountEnd;
@@ -50,10 +50,9 @@ protected ReadoutModule() {
#region Properties
+ public string Name { get; set; }
+ public string ShortName { get; set; }
- ///
- /// Gets ans sets the readout category.
- ///
public ReadoutCategory Category { get; set; }
///
@@ -65,7 +64,7 @@ protected ReadoutModule() {
/// Gets the width of the content. (Sum of NameStyle + ValueStyle widths.)
///
public float ContentWidth {
- get { return 230.0f * GuiDisplaySize.Offset; }
+ get { return OOPSux.DEFAULT_SECTION_WIDTH * GuiDisplaySize.Offset; }
}
///
@@ -77,7 +76,7 @@ public float ContentWidth {
/// Gets and sets the help string which is shown in the editor.
///
public string HelpString { get; set; }
-
+
///
/// Gets and sets whether the readout should be shown on new installs.
///
@@ -87,12 +86,7 @@ public float ContentWidth {
/// Gets the number of drawn lines.
///
public int LineCount { get; private set; }
-
- ///
- /// Gets and sets the readout name.
- ///
- public string Name { get; set; }
-
+
///
/// Gets and sets whether the readout has requested a section resize.
///
@@ -108,12 +102,17 @@ public float ContentWidth {
/// Gets and sets the text field style.
///
public GUIStyle TextFieldStyle { get; set; }
-
+
///
/// Gets and sets the value style.
///
public GUIStyle ValueStyle { get; set; }
+ ///
+ /// Gets and sets the HUD value style.
+ ///
+ public GUIStyle HudValueStyle { get; set; }
+
///
/// Gets and sets the name style.
///
@@ -174,45 +173,46 @@ public virtual void Update() { }
#region Methods: protected
- protected void DrawLine(string value, bool compact) {
- GUILayout.BeginHorizontal(GUILayout.Width(this.ContentWidth));
-
- if (!compact) {
- GUILayout.Label(this.Name, NameStyle);
+ protected void DrawLine(string value, Unity.Flight.ISectionModule section) {
+ if (!section.IsHud) {
+ GUILayout.BeginHorizontal(GUILayout.Width(section.Width * GuiDisplaySize.Offset));
+ if (!this.HideName) GUILayout.Label((this.UseShortName && !string.IsNullOrEmpty(this.ShortName)) ? this.ShortName : this.Name, NameStyle);
GUILayout.FlexibleSpace();
- GUILayout.Label(value.ToLength(20), ValueStyle);
+ GUILayout.Label(value.ToLength(CharacterLimit), ValueStyle);
} else {
- GUILayout.Label(this.Name, NameStyle, GUILayout.Height(NameStyle.fontSize * 1.2f));
+ GUILayout.BeginHorizontal(GUILayout.Width(section.HudWidth * GuiDisplaySize.Offset));
+ if (!this.HudHideName && !section.HideHudReadoutNames) GUILayout.Label((this.HudUseShortName && !string.IsNullOrEmpty(this.ShortName)) ? this.ShortName : this.Name, NameStyle, GUILayout.Height(NameStyle.fontSize * 1.2f));
GUILayout.FlexibleSpace();
- GUILayout.Label(value.ToLength(20), ValueStyle, GUILayout.Height(ValueStyle.fontSize * 1.2f));
+ GUILayout.Label(value.ToLength(HudCharacterLimit), HudValueStyle, GUILayout.Height(HudValueStyle.fontSize * 1.2f));
}
GUILayout.EndHorizontal();
this.lineCountEnd++;
}
- protected void DrawLine(string name, string value, bool compact = false) {
- GUILayout.BeginHorizontal(GUILayout.Width(this.ContentWidth));
- if (!compact) {
- GUILayout.Label(name, NameStyle);
+ protected void DrawLine(string name, string value, Unity.Flight.ISectionModule section) {
+ if (!section.IsHud) {
+ GUILayout.BeginHorizontal(GUILayout.Width(section.Width * GuiDisplaySize.Offset));
+ if (!this.HideName) GUILayout.Label(name, NameStyle);
GUILayout.FlexibleSpace();
- GUILayout.Label(value.ToLength(20), ValueStyle);
+ GUILayout.Label(value.ToLength(CharacterLimit), ValueStyle);
} else {
- GUILayout.Label(name, NameStyle, GUILayout.Height(NameStyle.fontSize * 1.2f));
+ GUILayout.BeginHorizontal(GUILayout.Width(section.HudWidth * GuiDisplaySize.Offset));
+ if (!this.HudHideName && !section.HideHudReadoutNames) GUILayout.Label(name, NameStyle, GUILayout.Height(NameStyle.fontSize * 1.2f));
GUILayout.FlexibleSpace();
- GUILayout.Label(value.ToLength(20), ValueStyle, GUILayout.Height(ValueStyle.fontSize * 1.2f));
+ GUILayout.Label(value.ToLength(HudCharacterLimit), HudValueStyle, GUILayout.Height(HudValueStyle.fontSize * 1.2f));
}
GUILayout.EndHorizontal();
this.lineCountEnd++;
}
- protected void DrawLine(Action drawAction, bool showName = true, bool compact = false) {
- GUILayout.BeginHorizontal(GUILayout.Width(this.ContentWidth));
- if (showName) {
- if (!compact) {
- GUILayout.Label(this.Name, NameStyle);
+ protected void DrawLine(Action drawAction, Unity.Flight.ISectionModule section, bool showName = true) {
+ GUILayout.BeginHorizontal(GUILayout.Width((section.IsHud ? section.HudWidth : section.Width) * GuiDisplaySize.Offset));
+ if (showName && !(section.IsHud ? this.HudHideName : this.HideName) && !section.HideHudReadoutNames) {
+ if (!section.IsHud) {
+ GUILayout.Label((this.UseShortName && !string.IsNullOrEmpty(this.ShortName)) ? this.ShortName : this.Name, NameStyle);
} else {
- GUILayout.Label(this.Name, NameStyle, GUILayout.Height(NameStyle.fontSize * 1.2f));
+ GUILayout.Label((this.HudUseShortName && !string.IsNullOrEmpty(this.ShortName)) ? this.ShortName : this.Name, NameStyle, GUILayout.Height(NameStyle.fontSize * 1.2f));
}
GUILayout.FlexibleSpace();
}
@@ -221,8 +221,8 @@ protected void DrawLine(Action drawAction, bool showName = true, bool compact =
this.lineCountEnd++;
}
- protected void DrawMessageLine(string value, bool compact = false) {
- GUILayout.BeginHorizontal(GUILayout.Width(this.ContentWidth));
+ protected void DrawMessageLine(string value, float width, bool compact = false) {
+ GUILayout.BeginHorizontal(GUILayout.Width(width * GuiDisplaySize.Offset));
if (!compact) {
GUILayout.Label(value, MessageStyle);
} else {
@@ -232,6 +232,8 @@ protected void DrawMessageLine(string value, bool compact = false) {
this.lineCountEnd++;
}
+ public bool UsingShortName(Unity.Flight.ISectionModule section) { return !string.IsNullOrEmpty(ShortName) && (section.IsHud ? HudUseShortName : UseShortName); }
+
#endregion
#region Methods: private
@@ -240,13 +242,9 @@ protected void DrawMessageLine(string value, bool compact = false) {
/// Initialises all the styles required for this object.
///
private void InitialiseStyles(bool force) {
-
if (NameStyle != null && !force) return;
ReadoutModule existing = ReadoutLibrary.GetReadout(this.Name);
- Color c = HighLogic.Skin.label.normal.textColor;
- if (existing != null)
- c = existing.ValueStyle.normal.textColor;
NameStyle = new GUIStyle(HighLogic.Skin.label) {
normal =
@@ -269,6 +267,10 @@ private void InitialiseStyles(bool force) {
fontStyle = FontStyle.Normal,
fixedHeight = 20.0f * GuiDisplaySize.Offset,
};
+ HudValueStyle = new GUIStyle(ValueStyle);
+ this.ValueStyle.normal.textColor = existing == null ? HighLogic.Skin.label.normal.textColor : existing.ValueStyle.normal.textColor;
+ this.HudValueStyle.normal.textColor = existing == null ? HighLogic.Skin.label.normal.textColor : existing.HudValueStyle.normal.textColor;
+
MessageStyle = new GUIStyle(HighLogic.Skin.label) {
normal =
@@ -314,11 +316,6 @@ private void InitialiseStyles(bool force) {
fontSize = (int)(11 * GuiDisplaySize.Offset),
fixedHeight = 18.0f * GuiDisplaySize.Offset
};
-
-
- this.ValueStyle.normal.textColor = c;
-
-
}
private void OnSizeChanged() {
diff --git a/KerbalEngineer/Flight/Readouts/ReadoutModuleConfigNode.cs b/KerbalEngineer/Flight/Readouts/ReadoutModuleConfigNode.cs
index 288d5022..73b8ccdc 100644
--- a/KerbalEngineer/Flight/Readouts/ReadoutModuleConfigNode.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutModuleConfigNode.cs
@@ -1,7 +1,40 @@
using UnityEngine;
namespace KerbalEngineer.Flight.Readouts {
public class ReadoutModuleConfigNode {
- public string Name { get; set; }
- public Color Color { get; set; } = HighLogic.Skin.label.normal.textColor;
+ public const int DEFAULT_CHARACTER_LIMIT = 20;
+
+
+ public Color TextColor { get; set; } = HighLogic.Skin.label.normal.textColor;
+ public Color HudTextColor { get; set; } = HighLogic.Skin.label.normal.textColor;
+
+ //Displayed value strings will be truncated if they're longer than this.
+ public int CharacterLimit { get; set; } = DEFAULT_CHARACTER_LIMIT;
+ public int HudCharacterLimit { get; set; } = DEFAULT_CHARACTER_LIMIT;
+
+ //Decimal-place override for floating-point value readouts. Negative values will use the default number of decimal places for that type of unit.
+ public int DecimalPlaces { get; set; } = -9000;
+ public int HudDecimalPlaces { get; set; } = -9000;
+
+ //Whether to display the name/label in front of the readout value.
+ public bool HideName { get; set; } = false;
+ public bool HudHideName { get; set; } = false;
+
+ //Whether to display the short name in readouts rather than the full one.
+ public bool UseShortName { get; set; } = false;
+ public bool HudUseShortName { get; set; } = false;
+
+
+ public void CopyFrom(ReadoutModuleConfigNode source) {
+ TextColor = source.TextColor;
+ HudTextColor = source.HudTextColor;
+ DecimalPlaces = source.DecimalPlaces;
+ HudDecimalPlaces = source.HudDecimalPlaces;
+ CharacterLimit = source.CharacterLimit;
+ HudCharacterLimit = source.HudCharacterLimit;
+ HideName = source.HideName;
+ HudHideName = source.HudHideName;
+ UseShortName = source.UseShortName;
+ HudUseShortName = source.HudUseShortName;
+ }
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/AltitudeSeaLevel.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/AltitudeSeaLevel.cs
index b1a7564e..d9291a5f 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/AltitudeSeaLevel.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/AltitudeSeaLevel.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(RendezvousProcessor.AltitudeSeaLevel.ToDistance(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.AltitudeSeaLevel.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeAscendingNode.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeAscendingNode.cs
index 5521a3e3..56d697e2 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeAscendingNode.cs
@@ -50,11 +50,11 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
double angle = RendezvousProcessor.AngleToPlane[0];
- this.DrawLine("(L) " + angle.ToAngle(), section.IsHud);
+ this.DrawLine("(L) " + angle.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
else
{
- this.DrawLine(RendezvousProcessor.AngleToAscendingNode.ToAngle(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.AngleToAscendingNode.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeDescendingNode.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeDescendingNode.cs
index 50397da8..61f21e1b 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeDescendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/AngleToRelativeDescendingNode.cs
@@ -50,11 +50,11 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
double angle = RendezvousProcessor.AngleToPlane[1];
- this.DrawLine("(L) " + angle.ToAngle(), section.IsHud);
+ this.DrawLine("(L) " + angle.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
else
{
- this.DrawLine(RendezvousProcessor.AngleToDescendingNode.ToAngle(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.AngleToDescendingNode.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/ApoapsisHeight.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/ApoapsisHeight.cs
index 6dc45a26..42d75d19 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/ApoapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/ApoapsisHeight.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(RendezvousProcessor.ApoapsisHeight.ToDistance(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.ApoapsisHeight.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/BearingToTarget.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/BearingToTarget.cs
new file mode 100644
index 00000000..cf1971df
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/BearingToTarget.cs
@@ -0,0 +1,66 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2017 fat-lobyte
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Readouts.Surface;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Rendezvous
+{
+ public class BearingToTarget : ReadoutModule
+ {
+ #region Constructors
+
+ public BearingToTarget()
+ {
+ this.Name = "Bearing to Target";
+ this.Category = ReadoutCategory.GetCategory("Rendezvous");
+ this.HelpString = "Bearing to the target on the surface";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(Unity.Flight.ISectionModule section)
+ {
+ if (SurfaceDistanceProcessor.ShowTargetDetails)
+ {
+ this.DrawLine(SurfaceDistanceProcessor.SurfaceBearingToTarget.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(SurfaceDistanceProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ SurfaceDistanceProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/Distance.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/Distance.cs
index 78c923ca..381afbb2 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/Distance.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/Distance.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(RendezvousProcessor.Distance.ToDistance(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.Distance.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/InterceptAngle.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/InterceptAngle.cs
index 8a623ed8..1d0e5e3c 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/InterceptAngle.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/InterceptAngle.cs
@@ -47,7 +47,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(RendezvousProcessor.InterceptAngle.ToAngle(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.InterceptAngle.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/OrbitalPeriod.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/OrbitalPeriod.cs
index 04e49ef2..266f3ce9 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/OrbitalPeriod.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/OrbitalPeriod.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.OrbitalPeriod, "F3"), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.OrbitalPeriod, "F3"), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/PeriapsisHeight.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/PeriapsisHeight.cs
index 8fb66e5c..dc08ee4a 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/PeriapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/PeriapsisHeight.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(RendezvousProcessor.PeriapsisHeight.ToDistance(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.PeriapsisHeight.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/PhaseAngle.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/PhaseAngle.cs
index de8f6572..a1c07acc 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/PhaseAngle.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/PhaseAngle.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(RendezvousProcessor.PhaseAngle.ToAngle(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.PhaseAngle.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeInclination.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeInclination.cs
index 4abc84e0..6a4fae4b 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeInclination.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeInclination.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(RendezvousProcessor.RelativeInclination.ToAngle(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.RelativeInclination.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeSpeed.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeSpeed.cs
index 0b0af8c4..b0eb6ef0 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeSpeed.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeSpeed.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(RendezvousProcessor.RelativeSpeed.ToSpeed(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.RelativeSpeed.ToSpeed(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeVelocity.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeVelocity.cs
index d258113d..bc7ef56f 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeVelocity.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeVelocity.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(RendezvousProcessor.RelativeVelocity.ToSpeed(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.RelativeVelocity.ToSpeed(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs
index 9606a8f2..8bd9e54b 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs
@@ -564,9 +564,9 @@ private double[] CalcAngleToPlane(CelestialBody launchBody, double launchLatitud
double inc = Math.Abs(Vector3d.Angle(SwappedOrbitNormal(target), launchBody.angularVelocity));
Vector3d b = Vector3d.Exclude(launchBody.angularVelocity, SwappedOrbitNormal(target)).normalized; // I don't understand the sign here, but this seems to work
- b *= launchBody.Radius * Math.Sin(Math.PI / 180 * launchLatitude) / Math.Tan(Math.PI / 180 * inc);
+ b *= launchBody.Radius * Math.Sin(Units.DEG_TO_RAD * launchLatitude) / Math.Tan(Units.DEG_TO_RAD * inc);
Vector3d c = Vector3d.Cross(SwappedOrbitNormal(target), launchBody.angularVelocity).normalized;
- double cMagnitudeSquared = Math.Pow(launchBody.Radius * Math.Cos(Math.PI / 180 * launchLatitude), 2) - b.sqrMagnitude;
+ double cMagnitudeSquared = Math.Pow(launchBody.Radius * Math.Cos(Units.DEG_TO_RAD * launchLatitude), 2) - b.sqrMagnitude;
if (cMagnitudeSquared < 0) cMagnitudeSquared = 0;
c *= Math.Sqrt(cMagnitudeSquared);
Vector3d a1 = b + c;
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMajorAxis.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMajorAxis.cs
index c86d3875..de2e2e1b 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMajorAxis.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMajorAxis.cs
@@ -48,7 +48,8 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(Units.ToDistance(RendezvousProcessor.SemiMajorAxis, 3), section.IsHud);
+ int dec = section.IsHud ? HudDecimalPlaces : DecimalPlaces;
+ this.DrawLine(Units.ToDistance(RendezvousProcessor.SemiMajorAxis, dec < 0 ? 3 : dec), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMinorAxis.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMinorAxis.cs
index 5f87e196..21126e07 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMinorAxis.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/SemiMinorAxis.cs
@@ -48,7 +48,8 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(Units.ToDistance(RendezvousProcessor.SemiMajorAxis, 3), section.IsHud);
+ int dec = section.IsHud ? HudDecimalPlaces : DecimalPlaces;
+ this.DrawLine(Units.ToDistance(RendezvousProcessor.SemiMajorAxis, dec < 0 ? 3 : dec), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/SeparationAtClosestApproach.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/SeparationAtClosestApproach.cs
index 2c3965c9..4351c2f0 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/SeparationAtClosestApproach.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/SeparationAtClosestApproach.cs
@@ -42,9 +42,9 @@ public SeparationAtClosestApproach() {
public override void Draw(Unity.Flight.ISectionModule section) {
if (RendezvousProcessor.ShowDetails) {
if (double.IsNaN(RendezvousProcessor.SeparationAtEncounter))
- this.DrawLine("N/A", section.IsHud);
+ this.DrawLine("N/A", section);
else
- this.DrawLine(Units.ToDistance(RendezvousProcessor.SeparationAtEncounter), section.IsHud);
+ this.DrawLine(Units.ToDistance(RendezvousProcessor.SeparationAtEncounter, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/SpeedAtClosestApproach.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/SpeedAtClosestApproach.cs
index 0a306833..cf342392 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/SpeedAtClosestApproach.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/SpeedAtClosestApproach.cs
@@ -47,9 +47,9 @@ public override void Draw(Unity.Flight.ISectionModule section)
if (RendezvousProcessor.ShowDetails)
{
if (double.IsNaN(RendezvousProcessor.SpeedAtEncounter))
- this.DrawLine("N/A", section.IsHud);
+ this.DrawLine("N/A", section);
else
- this.DrawLine(RendezvousProcessor.SpeedAtEncounter.ToSpeed(), section.IsHud);
+ this.DrawLine(RendezvousProcessor.SpeedAtEncounter.ToSpeed(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/SurfaceDistanceToTarget.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/SurfaceDistanceToTarget.cs
new file mode 100644
index 00000000..f58cc27d
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/SurfaceDistanceToTarget.cs
@@ -0,0 +1,65 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2017 fat-lobyte
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Readouts.Surface;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Rendezvous
+{
+ public class SurfaceDistanceToTarget : ReadoutModule
+ {
+ #region Constructors
+
+ public SurfaceDistanceToTarget()
+ {
+ this.Name = "Distance (Surface)";
+ this.Category = ReadoutCategory.GetCategory("Rendezvous");
+ this.HelpString = "Great-circle distance from the current vessel to the target on the surface";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(Unity.Flight.ISectionModule section)
+ {
+ if (SurfaceDistanceProcessor.ShowTargetDetails)
+ {
+ this.DrawLine(SurfaceDistanceProcessor.TargetInSameSOI ? SurfaceDistanceProcessor.SurfaceDistanceToTarget.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces) : "Different SOI", section);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(SurfaceDistanceProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ SurfaceDistanceProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/TargetLatitude.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/TargetLatitude.cs
index e563a37d..185dfd5e 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TargetLatitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TargetLatitude.cs
@@ -48,10 +48,10 @@ public override void Draw(Unity.Flight.ISectionModule section) {
if (target != null) {
var vessel = target.GetVessel();
if (vessel == null) {
- DrawLine("N/A", section.IsHud);
+ DrawLine("N/A", section);
} else {
double latitude = AngleHelper.Clamp180(vessel.latitude);
- DrawLine(Units.ToAngleDMS(latitude) + (latitude < 0 ? " S" : " N"), section.IsHud);
+ DrawLine(Units.ToAngleDMS(latitude) + (latitude < 0 ? " S" : " N"), section);
}
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/TargetLongitude.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/TargetLongitude.cs
index e2a74c0f..03288bd6 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TargetLongitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TargetLongitude.cs
@@ -43,11 +43,11 @@ public override void Draw(Unity.Flight.ISectionModule section)
var vessel = target.GetVessel();
if(vessel == null)
{
- DrawLine("N/A", section.IsHud);
+ DrawLine("N/A", section);
} else
{
double longitude = AngleHelper.Clamp180(vessel.longitude);
- DrawLine(Units.ToAngleDMS(longitude) + (longitude < 0.0 ? " W" : " E"), section.IsHud);
+ DrawLine(Units.ToAngleDMS(longitude) + (longitude < 0.0 ? " W" : " E"), section);
}
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/TargetSelector.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/TargetSelector.cs
index 5682a61f..1b34e9b3 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TargetSelector.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TargetSelector.cs
@@ -22,6 +22,7 @@
using KerbalEngineer.Flight.Sections;
using UnityEngine;
+using static System.Collections.Specialized.BitVector32;
#endregion
@@ -262,22 +263,22 @@ private void DrawTarget(Unity.Flight.ISectionModule section) {
GUILayout.Space(3f);
- this.DrawLine("Selected Target", RendezvousProcessor.nameForTargetable(target), section.IsHud);
+ this.DrawLine("Selected Target", RendezvousProcessor.nameForTargetable(target), section);
try {
if (RendezvousProcessor.sourceDisplay != null) {
if (RendezvousProcessor.landedSamePlanet || RendezvousProcessor.overrideANDN)
- this.DrawLine("Ref Orbit", "Landed on " + RendezvousProcessor.activeVessel.GetOrbit().referenceBody.GetDisplayName().LocalizeRemoveGender(), section.IsHud);
+ this.DrawLine("Ref Orbit", "Landed on " + RendezvousProcessor.activeVessel.GetOrbit().referenceBody.GetDisplayName().LocalizeRemoveGender(), section);
else
- this.DrawLine("Ref Orbit", RendezvousProcessor.sourceDisplay, section.IsHud);
+ this.DrawLine("Ref Orbit", RendezvousProcessor.sourceDisplay, section);
}
if (RendezvousProcessor.targetDisplay != null) {
if (RendezvousProcessor.landedSamePlanet || RendezvousProcessor.overrideANDNRev)
- this.DrawLine("Target Orbit", "Landed on " + target.GetOrbit().referenceBody.GetDisplayName().LocalizeRemoveGender(), section.IsHud);
+ this.DrawLine("Target Orbit", "Landed on " + target.GetOrbit().referenceBody.GetDisplayName().LocalizeRemoveGender(), section);
else
- this.DrawLine("Target Orbit", RendezvousProcessor.targetDisplay, section.IsHud);
+ this.DrawLine("Target Orbit", RendezvousProcessor.targetDisplay, section);
}
} catch (System.Exception) {
@@ -311,7 +312,7 @@ private void DrawTargetList() {
}
if (count == 0) {
- this.DrawMessageLine("No targets found!");
+ this.DrawMessageLine("No targets found!", Unity.Flight.OOPSux.DEFAULT_SECTION_WIDTH);
}
if (count != this.targetCount) {
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeTilClosestApproach.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeTilClosestApproach.cs
index 1e7436a4..4b267e62 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeTilClosestApproach.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeTilClosestApproach.cs
@@ -47,9 +47,9 @@ public override void Draw(Unity.Flight.ISectionModule section)
if (RendezvousProcessor.ShowDetails)
{
if (double.IsNaN(RendezvousProcessor.TimeTilEncounter))
- this.DrawLine("N/A", section.IsHud);
+ this.DrawLine("N/A", section);
else
- this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeTilEncounter), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeTilEncounter), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToApoapsis.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToApoapsis.cs
index 42dc12de..a056c594 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToApoapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToApoapsis.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToApoapsis), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToApoapsis), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToPeriapsis.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToPeriapsis.cs
index 795edefe..f02f8914 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToPeriapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToPeriapsis.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToPeriapsis), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToPeriapsis), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeAscendingNode.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeAscendingNode.cs
index 0ec78b3e..73c8a8e9 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeAscendingNode.cs
@@ -50,11 +50,11 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
double time = RendezvousProcessor.TimeToPlane[0];
- this.DrawLine("(L) " + TimeFormatter.ConvertToString(time), section.IsHud);
+ this.DrawLine("(L) " + TimeFormatter.ConvertToString(time), section);
}
else
{
- this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToAscendingNode), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToAscendingNode), section);
}
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeDescendingNode.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeDescendingNode.cs
index e2a4f17b..21fb0b02 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeDescendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToRelativeDescendingNode.cs
@@ -50,11 +50,11 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
double time = RendezvousProcessor.TimeToPlane[1];
- this.DrawLine("(L) " + TimeFormatter.ConvertToString(time), section.IsHud);
+ this.DrawLine("(L) " + TimeFormatter.ConvertToString(time), section);
}
else
{
- this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToDescendingNode), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToDescendingNode), section);
}
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToTransferAngle.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToTransferAngle.cs
index c9f4a4b4..1a382457 100644
--- a/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToTransferAngle.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/TimeToTransferAngle.cs
@@ -47,7 +47,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (RendezvousProcessor.ShowDetails)
{
- this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToTransferAngle), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToTransferAngle), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/AltitudeSeaLevel.cs b/KerbalEngineer/Flight/Readouts/Surface/AltitudeSeaLevel.cs
index a4bac567..f66fdbda 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/AltitudeSeaLevel.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/AltitudeSeaLevel.cs
@@ -33,6 +33,7 @@ public class AltitudeSeaLevel : ReadoutModule
public AltitudeSeaLevel()
{
this.Name = "Altitude (Sea Level)";
+ this.ShortName = "Alt (S)";
this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = "Shows the vessel's altitude above sea level.";
this.IsDefault = false;
@@ -44,7 +45,7 @@ public AltitudeSeaLevel()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ship_altitude.ToDistance(), section.IsHud);
+ this.DrawLine(FlightGlobals.ship_altitude.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Surface/AltitudeTerrain.cs b/KerbalEngineer/Flight/Readouts/Surface/AltitudeTerrain.cs
index 73aa7b7c..af4eca0e 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/AltitudeTerrain.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/AltitudeTerrain.cs
@@ -27,6 +27,7 @@ public class AltitudeTerrain : ReadoutModule
public AltitudeTerrain()
{
Name = "Altitude (Terrain)";
+ ShortName = "Alt (T)";
Category = ReadoutCategory.GetCategory("Surface");
HelpString = "Shows the vessel's altitude above the terrain and water's surface, or altitude above underwater terrain whilst splashed down.";
IsDefault = true;
@@ -38,11 +39,11 @@ public override void Draw(Unity.Flight.ISectionModule section)
|| FlightGlobals.ActiveVessel.situation == Vessel.Situations.SPLASHED
|| FlightGlobals.ActiveVessel.situation == Vessel.Situations.LANDED)
{
- DrawLine((FlightGlobals.ship_altitude - FlightGlobals.ActiveVessel.terrainAltitude).ToDistance(), section.IsHud);
+ DrawLine((FlightGlobals.ship_altitude - FlightGlobals.ActiveVessel.terrainAltitude).ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
else
{
- DrawLine((FlightGlobals.ship_altitude).ToDistance(), section.IsHud);
+ DrawLine((FlightGlobals.ship_altitude).ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/AtmosphericEfficiency.cs b/KerbalEngineer/Flight/Readouts/Surface/AtmosphericEfficiency.cs
index cdcd62ec..ef8c77df 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/AtmosphericEfficiency.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/AtmosphericEfficiency.cs
@@ -27,6 +27,7 @@ public class AtmosphericEfficiency : ReadoutModule
public AtmosphericEfficiency()
{
Name = "Atmos. Efficiency";
+ ShortName = "Atmo Eff";
Category = ReadoutCategory.GetCategory("Surface");
HelpString = "Shows you vessel's efficiency as a ratio of the current velocity and terminal velocity. Less than 100% means that you are losing efficiency due to gravity and greater than 100% is due to drag.";
IsDefault = false;
@@ -36,7 +37,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (AtmosphericProcessor.ShowDetails)
{
- DrawLine(AtmosphericProcessor.Efficiency.ToPercent(), section.IsHud);
+ DrawLine(AtmosphericProcessor.Efficiency.ToPercent(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/AtmosphericPressure.cs b/KerbalEngineer/Flight/Readouts/Surface/AtmosphericPressure.cs
index 17094375..5411b472 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/AtmosphericPressure.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/AtmosphericPressure.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (AtmosphericProcessor.ShowDetails)
{
- DrawLine(AtmosphericProcessor.StaticPressure.ToPressure(), section.IsHud);
+ DrawLine(AtmosphericProcessor.StaticPressure.ToPressure(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/BearingToWaypoint.cs b/KerbalEngineer/Flight/Readouts/Surface/BearingToWaypoint.cs
new file mode 100644
index 00000000..6a08a47e
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Surface/BearingToWaypoint.cs
@@ -0,0 +1,66 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2017 fat-lobyte
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Readouts.Surface;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Rendezvous
+{
+ public class BearingToWaypoint : ReadoutModule
+ {
+ #region Constructors
+
+ public BearingToWaypoint()
+ {
+ this.Name = "Bearing to Waypoint";
+ this.Category = ReadoutCategory.GetCategory("Surface");
+ this.HelpString = "Bearing to the waypoint along the surface";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(Unity.Flight.ISectionModule section)
+ {
+ if (SurfaceDistanceProcessor.ShowWaypointDetails)
+ {
+ this.DrawLine(SurfaceDistanceProcessor.SurfaceBearingToWaypoint.ToAngle(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(SurfaceDistanceProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ SurfaceDistanceProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Surface/Biome.cs b/KerbalEngineer/Flight/Readouts/Surface/Biome.cs
index 701b2dc8..e66a2634 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/Biome.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Biome.cs
@@ -32,6 +32,7 @@ public class Biome : ReadoutModule
public Biome()
{
this.Name = "Biome";
+ this.ShortName = "Bio";
this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = "Shows the biome which the vessel is currently flying over.";
this.IsDefault = true;
@@ -45,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
var biome = ScienceUtil.GetExperimentBiome(FlightGlobals.ActiveVessel.mainBody, FlightGlobals.ActiveVessel.latitude, FlightGlobals.ActiveVessel.longitude);
biome = ScienceUtil.GetBiomedisplayName(FlightGlobals.ActiveVessel.mainBody, biome);
- this.DrawLine(biome, section.IsHud);
+ this.DrawLine(biome, section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Surface/DynamicPressure.cs b/KerbalEngineer/Flight/Readouts/Surface/DynamicPressure.cs
index a1627ec2..8796e9a1 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/DynamicPressure.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/DynamicPressure.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (AtmosphericProcessor.ShowDetails)
{
- DrawLine(AtmosphericProcessor.DynamicPressure.ToPressure(), section.IsHud);
+ DrawLine(AtmosphericProcessor.DynamicPressure.ToPressure(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/GeeForce.cs b/KerbalEngineer/Flight/Readouts/Surface/GeeForce.cs
index 86947cec..92974abf 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/GeeForce.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/GeeForce.cs
@@ -53,15 +53,16 @@ public override void Draw(Unity.Flight.ISectionModule section) {
}
this.DrawLine(() => {
- if(!section.IsHud)
+ if (!section.IsHud)
GUILayout.Label(FlightGlobals.ship_geeForce.ToString("F3") + " / " + this.maxGeeForce.ToString("F3"), this.ValueStyle);
else
- GUILayout.Label(FlightGlobals.ship_geeForce.ToString("F3") + " / " + this.maxGeeForce.ToString("F3"), this.ValueStyle, GUILayout.Height(ValueStyle.fontSize*1.2f));
+ GUILayout.Label(FlightGlobals.ship_geeForce.ToString("F3") + " / " + this.maxGeeForce.ToString("F3"), this.HudValueStyle, GUILayout.Height(HudValueStyle.fontSize * 1.2f));
+
if (GUILayout.Button("R", section.IsHud ? this.CompactButtonStyle : this.ButtonStyle,
GUILayout.Width(ButtonStyle.fixedHeight))) {
this.maxGeeForce = 0.0;
}
- }, true, section.IsHud);
+ }, section, true);
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/HorizontalAcceleration.cs b/KerbalEngineer/Flight/Readouts/Surface/HorizontalAcceleration.cs
index 8ecec68a..20372a52 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/HorizontalAcceleration.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/HorizontalAcceleration.cs
@@ -40,6 +40,7 @@ public class HorizontalAcceleration : ReadoutModule
public HorizontalAcceleration()
{
this.Name = "Horizontal Acceleration";
+ this.ShortName = "HAccel";
this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = "Shows the vessel's horizontal acceleration across a celestial body's surface.";
this.IsDefault = false;
@@ -51,7 +52,7 @@ public HorizontalAcceleration()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(this.acceleration.ToAcceleration(), section.IsHud);
+ this.DrawLine(this.acceleration.ToAcceleration(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void FixedUpdate()
diff --git a/KerbalEngineer/Flight/Readouts/Surface/HorizontalSpeed.cs b/KerbalEngineer/Flight/Readouts/Surface/HorizontalSpeed.cs
index 712885e9..cbb8b686 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/HorizontalSpeed.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/HorizontalSpeed.cs
@@ -34,6 +34,7 @@ public class HorizontalSpeed : ReadoutModule
public HorizontalSpeed()
{
this.Name = "Horizontal Speed";
+ this.ShortName = "HSpeed";
this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = "Shows the vessel's horizontal speed across a celestial body's surface.";
this.IsDefault = true;
@@ -45,12 +46,12 @@ public HorizontalSpeed()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ActiveVessel.horizontalSrfSpeed.ToSpeed(), section.IsHud);
+ this.DrawLine(FlightGlobals.ActiveVessel.horizontalSrfSpeed.ToSpeed(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
// This workaround was used for KSP 1.0.3 and 1.0.4 where horizontalSrfSpeed was really badly broken
//var ves = FlightGlobals.ActiveVessel;
//double horizSpeed = Math.Sqrt(ves.srfSpeed * ves.srfSpeed - ves.verticalSpeed * ves.verticalSpeed);
- //this.DrawLine(horizSpeed.ToSpeed(), section.IsHud);
+ //this.DrawLine(horizSpeed.ToSpeed(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Surface/ImpactAltitude.cs b/KerbalEngineer/Flight/Readouts/Surface/ImpactAltitude.cs
index c9e17bd5..8fd19883 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactAltitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactAltitude.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ImpactProcessor.ShowDetails)
{
- this.DrawLine(ImpactProcessor.Altitude.ToDistance(), section.IsHud);
+ this.DrawLine(ImpactProcessor.Altitude.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/ImpactBiome.cs b/KerbalEngineer/Flight/Readouts/Surface/ImpactBiome.cs
index e484d394..8442e3c7 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactBiome.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactBiome.cs
@@ -45,7 +45,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ImpactProcessor.ShowDetails)
{
- this.DrawLine(ImpactProcessor.Biome, section.IsHud);
+ this.DrawLine(ImpactProcessor.Biome, section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/ImpactLatitude.cs b/KerbalEngineer/Flight/Readouts/Surface/ImpactLatitude.cs
index eefc97b1..7947840a 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactLatitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactLatitude.cs
@@ -47,7 +47,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ImpactProcessor.ShowDetails)
{
- this.DrawLine(Units.ToAngleDMS(ImpactProcessor.Latitude) + (ImpactProcessor.Latitude < 0 ? " S" : " N"), section.IsHud);
+ this.DrawLine(Units.ToAngleDMS(ImpactProcessor.Latitude) + (ImpactProcessor.Latitude < 0 ? " S" : " N"), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/ImpactLongitude.cs b/KerbalEngineer/Flight/Readouts/Surface/ImpactLongitude.cs
index 795e64f2..66365c5e 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactLongitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactLongitude.cs
@@ -47,7 +47,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ImpactProcessor.ShowDetails)
{
- this.DrawLine(Units.ToAngleDMS(ImpactProcessor.Longitude) + (ImpactProcessor.Longitude < 0.0 ? " W" : " E"), section.IsHud);
+ this.DrawLine(Units.ToAngleDMS(ImpactProcessor.Longitude) + (ImpactProcessor.Longitude < 0.0 ? " W" : " E"), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/ImpactMarker.cs b/KerbalEngineer/Flight/Readouts/Surface/ImpactMarker.cs
index d0bc3681..90c62fba 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactMarker.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactMarker.cs
@@ -48,7 +48,7 @@ public override void Draw(Unity.Flight.ISectionModule section) {
GUILayout.Width(this.ContentWidth / 4), GUILayout.Height(s.fixedHeight))) {
show = !show;
}
- },true, section.IsHud);
+ }, section, true);
}
}
@@ -59,7 +59,7 @@ public override void Reset() {
}
public override void Update() {
- if(show)
+ if (show)
FlightEngineerCore.markerDeadman = 2;
ImpactProcessor.RequestUpdate();
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/ImpactProcessor.cs b/KerbalEngineer/Flight/Readouts/Surface/ImpactProcessor.cs
index b370db96..8da1051e 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactProcessor.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactProcessor.cs
@@ -153,7 +153,7 @@ public void Update() {
int side = 1;
- double startangle = vessel.GetOrbit().trueAnomaly * 180 / Math.PI;
+ double startangle = vessel.GetOrbit().trueAnomaly * Units.RAD_TO_DEG;
if (startangle > 0) startangle = -360 + startangle;
double endangle = startangle + 360;
@@ -276,7 +276,7 @@ public void Update() {
try {
Biome = ScienceUtil.GetExperimentBiome(body, impactLatitude, impactLongitude);
Biome = ScienceUtil.GetBiomedisplayName(body, Biome);
- } catch (Exception ex) { //this gets spammy with misbehaving mod planets.
+ } catch (Exception) { //this gets spammy with misbehaving mod planets.
Biome = "";
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/ImpactTime.cs b/KerbalEngineer/Flight/Readouts/Surface/ImpactTime.cs
index 9504a7d9..f523716c 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactTime.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactTime.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ImpactProcessor.ShowDetails)
{
- this.DrawLine(TimeFormatter.ConvertToString(ImpactProcessor.Time), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(ImpactProcessor.Time), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/Latitude.cs b/KerbalEngineer/Flight/Readouts/Surface/Latitude.cs
index 49d57be5..5ed13584 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/Latitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Latitude.cs
@@ -44,7 +44,7 @@ public Latitude()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToAngleDMS(FlightGlobals.ship_latitude) + (FlightGlobals.ship_latitude < 0 ? " S" : " N"), section.IsHud);
+ this.DrawLine(Units.ToAngleDMS(FlightGlobals.ship_latitude) + (FlightGlobals.ship_latitude < 0 ? " S" : " N"), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs b/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
index 6b50c1e2..f56a9cb3 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
@@ -35,7 +35,7 @@ public Longitude()
public override void Draw(Unity.Flight.ISectionModule section)
{
double angle = AngleHelper.Clamp180(FlightGlobals.ship_longitude);
- DrawLine(Units.ToAngleDMS(angle) + (angle < 0.0 ? " W" : " E"), section.IsHud);
+ DrawLine(Units.ToAngleDMS(angle) + (angle < 0.0 ? " W" : " E"), section);
}
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Surface/MachNumber.cs b/KerbalEngineer/Flight/Readouts/Surface/MachNumber.cs
index a4bef6c2..ff90f3d1 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/MachNumber.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/MachNumber.cs
@@ -27,6 +27,7 @@ public class MachNumber : ReadoutModule
public MachNumber()
{
Name = "Mach Number";
+ ShortName = "Mach";
Category = ReadoutCategory.GetCategory("Surface");
HelpString = "Shows the vessel's mach number.";
IsDefault = true;
@@ -36,7 +37,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (FlightGlobals.ActiveVessel.atmDensity > 0.0)
{
- DrawLine(FlightGlobals.ActiveVessel.mach.ToMach(), section.IsHud);
+ DrawLine(FlightGlobals.ActiveVessel.mach.ToMach(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/Situation.cs b/KerbalEngineer/Flight/Readouts/Surface/Situation.cs
index d45682ed..b9dbc6b9 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/Situation.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Situation.cs
@@ -32,6 +32,7 @@ public class Situation : ReadoutModule
public Situation()
{
this.Name = "Situation";
+ this.ShortName = "Sit";
this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = "Shows the vessel's current scientific situation. (Landed, Splashed, Flying Low/High, In Space Low/High)";
this.IsDefault = true;
@@ -46,27 +47,27 @@ public override void Draw(Unity.Flight.ISectionModule section)
switch (ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel))
{
case ExperimentSituations.SrfLanded:
- this.DrawLine("Landed", section.IsHud);
+ this.DrawLine("Landed", section);
break;
case ExperimentSituations.SrfSplashed:
- this.DrawLine("Splashed", section.IsHud);
+ this.DrawLine("Splashed", section);
break;
case ExperimentSituations.FlyingLow:
- this.DrawLine("Flying Low", section.IsHud);
+ this.DrawLine("Flying Low", section);
break;
case ExperimentSituations.FlyingHigh:
- this.DrawLine("Flying High", section.IsHud);
+ this.DrawLine("Flying High", section);
break;
case ExperimentSituations.InSpaceLow:
- this.DrawLine("In Space Low", section.IsHud);
+ this.DrawLine("In Space Low", section);
break;
case ExperimentSituations.InSpaceHigh:
- this.DrawLine("In Space High", section.IsHud);
+ this.DrawLine("In Space High", section);
break;
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/Slope.cs b/KerbalEngineer/Flight/Readouts/Surface/Slope.cs
index 8658b13e..b4fb1100 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/Slope.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Slope.cs
@@ -48,7 +48,7 @@ public Slope()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(this.GetSlopeAngleAndHeading(), section.IsHud);
+ this.DrawLine(this.GetSlopeAngleAndHeading(), section);
}
#endregion
@@ -76,7 +76,7 @@ private string GetSlopeAngleAndHeading()
{
raddotnorm = 0.0;
}
- var slope = Math.Acos(raddotnorm) * 180 / Math.PI;
+ var slope = Math.Acos(raddotnorm) * Units.RAD_TO_DEG;
result = Units.ToAngle(slope, 1);
if (slope < 0.05)
{
@@ -88,13 +88,10 @@ private string GetSlopeAngleAndHeading()
var east = Vector3d.Cross(rad, Vector3d.up).normalized;
var north = Vector3d.Cross(rad, east).normalized;
var sidedoteast = Vector3d.Dot(side, east);
- var direction = Math.Acos(sidedoteast) * 180 / Math.PI;
+ var direction = Math.Acos(sidedoteast) * Units.RAD_TO_DEG;
var sidedotnorth = Vector3d.Dot(side, north);
- if (sidedotnorth < 0)
- {
- direction = 360 - direction;
- }
- result += " @ " + Units.ToAngle(direction, 1);
+ if (sidedotnorth < 0) direction = 360 - direction;
+ result += " @ " + Units.ToAngle(direction, 1).PadLeft(5);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/SurfaceDistanceProcessor.cs b/KerbalEngineer/Flight/Readouts/Surface/SurfaceDistanceProcessor.cs
new file mode 100644
index 00000000..9de5fa7a
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Surface/SurfaceDistanceProcessor.cs
@@ -0,0 +1,173 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2017 fat-lobyte
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using System;
+using KerbalEngineer.Helpers;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Surface
+{
+ public class SurfaceDistanceProcessor : IUpdatable, IUpdateRequest
+ {
+ ///
+ /// Gets the current instance of the rendezvous processor.
+ ///
+ public static SurfaceDistanceProcessor Instance
+ {
+ get { return instance; }
+ }
+
+
+ ///
+ /// Gets whether a target or waypoint are active.
+ ///
+ public static bool ShowTargetDetails { get; private set; }
+ public static bool ShowWaypointDetails { get; private set; }
+
+ ///
+ /// Gets whether the target is in the same sphere-of-influence as us. If not, we don't calculate the bearing and distance.
+ ///
+ public static bool TargetInSameSOI { get; private set; }
+
+
+ ///
+ /// Gets and sets whether the updatable object should be updated.
+ ///
+ public bool UpdateRequested { get; set; }
+
+ private static readonly SurfaceDistanceProcessor instance = new SurfaceDistanceProcessor();
+
+ ///
+ /// Gets the great-circle distance from the current vessel to the target on the surface.
+ ///
+ public static double SurfaceDistanceToTarget { get; private set; }
+
+ ///
+ /// Gets the initial bearing on the great-circle from the origin position to the target position on the surface.
+ ///
+ public static double SurfaceBearingToTarget { get; private set; }
+
+ ///
+ /// Gets the great-circle distance from the current vessel to the waypoint position on the surface.
+ ///
+ public static double SurfaceDistanceToWaypoint { get; private set; }
+
+ ///
+ /// Gets the initial bearing on the great-circle current vessel to the waypoint position on the surface.
+ ///
+ public static double SurfaceBearingToWaypoint { get; private set; }
+
+ ///
+ /// Request and update to calculate the details.
+ ///
+ public static void RequestUpdate()
+ {
+ instance.UpdateRequested = true;
+ }
+
+ ///
+ /// Updates the details by recalculating if requested.
+ ///
+ public void Update()
+ {
+ // get vessel and navigation waypoints
+ global::Vessel targetVessel = FlightGlobals.fetch?.VesselTarget?.GetVessel();
+ FinePrint.Waypoint navigationWaypoint = FlightGlobals.ActiveVessel?.navigationWaypoint;
+
+ ShowTargetDetails = FlightGlobals.ActiveVessel != null && targetVessel != null;
+ ShowWaypointDetails = FlightGlobals.ActiveVessel != null && navigationWaypoint != null;
+
+ double originLat = FlightGlobals.ActiveVessel.latitude;
+ double originLon = FlightGlobals.ActiveVessel.longitude;
+
+ if (ShowTargetDetails)
+ {
+ if (targetVessel.mainBody != FlightGlobals.ActiveVessel.mainBody) { //todo - it's still probably useful to calculate these even when it's in a different SOI, at least the bearing, the distance won't work for either targets or waypoints; also check that navigationWaypoint.latitude/longitude are always in reference to the current SOI of the vessel
+ TargetInSameSOI = false;
+ } else {
+ TargetInSameSOI = true;
+
+ double targetLat = targetVessel.mainBody.GetLatitude(targetVessel.GetWorldPos3D());
+ double targetLon = targetVessel.mainBody.GetLongitude(targetVessel.GetWorldPos3D());
+
+ SurfaceDistanceToTarget = CalcSurfaceDistance(FlightGlobals.ActiveVessel.mainBody.Radius,
+ originLat, originLon,
+ targetLat, targetLon);
+
+ SurfaceBearingToTarget = CalcSurfaceBearingToTarget(originLat, originLon,
+ targetLat, targetLon);
+ }
+ }
+
+ if (ShowWaypointDetails)
+ {
+ SurfaceDistanceToWaypoint = CalcSurfaceDistance(FlightGlobals.ActiveVessel.mainBody.Radius,
+ originLat, originLon,
+ navigationWaypoint.latitude, navigationWaypoint.longitude);
+
+ SurfaceBearingToWaypoint = CalcSurfaceBearingToTarget(originLat, originLon,
+ navigationWaypoint.latitude, navigationWaypoint.longitude);
+ }
+ }
+
+
+
+ ///
+ /// Calculate the shortest great-circle distance between two points on a sphere which are given by latitude and longitude.
+ ///
+ /// https://en.wikipedia.org/wiki/Haversine_formula
+ ///
+ /// Radius of the sphere in meters
+ /// Latitude of the origin of the distance, in degrees
+ /// Longitude of the origin of the distance, in degrees
+ /// Latitude of the destination of the distance, in degrees
+ /// Longitude of the destination of the distance, in degrees
+ /// Distance between origin and source in meters
+ private static double CalcSurfaceDistance(
+ double bodyRadius,
+ double originLatitude, double originLongitude,
+ double targetLatitude, double targetLongitude)
+ {
+ double sin1 = Math.Sin(Units.DEG_TO_RAD * (originLatitude - targetLatitude) / 2);
+ double sin2 = Math.Sin(Units.DEG_TO_RAD * (originLongitude - targetLongitude) / 2);
+ double cos1 = Math.Cos(Units.DEG_TO_RAD * targetLatitude);
+ double cos2 = Math.Cos(Units.DEG_TO_RAD * originLatitude);
+
+ return 2 * bodyRadius * Math.Asin(Math.Sqrt(sin1 * sin1 + cos1 * cos2 * sin2 * sin2));
+ }
+
+ private static double CalcSurfaceBearingToTarget(
+ double originLatitude, double originLongitude,
+ double targetLatitude, double targetLongitude)
+ {
+ double olat = Units.DEG_TO_RAD * originLatitude,
+ olon = Units.DEG_TO_RAD * originLongitude,
+ tlat = Units.DEG_TO_RAD * targetLatitude,
+ tlon = Units.DEG_TO_RAD * targetLongitude;
+
+ double y = Math.Sin(tlon - olon) * Math.Cos(tlat);
+ double x = (Math.Cos(olat) * Math.Sin(tlat)) - (Math.Sin(olat) * Math.Cos(tlat) * Math.Cos(tlon - olon));
+ double requiredBearing = Math.Atan2(y, x) * Units.RAD_TO_DEG;
+ return (requiredBearing + 360.0) % 360.0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Surface/SurfaceDistanceToWaypoint.cs b/KerbalEngineer/Flight/Readouts/Surface/SurfaceDistanceToWaypoint.cs
new file mode 100644
index 00000000..dec4cae6
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Surface/SurfaceDistanceToWaypoint.cs
@@ -0,0 +1,65 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2017 fat-lobyte
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Readouts.Surface;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Rendezvous
+{
+ public class SurfaceDistanceToWaypoint : ReadoutModule
+ {
+ #region Constructors
+
+ public SurfaceDistanceToWaypoint()
+ {
+ this.Name = "Distance to Waypoint (Surface)";
+ this.Category = ReadoutCategory.GetCategory("Surface");
+ this.HelpString = "Great-circle distance from the current vessel to the waypoint on the surface";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(Unity.Flight.ISectionModule section)
+ {
+ if (SurfaceDistanceProcessor.ShowWaypointDetails)
+ {
+ this.DrawLine(SurfaceDistanceProcessor.SurfaceDistanceToWaypoint.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
+ }
+ }
+
+ public override void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(SurfaceDistanceProcessor.Instance);
+ }
+
+ public override void Update()
+ {
+ SurfaceDistanceProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Surface/TerminalVelocity.cs b/KerbalEngineer/Flight/Readouts/Surface/TerminalVelocity.cs
index 98cd0f7f..fbb2c571 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/TerminalVelocity.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/TerminalVelocity.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (AtmosphericProcessor.ShowDetails)
{
- this.DrawLine(AtmosphericProcessor.TerminalVelocity.ToSpeed(), section.IsHud);
+ this.DrawLine(AtmosphericProcessor.TerminalVelocity.ToSpeed(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Surface/VerticalAcceleration.cs b/KerbalEngineer/Flight/Readouts/Surface/VerticalAcceleration.cs
index fc14032a..8070894e 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/VerticalAcceleration.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/VerticalAcceleration.cs
@@ -40,6 +40,7 @@ public class VerticalAcceleration : ReadoutModule
public VerticalAcceleration()
{
this.Name = "Vertical Acceleration";
+ this.ShortName = "VAccel";
this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = "Shows the vessel's vertical acceleration up and down.";
this.IsDefault = false;
@@ -51,7 +52,7 @@ public VerticalAcceleration()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(this.acceleration.ToAcceleration(), section.IsHud);
+ this.DrawLine(this.acceleration.ToAcceleration(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void FixedUpdate()
diff --git a/KerbalEngineer/Flight/Readouts/Surface/VerticalSpeed.cs b/KerbalEngineer/Flight/Readouts/Surface/VerticalSpeed.cs
index fd8ad2d3..4b77d5bf 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/VerticalSpeed.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/VerticalSpeed.cs
@@ -33,6 +33,7 @@ public class VerticalSpeed : ReadoutModule
public VerticalSpeed()
{
this.Name = "Vertical Speed";
+ this.ShortName = "VSpeed";
this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = "Shows the vessel's vertical speed up and down.";
this.IsDefault = true;
@@ -44,7 +45,7 @@ public VerticalSpeed()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(FlightGlobals.ship_verticalSpeed.ToSpeed(), section.IsHud);
+ this.DrawLine(FlightGlobals.ship_verticalSpeed.ToSpeed(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/ConvectionFlux.cs b/KerbalEngineer/Flight/Readouts/Thermal/ConvectionFlux.cs
index ab8db0b7..42db1067 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/ConvectionFlux.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/ConvectionFlux.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails && FlightGlobals.ActiveVessel.atmDensity > 0.0)
{
- DrawLine(ThermalProcessor.ConvectionFlux.ToFlux(), section.IsHud);
+ DrawLine(ThermalProcessor.ConvectionFlux.ToFlux(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/CoolestPart.cs b/KerbalEngineer/Flight/Readouts/Thermal/CoolestPart.cs
index 9201b1a7..23e83cfa 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/CoolestPart.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CoolestPart.cs
@@ -35,7 +35,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(ThermalProcessor.CoolestPartName, section.IsHud);
+ DrawLine(ThermalProcessor.CoolestPartName, section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/CoolestSkinTemperature.cs b/KerbalEngineer/Flight/Readouts/Thermal/CoolestSkinTemperature.cs
index 2de44e49..da177ce6 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/CoolestSkinTemperature.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CoolestSkinTemperature.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(Units.ToTemperature(ThermalProcessor.CoolestSkinTemperature, ThermalProcessor.CoolestSkinTemperatureMax), section.IsHud);
+ DrawLine(Units.ToTemperature(ThermalProcessor.CoolestSkinTemperature, ThermalProcessor.CoolestSkinTemperatureMax), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/CoolestTemperature.cs b/KerbalEngineer/Flight/Readouts/Thermal/CoolestTemperature.cs
index 60b5fe6d..4a826a34 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/CoolestTemperature.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CoolestTemperature.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(Units.ToTemperature(ThermalProcessor.CoolestTemperature, ThermalProcessor.CoolestTemperatureMax), section.IsHud);
+ DrawLine(Units.ToTemperature(ThermalProcessor.CoolestTemperature, ThermalProcessor.CoolestTemperatureMax), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/CriticalPart.cs b/KerbalEngineer/Flight/Readouts/Thermal/CriticalPart.cs
index 4007a2a9..d6f73ef9 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/CriticalPart.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CriticalPart.cs
@@ -26,6 +26,7 @@ public class CriticalPart : ReadoutModule
public CriticalPart()
{
Name = "Critical Part";
+ ShortName = "Crit Part";
Category = ReadoutCategory.GetCategory("Thermal");
HelpString = "This part is structually most critical. If it endures too high temperature there is a high chance for major structual failure!";
IsDefault = true;
@@ -35,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(ThermalProcessor.CriticalPartName, section.IsHud);
+ DrawLine(ThermalProcessor.CriticalPartName, section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/CriticalSkinTemperature.cs b/KerbalEngineer/Flight/Readouts/Thermal/CriticalSkinTemperature.cs
index 2888a8b7..82bc2583 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/CriticalSkinTemperature.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CriticalSkinTemperature.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(Units.ToTemperature(ThermalProcessor.CriticalSkinTemperature, ThermalProcessor.CriticalSkinTemperatureMax), section.IsHud);
+ DrawLine(Units.ToTemperature(ThermalProcessor.CriticalSkinTemperature, ThermalProcessor.CriticalSkinTemperatureMax), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/CriticalTemperature.cs b/KerbalEngineer/Flight/Readouts/Thermal/CriticalTemperature.cs
index b51f790a..4a982b40 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/CriticalTemperature.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CriticalTemperature.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(Units.ToTemperature(ThermalProcessor.CriticalTemperature, ThermalProcessor.CriticalTemperatureMax), section.IsHud);
+ DrawLine(Units.ToTemperature(ThermalProcessor.CriticalTemperature, ThermalProcessor.CriticalTemperatureMax), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/CriticalThermalPercentage.cs b/KerbalEngineer/Flight/Readouts/Thermal/CriticalThermalPercentage.cs
index acb951b8..ceb55e2f 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/CriticalThermalPercentage.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/CriticalThermalPercentage.cs
@@ -27,6 +27,7 @@ public class CriticalThermalPercentage : ReadoutModule
public CriticalThermalPercentage()
{
Name = "Critical Thermal Percentage";
+ ShortName = "Crit Therm";
Category = ReadoutCategory.GetCategory("Thermal");
HelpString = "Shows how high a temperature the critical Part is enduring relative to it's maximal temperature.";
IsDefault = true;
@@ -36,7 +37,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(ThermalProcessor.CriticalTemperaturePercentage.ToPercent(), section.IsHud);
+ DrawLine(ThermalProcessor.CriticalTemperaturePercentage.ToPercent(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/HottestPart.cs b/KerbalEngineer/Flight/Readouts/Thermal/HottestPart.cs
index edf67f97..bcdc1f55 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/HottestPart.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/HottestPart.cs
@@ -35,7 +35,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(ThermalProcessor.HottestPartName, section.IsHud);
+ DrawLine(ThermalProcessor.HottestPartName, section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/HottestSkinTemperature.cs b/KerbalEngineer/Flight/Readouts/Thermal/HottestSkinTemperature.cs
index f55b65e7..19c1c72c 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/HottestSkinTemperature.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/HottestSkinTemperature.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(Units.ToTemperature(ThermalProcessor.HottestSkinTemperature, ThermalProcessor.HottestSkinTemperatureMax), section.IsHud);
+ DrawLine(Units.ToTemperature(ThermalProcessor.HottestSkinTemperature, ThermalProcessor.HottestSkinTemperatureMax), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/HottestTemperature.cs b/KerbalEngineer/Flight/Readouts/Thermal/HottestTemperature.cs
index 103b3519..4d8fa742 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/HottestTemperature.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/HottestTemperature.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(Units.ToTemperature(ThermalProcessor.HottestTemperature, ThermalProcessor.HottestTemperatureMax), section.IsHud);
+ DrawLine(Units.ToTemperature(ThermalProcessor.HottestTemperature, ThermalProcessor.HottestTemperatureMax), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/InternalFlux.cs b/KerbalEngineer/Flight/Readouts/Thermal/InternalFlux.cs
index 51865686..e7c696fb 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/InternalFlux.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/InternalFlux.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(ThermalProcessor.InternalFlux.ToFlux(), section.IsHud);
+ DrawLine(ThermalProcessor.InternalFlux.ToFlux(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Thermal/RadiationFlux.cs b/KerbalEngineer/Flight/Readouts/Thermal/RadiationFlux.cs
index 08fb94e1..e4bddb9b 100644
--- a/KerbalEngineer/Flight/Readouts/Thermal/RadiationFlux.cs
+++ b/KerbalEngineer/Flight/Readouts/Thermal/RadiationFlux.cs
@@ -36,7 +36,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (ThermalProcessor.ShowDetails)
{
- DrawLine(ThermalProcessor.RadiationFlux.ToFlux(), section.IsHud);
+ DrawLine(ThermalProcessor.RadiationFlux.ToFlux(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Acceleration.cs b/KerbalEngineer/Flight/Readouts/Vessel/Acceleration.cs
index f2c42c8b..41c1dd0c 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/Acceleration.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Acceleration.cs
@@ -48,7 +48,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
double a_Acceleration = Vessel.SimulationProcessor.LastStage.totalMass > 0 ? Vessel.SimulationProcessor.LastStage.actualThrust / Vessel.SimulationProcessor.LastStage.totalMass : 0;
double m_Acceleration = Vessel.SimulationProcessor.LastStage.totalMass > 0 ? Vessel.SimulationProcessor.LastStage.thrust / Vessel.SimulationProcessor.LastStage.totalMass : 0;
- this.DrawLine(Units.ToAcceleration(a_Acceleration, m_Acceleration), section.IsHud);
+ this.DrawLine(Units.ToAcceleration(a_Acceleration, m_Acceleration, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/AngleOfAttack.cs b/KerbalEngineer/Flight/Readouts/Vessel/AngleOfAttack.cs
new file mode 100644
index 00000000..b887fa6d
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/AngleOfAttack.cs
@@ -0,0 +1,58 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ #region Using Directives
+
+ using Helpers;
+
+ #endregion
+
+ public class AngleOfAttack : ReadoutModule
+ {
+ #region Constructors
+
+ public AngleOfAttack() {
+ this.Name = "Angle-of-Attack";
+ this.ShortName = "AoA";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "The angle between velocity and the vessel's fuselage, along the vessel's vertical axis. Lift begins to decrease at 30 degrees, but you should generally keep it below 10, and below 5 in most situations.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void Draw(Unity.Flight.ISectionModule section) {
+ this.DrawLine(AttitudeProcessor.AttackAngle == AttitudeProcessor.INVALID_ANGLE ? "--" : Units.ToAngle(AttitudeProcessor.AttackAngle, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
+ }
+
+ public override void Reset() {
+ FlightEngineerCore.Instance.AddUpdatable(AttitudeProcessor.Instance);
+ }
+
+ public override void Update() {
+ AttitudeProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/AngleOfDisplacement.cs b/KerbalEngineer/Flight/Readouts/Vessel/AngleOfDisplacement.cs
new file mode 100644
index 00000000..3a070888
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/AngleOfDisplacement.cs
@@ -0,0 +1,58 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ #region Using Directives
+
+ using Helpers;
+
+ #endregion
+
+ public class AngleOfDisplacement : ReadoutModule
+ {
+ #region Constructors
+
+ public AngleOfDisplacement() {
+ this.Name = "Angle-of-Displacement";
+ this.ShortName = "AoD";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "The angle between velocity and the vessel's fuselage.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void Draw(Unity.Flight.ISectionModule section) {
+ this.DrawLine(AttitudeProcessor.DisplacementAngle == AttitudeProcessor.INVALID_ANGLE ? "--" : Units.ToAngle(AttitudeProcessor.DisplacementAngle, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
+ }
+
+ public override void Reset() {
+ FlightEngineerCore.Instance.AddUpdatable(AttitudeProcessor.Instance);
+ }
+
+ public override void Update() {
+ AttitudeProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/AngleOfSideslip.cs b/KerbalEngineer/Flight/Readouts/Vessel/AngleOfSideslip.cs
new file mode 100644
index 00000000..83afdca9
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/AngleOfSideslip.cs
@@ -0,0 +1,58 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ #region Using Directives
+
+ using Helpers;
+
+ #endregion
+
+ public class AngleOfSideslip : ReadoutModule
+ {
+ #region Constructors
+
+ public AngleOfSideslip() {
+ this.Name = "Angle-of-Sideslip";
+ this.ShortName = "AoS";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "The angle between velocity and the vessel's fuselage, along the vessel's horizontal axis. Aircraft should keep this at 0, rolling to turn instead.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void Draw(Unity.Flight.ISectionModule section) {
+ this.DrawLine(AttitudeProcessor.SideslipAngle == AttitudeProcessor.INVALID_ANGLE ? "--" : Units.ToAngle(AttitudeProcessor.SideslipAngle, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
+ }
+
+ public override void Reset() {
+ FlightEngineerCore.Instance.AddUpdatable(AttitudeProcessor.Instance);
+ }
+
+ public override void Update() {
+ AttitudeProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/AttitudeProcessor.cs b/KerbalEngineer/Flight/Readouts/Vessel/AttitudeProcessor.cs
index fe0fd064..fa33f75a 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/AttitudeProcessor.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/AttitudeProcessor.cs
@@ -21,12 +21,15 @@ namespace KerbalEngineer.Flight.Readouts.Vessel
{
#region Using Directives
+ using System;
using UnityEngine;
#endregion
public class AttitudeProcessor : IUpdatable, IUpdateRequest
{
+ public const double INVALID_ANGLE = -9000000.0;
+
#region Fields
private static readonly AttitudeProcessor instance = new AttitudeProcessor();
@@ -84,6 +87,12 @@ public static double RollRate
{
get { return instance.rollRate; }
}
+
+ public static double GlideslopeAngle { get; private set; }
+
+ public static double DisplacementAngle { get; private set; }
+ public static double AttackAngle { get; private set; }
+ public static double SideslipAngle { get; private set; }
public bool UpdateRequested { get; set; }
@@ -98,7 +107,9 @@ public static void RequestUpdate()
public void Update()
{
- this.surfaceRotation = this.GetSurfaceRotation();
+ var vessel = FlightGlobals.ActiveVessel;
+
+ this.surfaceRotation = this.GetSurfaceRotation(vessel);
this.previousHeading = this.heading;
this.previousPitch = this.pitch;
@@ -113,19 +124,59 @@ public void Update()
? 360.0f - this.surfaceRotation.eulerAngles.z
: -this.surfaceRotation.eulerAngles.z;
- this.headingRate = this.heading - this.previousHeading;
- this.pitchRate = this.pitch - this.previousPitch;
- this.rollRate = this.roll - this.previousRoll;
+ this.headingRate = (this.heading - this.previousHeading) / TimeWarp.fixedDeltaTime;
+ this.pitchRate = (this.pitch - this.previousPitch) / TimeWarp.fixedDeltaTime;
+ this.rollRate = (this.roll - this.previousRoll) / TimeWarp.fixedDeltaTime;
+
+
+ //Also stolen from MechJeb2
+
+ var surfaceVelocity = vessel.obt_velocity - vessel.mainBody.getRFrmVel(vessel.CoMD);
+ var surfaceSpeed = surfaceVelocity.magnitude;
+
+ if (surfaceSpeed < 0.05) GlideslopeAngle = DisplacementAngle = AttackAngle = SideslipAngle = INVALID_ANGLE;
+ else {
+ Vector3d normSurfVel = surfaceVelocity.normalized;
+
+ //Vertical velocity angle relative to the planet's surface
+ double tempGS = UtilMath.Rad2Deg *
+ Math.Asin(Mathf.Clamp(Vector3.Dot(this.up, normSurfVel), -1, 1));
+ GlideslopeAngle = double.IsNaN(tempGS) ? INVALID_ANGLE : tempGS;
+
+ // Displacement Angle, angle between surface velocity and the ship-nose vector (KSP "up" vector) -- ignores roll of the craft (0 to 180 degrees)
+ double tempAoD = UtilMath.Rad2Deg *
+ Math.Acos(Mathf.Clamp(Vector3.Dot(vessel.ReferenceTransform.up, normSurfVel), -1, 1));
+ DisplacementAngle = double.IsNaN(tempAoD) ? INVALID_ANGLE : tempAoD;
+
+ // Angle of Attack, angle between surface velocity and the ship-nose vector (KSP "up" vector) in the plane that has no ship-right/left in it (-180 to +180 degrees)
+ var srfProj = Vector3.ProjectOnPlane(normSurfVel, vessel.ReferenceTransform.right);
+ double tempAoA = UtilMath.Rad2Deg * Math.Atan2(Vector3.Dot(srfProj.normalized, vessel.ReferenceTransform.forward),
+ Vector3.Dot(srfProj.normalized, vessel.ReferenceTransform.up));
+ AttackAngle = double.IsNaN(tempAoA) ? INVALID_ANGLE : tempAoA;
+
+ // Angle of Sideslip, angle between surface velocity and the ship-nose vector (KSP "up" vector) in the plane that has no ship-top/bottom in it (KSP "forward"/"back"; -180 to +180 degrees)
+ srfProj = Vector3.ProjectOnPlane(normSurfVel, vessel.ReferenceTransform.forward);
+ double tempAoS = UtilMath.Rad2Deg * Math.Atan2(Vector3.Dot(srfProj.normalized, vessel.ReferenceTransform.right),
+ Vector3.Dot(srfProj.normalized, vessel.ReferenceTransform.up));
+ SideslipAngle = double.IsNaN(tempAoA) ? INVALID_ANGLE : tempAoS;
+ }
}
- private Quaternion GetSurfaceRotation()
+ private Quaternion GetSurfaceRotation(global::Vessel vessel)
{
// This code was derived from MechJeb2's implementation for getting the vessel's surface relative rotation.
- this.centreOfMass = FlightGlobals.ActiveVessel.CoMD;
- this.up = (this.centreOfMass - FlightGlobals.ActiveVessel.mainBody.position).normalized;
- this.north = Vector3.ProjectOnPlane((FlightGlobals.ActiveVessel.mainBody.position + FlightGlobals.ActiveVessel.mainBody.transform.up * (float)FlightGlobals.ActiveVessel.mainBody.Radius) - this.centreOfMass, this.up).normalized;
+ this.centreOfMass = vessel.CoMD;
+ this.up = (this.centreOfMass - vessel.mainBody.position).normalized;
+ this.north = Vector3.ProjectOnPlane((vessel.mainBody.position + vessel.mainBody.transform.up * (float)vessel.mainBody.Radius) - this.centreOfMass, this.up).normalized;
+
+ return Quaternion.Inverse(Quaternion.Euler(90.0f, 0.0f, 0.0f) * Quaternion.Inverse(vessel.transform.rotation) * Quaternion.LookRotation(this.north, this.up));
+ }
- return Quaternion.Inverse(Quaternion.Euler(90.0f, 0.0f, 0.0f) * Quaternion.Inverse(FlightGlobals.ActiveVessel.transform.rotation) * Quaternion.LookRotation(this.north, this.up));
+ //Not sure why this is in Mathf but not Math...
+ public static double Clamp(double value, double min, double max) {
+ if (value < min) return min;
+ if (value > max) return max;
+ return value;
}
#endregion
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DeltaVCurrent.cs b/KerbalEngineer/Flight/Readouts/Vessel/DeltaVCurrent.cs
index aa23b599..76ae7eb9 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/DeltaVCurrent.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DeltaVCurrent.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(SimulationProcessor.LastStage.deltaV.ToString("N0") + "m/s (" + TimeFormatter.ConvertToString(SimulationProcessor.LastStage.time) + ")", section.IsHud);
+ this.DrawLine(SimulationProcessor.LastStage.deltaV.ToString("N0") + "m/s (" + TimeFormatter.ConvertToString(SimulationProcessor.LastStage.time) + ")", section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DeltaVCurrentTotal.cs b/KerbalEngineer/Flight/Readouts/Vessel/DeltaVCurrentTotal.cs
index f1b7334c..561ce323 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/DeltaVCurrentTotal.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DeltaVCurrentTotal.cs
@@ -33,6 +33,7 @@ public class DeltaVCurrentTotal : ReadoutModule
public DeltaVCurrentTotal()
{
this.Name = "DeltaV (Current/Total)";
+ this.ShortName = "ΔV (Curr/Total)";
this.Category = ReadoutCategory.GetCategory("Vessel");
this.HelpString = "Shows the vessel's current stage delta velocity and total.";
this.IsDefault = false;
@@ -46,7 +47,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(SimulationProcessor.LastStage.deltaV.ToString("N0") + "m/s" + " / " + SimulationProcessor.LastStage.totalDeltaV.ToString("N0") + "m/s", section.IsHud);
+ this.DrawLine(SimulationProcessor.LastStage.deltaV.ToString("N0") + "m/s" + " / " + SimulationProcessor.LastStage.totalDeltaV.ToString("N0") + "m/s", section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DeltaVStaged.cs b/KerbalEngineer/Flight/Readouts/Vessel/DeltaVStaged.cs
index d6701ba3..e62ba7a7 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/DeltaVStaged.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DeltaVStaged.cs
@@ -43,7 +43,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
foreach (Stage stage in SimulationProcessor.Stages.Where(stage => stage.deltaV > 0 || stage.number == StageManager.CurrentStage))
{
- DrawLine("DeltaV (S" + stage.number + ")", stage.deltaV.ToString("N0") + "m/s (" + TimeFormatter.ConvertToString(stage.time) + ")", section.IsHud);
+ DrawLine("DeltaV (S" + stage.number + ")", stage.deltaV.ToString("N0") + "m/s (" + TimeFormatter.ConvertToString(stage.time) + ")", section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DeltaVTotal.cs b/KerbalEngineer/Flight/Readouts/Vessel/DeltaVTotal.cs
index 735d050c..6f00c9b7 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/DeltaVTotal.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DeltaVTotal.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(SimulationProcessor.LastStage.totalDeltaV.ToString("N0") + "m/s (" + TimeFormatter.ConvertToString(SimulationProcessor.LastStage.totalTime) + ")", section.IsHud);
+ this.DrawLine(SimulationProcessor.LastStage.totalDeltaV.ToString("N0") + "m/s (" + TimeFormatter.ConvertToString(SimulationProcessor.LastStage.totalTime) + ")", section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/ElectricCharge.cs b/KerbalEngineer/Flight/Readouts/Vessel/ElectricCharge.cs
new file mode 100644
index 00000000..346ba42c
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/ElectricCharge.cs
@@ -0,0 +1,67 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ #region Using Directives
+
+ using Helpers;
+ using System;
+ using System.Collections.Generic;
+
+ #endregion
+
+ public class ElectricCharge : ReadoutModule
+ {
+ #region Constructors
+
+ public ElectricCharge() {
+ this.Name = "Electric Charge";
+ this.ShortName = "Elec";//"EC";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Current and maximum electric charge in the vessel.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void Draw(Unity.Flight.ISectionModule section) {
+ //PartResourceDefinition definition = PartResourceLibrary.Instance.GetDefinition(PartResourceLibrary.ElectricityHashcode); //Seems unnecessary for electricity
+ List parts = FlightGlobals.ActiveVessel.parts;
+
+ double currentEC = 0, maxEC = 0;
+ foreach (Part part in parts) {
+ foreach (PartResource resource in part.Resources) {
+ if (resource.info.id == PartResourceLibrary.ElectricityHashcode) {
+ currentEC += resource.amount;
+ maxEC += resource.maxAmount;
+ }
+ }
+ }
+
+ int decimals = section.IsHud ? HudDecimalPlaces : DecimalPlaces;
+ if (decimals < 0) decimals = 1;
+ this.DrawLine(currentEC.ToString("F" + decimals) + " / " + maxEC.ToString("F" + decimals), section);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Glideslope.cs b/KerbalEngineer/Flight/Readouts/Vessel/Glideslope.cs
new file mode 100644
index 00000000..8ccce359
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Glideslope.cs
@@ -0,0 +1,58 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ #region Using Directives
+
+ using Helpers;
+
+ #endregion
+
+ public class Glideslope : ReadoutModule
+ {
+ #region Constructors
+
+ public Glideslope() {
+ this.Name = "Glideslope";
+ this.ShortName = "Glide";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "The vertical angle between velocity and the horizon.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void Draw(Unity.Flight.ISectionModule section) {
+ this.DrawLine(AttitudeProcessor.GlideslopeAngle == AttitudeProcessor.INVALID_ANGLE ? "--" : Units.ToAngle(AttitudeProcessor.GlideslopeAngle, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
+ }
+
+ public override void Reset() {
+ FlightEngineerCore.Instance.AddUpdatable(AttitudeProcessor.Instance);
+ }
+
+ public override void Update() {
+ AttitudeProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Gravity.cs b/KerbalEngineer/Flight/Readouts/Vessel/Gravity.cs
index 4003eca3..93b47e85 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/Gravity.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Gravity.cs
@@ -47,7 +47,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(Units.ToAcceleration(SimManager.Gravity), section.IsHud);
+ this.DrawLine(Units.ToAcceleration(SimManager.Gravity, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Heading.cs b/KerbalEngineer/Flight/Readouts/Vessel/Heading.cs
index 2ed27b8b..4c641813 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/Heading.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Heading.cs
@@ -33,6 +33,7 @@ public class Heading : ReadoutModule
public Heading()
{
this.Name = "Heading";
+ this.ShortName = "Hdg";
this.Category = ReadoutCategory.GetCategory("Vessel");
this.HelpString = "Shows the current Heading.";
this.IsDefault = false;
@@ -44,7 +45,7 @@ public Heading()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToAngle(AttitudeProcessor.Heading), section.IsHud);
+ this.DrawLine(Units.ToAngle(AttitudeProcessor.Heading, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/HeadingRate.cs b/KerbalEngineer/Flight/Readouts/Vessel/HeadingRate.cs
index bd734cf8..d160d074 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/HeadingRate.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/HeadingRate.cs
@@ -44,7 +44,7 @@ public HeadingRate()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToAngle(AttitudeProcessor.HeadingRate) + "/sec", section.IsHud);
+ this.DrawLine(Units.ToAngle(AttitudeProcessor.HeadingRate, section.IsHud ? HudDecimalPlaces : DecimalPlaces) + "/sec", section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemand.cs b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemand.cs
index 69070ac6..99c27446 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemand.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemand.cs
@@ -49,7 +49,7 @@ public IntakeAirDemand()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(this.demand.ToString("F4"), section.IsHud);
+ this.DrawLine(this.demand.ToString("F4"), section);
}
public override void Update()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemandSupply.cs b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemandSupply.cs
index 3f285a29..9bed5c19 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemandSupply.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirDemandSupply.cs
@@ -79,7 +79,7 @@ public static double GetSupply()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(this.demand.ToString("F4") + " / " + this.supply.ToString("F4"), section.IsHud);
+ this.DrawLine(this.demand.ToString("F4") + " / " + this.supply.ToString("F4"), section);
}
public override void Update()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirSupply.cs b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirSupply.cs
index b2b51484..fa545cbc 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirSupply.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirSupply.cs
@@ -49,7 +49,7 @@ public IntakeAirSupply()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(this.supply.ToString("F4"), section.IsHud);
+ this.DrawLine(this.supply.ToString("F4"), section);
}
public override void Update()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirUsage.cs b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirUsage.cs
index 59c240f9..4a573519 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirUsage.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/IntakeAirUsage.cs
@@ -52,7 +52,7 @@ public IntakeAirUsage()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToPercent(this.percentage), section.IsHud);
+ this.DrawLine(Units.ToPercent(this.percentage, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void Update()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/LfOxRatio.cs b/KerbalEngineer/Flight/Readouts/Vessel/LfOxRatio.cs
new file mode 100644
index 00000000..7fd40039
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/LfOxRatio.cs
@@ -0,0 +1,86 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ #region Using Directives
+
+ using Helpers;
+ using System;
+ using System.Collections.Generic;
+
+ #endregion
+
+ public class LfOxRatio : ReadoutModule
+ {
+ #region Constructors
+
+ public LfOxRatio() {
+ this.Name = "LF:Ox Ratio";
+ this.ShortName = "LF:Ox";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Ratio of Liquid Fuel to Oxidizer in the vessel. More than 100% means you have more LF than oxidizer for standard rocket engines, so you have extra for LF-only engines. The number in parentheses is how much excess LF you have.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void Draw(Unity.Flight.ISectionModule section) {
+ PartResourceDefinition lfDefinition = PartResourceLibrary.Instance.GetDefinition("LiquidFuel"),
+ oxDefinition = PartResourceLibrary.Instance.GetDefinition("Oxidizer");
+ List parts = FlightGlobals.ActiveVessel.parts;
+
+ double currentLF = 0, currentOx = 0;
+ foreach (Part part in parts) {
+ foreach (PartResource resource in part.Resources) {
+ if (resource.info.id == lfDefinition.id) currentLF += resource.amount;
+ else if (resource.info.id == oxDefinition.id) currentOx += resource.amount;
+ }
+ }
+
+ bool usingShortName = UsingShortName(section);
+ if (currentOx <= double.Epsilon) this.DrawLine(usingShortName ? "No Ox" : "No Oxidizer", section);
+ else {
+ const double FUEL_MIX = 440.0 / 360.0;
+ double ratio = currentLF * FUEL_MIX / currentOx;
+ if (usingShortName) {
+ if (ratio >= 10.0) {
+ this.DrawLine("A Lot", section);
+ return;
+ }
+ } else {
+ if (ratio > 90.0) {
+ this.DrawLine("Over 9000%", section);
+ return;
+ }
+ }
+
+ int excess = (int)(currentLF - (currentOx / FUEL_MIX));
+
+ int decimals = section.IsHud ? HudDecimalPlaces : DecimalPlaces;
+ if (decimals < 0) decimals = 1;
+ this.DrawLine(Units.ToPercent(ratio, decimals) + (excess > 0 ? " (+" : " (") + excess + ")", section);
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Mass.cs b/KerbalEngineer/Flight/Readouts/Vessel/Mass.cs
index f214c9a7..392757a6 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/Mass.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Mass.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(Units.ToMass(SimulationProcessor.LastStage.mass, SimulationProcessor.LastStage.totalMass), section.IsHud);
+ this.DrawLine(Units.ToMass(SimulationProcessor.LastStage.mass, SimulationProcessor.LastStage.totalMass, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Name.cs b/KerbalEngineer/Flight/Readouts/Vessel/Name.cs
index 3cd85b45..d504f12b 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/Name.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Name.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- DrawLine(FlightGlobals.ActiveVessel.vesselName, section.IsHud);
+ DrawLine(FlightGlobals.ActiveVessel.vesselName, section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/PartCount.cs b/KerbalEngineer/Flight/Readouts/Vessel/PartCount.cs
index 8899af25..2838f0e1 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/PartCount.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/PartCount.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(Units.ConcatF(SimulationProcessor.LastStage.partCount, SimulationProcessor.LastStage.totalPartCount, 0), section.IsHud);
+ this.DrawLine(Units.Concat(SimulationProcessor.LastStage.partCount, SimulationProcessor.LastStage.totalPartCount), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Pitch.cs b/KerbalEngineer/Flight/Readouts/Vessel/Pitch.cs
index ea084d46..b36749f8 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/Pitch.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Pitch.cs
@@ -44,7 +44,7 @@ public Pitch()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToAngle(AttitudeProcessor.Pitch), section.IsHud);
+ this.DrawLine(Units.ToAngle(AttitudeProcessor.Pitch, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/PitchRate.cs b/KerbalEngineer/Flight/Readouts/Vessel/PitchRate.cs
index f0fa0707..64bc929f 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/PitchRate.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/PitchRate.cs
@@ -44,7 +44,7 @@ public PitchRate()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToAngle(AttitudeProcessor.PitchRate) + "/sec", section.IsHud);
+ this.DrawLine(Units.ToAngle(AttitudeProcessor.PitchRate, section.IsHud ? HudDecimalPlaces : DecimalPlaces) + "/sec", section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/RCSDeltaV.cs b/KerbalEngineer/Flight/Readouts/Vessel/RCSDeltaV.cs
index 15b6ca54..50c057c2 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/RCSDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/RCSDeltaV.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(SimulationProcessor.LastStage.RCSdeltaVStart.ToString("N0") + "m/s (" + TimeFormatter.ConvertToString(SimulationProcessor.LastStage.RCSBurnTime) + ")", section.IsHud);
+ this.DrawLine(SimulationProcessor.LastStage.RCSdeltaVStart.ToString("N0") + "m/s (" + TimeFormatter.ConvertToString(SimulationProcessor.LastStage.RCSBurnTime) + ")", section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/RCSIsp.cs b/KerbalEngineer/Flight/Readouts/Vessel/RCSIsp.cs
index 63961ed0..d0f1b23e 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/RCSIsp.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/RCSIsp.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(SimulationProcessor.LastStage.RCSIsp.ToString("F1") + "s", section.IsHud);
+ this.DrawLine(SimulationProcessor.LastStage.RCSIsp.ToString("F1") + "s", section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/RCSTWR.cs b/KerbalEngineer/Flight/Readouts/Vessel/RCSTWR.cs
index 1c381e2e..6a7aaef7 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/RCSTWR.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/RCSTWR.cs
@@ -53,9 +53,9 @@ public override void Draw(Unity.Flight.ISectionModule section)
if(SimulationProcessor.LastStage.totalMass > 0) {
this.gravity = FlightGlobals.getGeeForceAtPosition(FlightGlobals.ship_position).magnitude;
this.total = (SimulationProcessor.LastStage.RCSThrust / (SimulationProcessor.LastStage.totalMass * this.gravity)).ToString("F2");
- this.DrawLine(this.total, section.IsHud);
+ this.DrawLine(this.total, section);
} else {
- this.DrawLine("N/A", section.IsHud);
+ this.DrawLine("N/A", section);
}
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/RCSThrust.cs b/KerbalEngineer/Flight/Readouts/Vessel/RCSThrust.cs
index f5844ae6..e01de55c 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/RCSThrust.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/RCSThrust.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(Units.ToForce(SimulationProcessor.LastStage.RCSThrust), section.IsHud);
+ this.DrawLine(Units.ToForce(SimulationProcessor.LastStage.RCSThrust), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Roll.cs b/KerbalEngineer/Flight/Readouts/Vessel/Roll.cs
index d9a885ca..5c8e9af2 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/Roll.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Roll.cs
@@ -44,7 +44,7 @@ public Roll()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToAngle(AttitudeProcessor.Roll), section.IsHud);
+ this.DrawLine(Units.ToAngle(AttitudeProcessor.Roll, section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/RollRate.cs b/KerbalEngineer/Flight/Readouts/Vessel/RollRate.cs
index db9a8cb8..703bb760 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/RollRate.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/RollRate.cs
@@ -44,7 +44,7 @@ public RollRate()
public override void Draw(Unity.Flight.ISectionModule section)
{
- this.DrawLine(Units.ToAngle(AttitudeProcessor.RollRate) + "/sec", section.IsHud);
+ this.DrawLine(Units.ToAngle(AttitudeProcessor.RollRate, section.IsHud ? HudDecimalPlaces : DecimalPlaces) + "/sec", section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/SpecificImpulse.cs b/KerbalEngineer/Flight/Readouts/Vessel/SpecificImpulse.cs
index 16415f6a..77e93bde 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/SpecificImpulse.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/SpecificImpulse.cs
@@ -45,7 +45,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(SimulationProcessor.LastStage.isp.ToString("F1") + "s", section.IsHud);
+ this.DrawLine(SimulationProcessor.LastStage.isp.ToString("F1") + "s", section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnAltitude.cs b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnAltitude.cs
index 5cdb2b74..7e065261 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnAltitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnAltitude.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine(Surface.ImpactProcessor.SuicideAltitude.ToDistance(), section.IsHud);
+ this.DrawLine(Surface.ImpactProcessor.SuicideAltitude.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnCountdown.cs b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnCountdown.cs
index 40526465..7b39ee52 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnCountdown.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnCountdown.cs
@@ -36,6 +36,7 @@ public class SuicideBurnCountdown : ReadoutModule
public SuicideBurnCountdown()
{
this.Name = "Suicide Burn Countdown";
+ this.ShortName = "Decel in";
this.Category = ReadoutCategory.GetCategory("Vessel");
this.HelpString = "Time until suicide burn should start.";
this.IsDefault = false;
@@ -47,11 +48,11 @@ public SuicideBurnCountdown()
public override void Draw(Unity.Flight.ISectionModule section)
{
- if (!SimulationProcessor.ShowDetails || !Surface.ImpactProcessor.ShowDetails) {
+ if (!SimulationProcessor.ShowDetails || !Surface.ImpactProcessor.ShowDetails || Surface.ImpactProcessor.SuicideCountdown <= double.Epsilon) {
return;
}
- this.DrawLine(TimeFormatter.ConvertToString(Surface.ImpactProcessor.SuicideCountdown), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(Surface.ImpactProcessor.SuicideCountdown), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnDeltaV.cs b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnDeltaV.cs
index 00901148..47c6e0d8 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnDeltaV.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnDeltaV.cs
@@ -50,7 +50,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine(Surface.ImpactProcessor.SuicideDeltaV.ToString("N1") + "m/s", section.IsHud);
+ this.DrawLine(Surface.ImpactProcessor.SuicideDeltaV.ToString("N1") + "m/s", section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnDistance.cs b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnDistance.cs
index c873b9b4..e1e425f0 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnDistance.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnDistance.cs
@@ -48,7 +48,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine(Surface.ImpactProcessor.SuicideDistance.ToDistance(), section.IsHud);
+ this.DrawLine(Surface.ImpactProcessor.SuicideDistance.ToDistance(section.IsHud ? HudDecimalPlaces : DecimalPlaces), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnLength.cs b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnLength.cs
index b860513c..b5332b35 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnLength.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/SuicideBurnLength.cs
@@ -51,7 +51,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
return;
}
- this.DrawLine(TimeFormatter.ConvertToString(Surface.ImpactProcessor.SuicideLength), section.IsHud);
+ this.DrawLine(TimeFormatter.ConvertToString(Surface.ImpactProcessor.SuicideLength), section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/SurfaceThrustToWeight.cs b/KerbalEngineer/Flight/Readouts/Vessel/SurfaceThrustToWeight.cs
index abb5c75a..8ed37f0a 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/SurfaceThrustToWeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/SurfaceThrustToWeight.cs
@@ -44,7 +44,7 @@ public override void Draw(Unity.Flight.ISectionModule section) {
m_Actual = (SimulationProcessor.LastStage.actualThrust / (SimulationProcessor.LastStage.totalMass * m_Gravity)).ToString("F2");
m_Total = (SimulationProcessor.LastStage.thrust / (SimulationProcessor.LastStage.totalMass * m_Gravity)).ToString("F2");
}
- DrawLine("TWR (Surface)", m_Actual + " / " + m_Total, section.IsHud);
+ DrawLine("TWR (Surface)", m_Actual + " / " + m_Total, section);
}
public override void Reset() {
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Throttle.cs b/KerbalEngineer/Flight/Readouts/Vessel/Throttle.cs
index cc19d2ec..4c7599dd 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/Throttle.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Throttle.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(FlightInputHandler.state.mainThrottle.ToString("0%"), section.IsHud);
+ this.DrawLine(FlightInputHandler.state.mainThrottle.ToString("0%"), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/Thrust.cs b/KerbalEngineer/Flight/Readouts/Vessel/Thrust.cs
index a0d5f3d4..575b1bcf 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/Thrust.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/Thrust.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(Units.ToForce(SimulationProcessor.LastStage.actualThrust, SimulationProcessor.LastStage.thrust), section.IsHud);
+ this.DrawLine(Units.ToForce(SimulationProcessor.LastStage.actualThrust, SimulationProcessor.LastStage.thrust), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/ThrustOffsetAngle.cs b/KerbalEngineer/Flight/Readouts/Vessel/ThrustOffsetAngle.cs
index b87f365b..9d116792 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/ThrustOffsetAngle.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/ThrustOffsetAngle.cs
@@ -46,7 +46,8 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(Units.ToAngle(SimulationProcessor.LastStage.thrustOffsetAngle, 1), section.IsHud);
+ int dec = section.IsHud ? HudDecimalPlaces : DecimalPlaces;
+ this.DrawLine(Units.ToAngle(SimulationProcessor.LastStage.thrustOffsetAngle, dec < 0 ? 1 : dec), section);
}
}
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/ThrustToWeight.cs b/KerbalEngineer/Flight/Readouts/Vessel/ThrustToWeight.cs
index 530cee3f..08db345c 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/ThrustToWeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/ThrustToWeight.cs
@@ -64,7 +64,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
this.actual = (SimulationProcessor.LastStage.actualThrust / (SimulationProcessor.LastStage.totalMass * this.gravity)).ToString("F2");
this.total = (SimulationProcessor.LastStage.thrust / (SimulationProcessor.LastStage.totalMass * this.gravity)).ToString("F2");
}
- this.DrawLine("TWR", this.actual + " / " + this.total, section.IsHud);
+ this.DrawLine("TWR", this.actual + " / " + this.total, section);
}
public override void Reset()
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/ThrustTorque.cs b/KerbalEngineer/Flight/Readouts/Vessel/ThrustTorque.cs
index c1d98aa2..b5f251dc 100644
--- a/KerbalEngineer/Flight/Readouts/Vessel/ThrustTorque.cs
+++ b/KerbalEngineer/Flight/Readouts/Vessel/ThrustTorque.cs
@@ -46,7 +46,7 @@ public override void Draw(Unity.Flight.ISectionModule section)
{
if (SimulationProcessor.ShowDetails)
{
- this.DrawLine(Units.ToTorque(SimulationProcessor.LastStage.maxThrustTorque), section.IsHud);
+ this.DrawLine(Units.ToTorque(SimulationProcessor.LastStage.maxThrustTorque), section);
}
}
diff --git a/KerbalEngineer/Flight/Sections/SectionEditor.cs b/KerbalEngineer/Flight/Sections/SectionEditor.cs
index 6a206da0..c4576d87 100644
--- a/KerbalEngineer/Flight/Sections/SectionEditor.cs
+++ b/KerbalEngineer/Flight/Sections/SectionEditor.cs
@@ -41,22 +41,25 @@ public class SectionEditor : MonoBehaviour {
#region Fields
- private GUIStyle categoryButtonActiveStyle;
- private GUIStyle categoryButtonStyle;
- private PopOutElement categoryList;
- private PopOutColorPicker colorPicker;
- private GUIStyle categoryTitleButtonStyle;
- private GUIStyle helpBoxStyle;
- private GUIStyle helpTextStyle;
- private GUIStyle panelTitleStyle;
- private Rect position;
- private PopOutElement presetList;
- private GUIStyle readoutButtonStyle;
- private GUIStyle readoutNameStyle;
- private Vector2 scrollPositionAvailable;
- private Vector2 scrollPositionInstalled;
- private GUIStyle textStyle;
- private GUIStyle windowStyle;
+ protected GUIStyle categoryButtonActiveStyle;
+ protected GUIStyle categoryButtonStyle;
+ protected PopOutElement categoryList;
+ protected PopOutReadoutSettings readoutSettings;
+ protected PopOutColorPicker backgroundColorPicker;
+ protected GUIStyle colorPickerButtonStyle;
+ protected GUIStyle categoryTitleButtonStyle;
+ protected GUIStyle helpBoxStyle;
+ protected GUIStyle helpTextStyle;
+ protected GUIStyle panelTitleStyle;
+ protected Rect position;
+ protected PopOutElement presetList;
+ protected GUIStyle readoutButtonStyle, readoutEditButtonStyle;
+ protected GUIStyle readoutNameStyle;
+ protected Vector2 scrollPositionAvailable;
+ protected Vector2 scrollPositionInstalled;
+ protected GUIStyle textStyle;
+ protected GUIStyle windowStyle;
+ protected GUIStyle windowSubtitleStyle;
#endregion
@@ -83,18 +86,27 @@ protected void Awake() {
try {
this.categoryList = this.gameObject.AddComponent();
this.categoryList.DrawCallback = this.DrawCategories;
+
this.presetList = this.gameObject.AddComponent();
this.presetList.DrawCallback = this.DrawPresets;
- this.colorPicker = this.gameObject.AddComponent();
- this.colorPicker.DrawCallback = this.DrawColorPicker;
- this.colorPicker.ClosedCallback = this.saveColor;
+
+ this.readoutSettings = this.gameObject.AddComponent();
+ this.readoutSettings.DrawCallback = () => { if (editingReadout != null) this.readoutSettings.Draw(editingReadout); };
+ this.readoutSettings.ClosedCallback = this.SaveReadoutSettings;
+
+ this.backgroundColorPicker = this.gameObject.AddComponent();
+ this.backgroundColorPicker.DrawCallback = () => {
+ var bg = this.backgroundColorPicker.DrawColorPicker(this.ParentSection.HudBackgroundColor, Unity.Flight.OOPSux.DEFAULT_HUD_BACKGROUND_COLOR, this.ParentSection.IsHudBackground, "HUD background");
+ if (bg.Item1 != this.ParentSection.HudBackgroundColor) {
+ this.ParentSection.IsHudBackground = true;
+ this.ParentSection.SetHudBackgroundColor(bg.Item1);
+ } else this.ParentSection.IsHudBackground = bg.Item2;
+ };
} catch (Exception ex) {
MyLogger.Exception(ex);
}
}
-
-
///
/// Runs when the object is destroyed.
///
@@ -116,63 +128,24 @@ protected void Start() {
MyLogger.Exception(ex);
}
}
-
- #endregion
-
- #region Methods: private
-
- private void saveColor() {
- if (editingReadout == null) return;
- if (editingReadout.ValueStyle.normal.textColor == HighLogic.Skin.label.normal.textColor)
- ReadoutLibrary.RemoveReadoutConfig(editingReadout);
- else
- ReadoutLibrary.SaveReadoutConfig(editingReadout);
- }
-
+
///
/// Called to draw the editor when the UI is enabled.
///
- private void OnGUI() {
- if (FlightEngineerCore.IsDisplayable == false) {
+ protected virtual void OnGUI() {
+ if (!HighLogic.LoadedSceneIsFlight || FlightEngineerCore.IsDisplayable == false) {
return;
}
- this.position = GUILayout.Window(this.GetInstanceID(), this.position, this.Window, "EDIT SECTION - " + this.ParentSection.Name.ToUpper(), this.windowStyle).ClampToScreen();
+ this.position = GUILayout.Window(this.GetInstanceID(), this.position, this.Window, "EDIT SECTION – " + this.ParentSection.Name.ToUpper(), this.windowStyle, GUILayout.Height(Screen.height * 0.47f)).ClampToScreen();
this.ParentSection.EditorPositionX = this.position.x;
this.ParentSection.EditorPositionY = this.position.y;
}
-
- ///
- /// Draws the available readouts panel.
- ///
- private void DrawAvailableReadouts() {
- GUI.skin = HighLogic.Skin;
- this.scrollPositionAvailable = GUILayout.BeginScrollView(this.scrollPositionAvailable, false, true, GUILayout.Height(200.0f));
- GUI.skin = null;
-
- GUILayout.Label("AVAILABLE", this.panelTitleStyle);
-
- foreach (var readout in ReadoutLibrary.GetCategory(ReadoutCategory.Selected)) {
- if (!this.ParentSection.ReadoutModules.Contains(readout) || readout.Cloneable) {
- GUILayout.BeginHorizontal(GUILayout.Height(30.0f));
- GUILayout.Label(readout.Name, this.readoutNameStyle);
- readout.ShowHelp = GUILayout.Toggle(readout.ShowHelp, "?", this.readoutButtonStyle, GUILayout.Width(30.0f));
- if (GUILayout.Button("INSTALL", this.readoutButtonStyle, GUILayout.Width(75.0f))) {
- this.ParentSection.ReadoutModules.Add(readout);
- }
- GUILayout.EndHorizontal();
-
- this.ShowHelpMessage(readout);
- }
- }
-
- GUILayout.EndScrollView();
- }
-
+
///
/// Draws the categories list drop down UI.
///
- private void DrawCategories() {
+ protected virtual void DrawCategories() {
foreach (var category in ReadoutCategory.Categories) {
var description = category.Description;
if (description.Length > 50) {
@@ -185,29 +158,36 @@ private void DrawCategories() {
}
}
}
-
- ///
- /// Draws the readoutCategories selection list.
- ///
- private void DrawCategorySelector() {
- this.categoryList.enabled = GUILayout.Toggle(this.categoryList.enabled, "▼ SELECTED CATEGORY: " + ReadoutCategory.Selected.ToString().ToUpper() + " ▼", this.categoryTitleButtonStyle);
- if (Event.current.type == EventType.Repaint) {
- this.categoryList.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position), GUILayoutUtility.GetLastRect());
- }
- }
+
+ private Texture2D colorPickerSwatch = new Texture2D(16, 20);
///
/// Draws the options for editing custom sections.
///
- private void DrawCustomOptions() {
+ protected virtual void DrawCustomOptions() {
+ GUILayout.Label("Drag the section to reposition, right-click-drag to resize, Alt+MMB to edit", this.windowSubtitleStyle);
+
GUILayout.BeginHorizontal(GUILayout.Height(25.0f));
+
this.ParentSection.Name = GUILayout.TextField(this.ParentSection.Name, this.textStyle);
var isShowingInControlBar = !string.IsNullOrEmpty(this.ParentSection.Abbreviation);
this.ParentSection.Abbreviation = GUILayout.TextField(this.ParentSection.Abbreviation, this.textStyle, GUILayout.Width(75.0f));
- ParentSection.IsHud = GUILayout.Toggle(this.ParentSection.IsHud, "HUD", this.readoutButtonStyle, GUILayout.Width(50.0f));
+ ParentSection.IsHud = GUILayout.Toggle(this.ParentSection.IsHud, "HUD", this.readoutButtonStyle, GUILayout.Width(ParentSection.IsHud ? 46.0f : 78.0f));
if (ParentSection.IsHud) {
- this.ParentSection.IsHudBackground = GUILayout.Toggle(this.ParentSection.IsHudBackground, "BG", this.readoutButtonStyle, GUILayout.Width(50.0f));
+ Color normalGuiColor = GUI.color;
+ GUI.color = ParentSection.HudBackgroundColor;
+
+ if (GUILayout.Button(colorPickerSwatch, colorPickerButtonStyle, GUILayout.Width(30.0f))) {
+ if (Event.current.button == 0 /* LMB */) backgroundColorPicker.Open();
+ else if (Event.current.button == 1 /* RMB */) this.ParentSection.IsHudBackground = !this.ParentSection.IsHudBackground;
+ }
+
+ if (backgroundColorPicker.enabled && Event.current.type == EventType.Repaint) {
+ backgroundColorPicker.SetPosition(GUILayoutUtility.GetLastRect().Translate(Position).Translate(new Rect(6, 0, 8, 8)), new Rect(0, 0, 180, 20));
+ }
+
+ GUI.color = normalGuiColor;
}
if (isShowingInControlBar && string.IsNullOrEmpty(this.ParentSection.Abbreviation)) {
@@ -229,8 +209,88 @@ private void DrawCustomOptions() {
GUILayout.EndHorizontal();
}
+
+ ///
+ /// Draws the presetsList selection list.
+ ///
+ protected virtual void DrawPresetSelector() {
+ this.presetList.enabled = GUILayout.Toggle(this.presetList.enabled, "▼ PRESETS ▼", this.categoryTitleButtonStyle, GUILayout.Width(150.0f));
+ if (Event.current.type == EventType.Repaint) {
+ this.presetList.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position), GUILayoutUtility.GetLastRect());
+ }
+ }
+
+ ///
+ /// Draws the editor window.
+ ///
+ protected void Window(int windowId) {
+ try {
+ this.DrawCustomOptions();
+ GUILayout.BeginHorizontal();
+ this.DrawCategorySelector();
+ this.DrawPresetSelector();
+ GUILayout.EndHorizontal();
+ this.DrawAvailableReadouts();
+ GUILayout.Space(5.0f);
+ this.DrawInstalledReadouts();
+
+ if (GUILayout.Button("CLOSE EDITOR", this.categoryTitleButtonStyle)) {
+ this.ParentSection.IsEditorVisible = false;
+ }
+
+ GUI.DragWindow();
+ } catch (Exception ex) {
+ MyLogger.Exception(ex);
+ }
+ }
+
+ #endregion
+
+ #region Methods: private
+
+ private ReadoutModule editingReadout = null;
+
+ private void SaveReadoutSettings() {
+ if (editingReadout != null) ReadoutLibrary.SaveReadoutConfig(editingReadout);
+ }
+
+ ///
+ /// Draws the available readouts panel.
+ ///
+ private void DrawAvailableReadouts() {
+ GUI.skin = HighLogic.Skin;
+ this.scrollPositionAvailable = GUILayout.BeginScrollView(this.scrollPositionAvailable, false, true, GUILayout.Height(this.position.height * 0.5f));
+ GUI.skin = null;
+
+ GUILayout.Label("AVAILABLE", this.panelTitleStyle);
+
+ foreach (var readout in ReadoutLibrary.GetCategory(ReadoutCategory.Selected)) {
+ if (!this.ParentSection.ReadoutModules.Contains(readout) || readout.Cloneable) {
+ GUILayout.BeginHorizontal(GUILayout.Height(30.0f));
+ GUILayout.Label(readout.Name, this.readoutNameStyle);
+ readout.ShowHelp = GUILayout.Toggle(readout.ShowHelp, "?", this.readoutButtonStyle, GUILayout.Width(30.0f));
+ if (GUILayout.Button("INSTALL", this.readoutButtonStyle, GUILayout.Width(75.0f))) {
+ this.ParentSection.ReadoutModules.Add(readout);
+ }
+ GUILayout.EndHorizontal();
+
+ this.ShowHelpMessage(readout);
+ }
+ }
+
+ GUILayout.EndScrollView();
+ }
+
+ ///
+ /// Draws the readoutCategories selection list.
+ ///
+ private void DrawCategorySelector() {
+ this.categoryList.enabled = GUILayout.Toggle(this.categoryList.enabled, "▼ SELECTED CATEGORY: " + ReadoutCategory.Selected.ToString().ToUpper() + " ▼", this.categoryTitleButtonStyle);
+ if (Event.current.type == EventType.Repaint) {
+ this.categoryList.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position), GUILayoutUtility.GetLastRect());
+ }
+ }
- Texture2D swatch = new Texture2D(16, 20);
private Rect scrollRectInstalled = new Rect();
///
@@ -250,8 +310,10 @@ private void DrawInstalledReadouts() {
var readout = this.ParentSection.ReadoutModules[i];
GUILayout.BeginHorizontal(GUILayout.Height(30.0f));
+
GUILayout.Label(readout.Name, this.readoutNameStyle);
+
if (GUILayout.Button("▲", this.readoutButtonStyle, GUILayout.Width(30.0f))) {
if (i > 0) {
this.ParentSection.ReadoutModules[i] = this.ParentSection.ReadoutModules[i - 1];
@@ -266,33 +328,30 @@ private void DrawInstalledReadouts() {
}
}
- Color temp = GUI.color;
-
- GUI.color = readout.ValueStyle.normal.textColor;
if (readout.Cloneable == false) {
- if (GUILayout.Button(swatch, this.readoutButtonStyle, GUILayout.Width(30.0f))) {
+ if (GUILayout.Button("✎", this.readoutEditButtonStyle, GUILayout.Width(30.0f))) { //No ⚙ symbol in the in-game font :(
editingReadout = readout;
- colorPicker.enabled = true;
+ readoutSettings.Open();
+ readoutSettings.ResizeCounter = 5; //The window is too tall when first layed out and it takes multiple frames for .Window to shrink it for some reason...
}
- if (Event.current.type == EventType.Repaint && editingReadout == readout) {
- colorPicker.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position).Translate(new Rect(8, scrollRectInstalled.y - scrollPositionInstalled.y, 8, 8)), new Rect(0, 0, 180, 20));
+ if (editingReadout == readout && Event.current.type == EventType.Repaint && readoutSettings.enabled) {
+ readoutSettings.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position).Translate(new Rect(8, scrollRectInstalled.y - scrollPositionInstalled.y, 8, 8)), new Rect(0, 0, 200, 0));
}
-
} else { //dont show for separators.
GUILayout.Label("", GUILayout.Width(26.0f));
}
- GUI.color = temp;
-
readout.ShowHelp = GUILayout.Toggle(readout.ShowHelp, "?", this.readoutButtonStyle, GUILayout.Width(30.0f));
+
if (GUILayout.Button("REMOVE", this.readoutButtonStyle, GUILayout.Width(75.0f))) {
removeReadout = true;
removeReadoutIndex = i;
}
+
GUILayout.EndHorizontal();
this.ShowHelpMessage(readout);
@@ -327,16 +386,6 @@ private void DrawPresetSaveButton() {
this.SavePreset(PresetLibrary.Presets.Find(p => String.Equals(p.Name, this.ParentSection.Name, StringComparison.CurrentCultureIgnoreCase)));
}
- ///
- /// Draws the presetsList selection list.
- ///
- private void DrawPresetSelector() {
- this.presetList.enabled = GUILayout.Toggle(this.presetList.enabled, "▼ PRESETS ▼", this.categoryTitleButtonStyle, GUILayout.Width(150.0f));
- if (Event.current.type == EventType.Repaint) {
- this.presetList.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position), GUILayoutUtility.GetLastRect());
- }
- }
-
///
/// Draws the preset list drop down UI.
///
@@ -351,22 +400,43 @@ private void DrawPresets() {
GUILayout.EndHorizontal();
}
if (removePreset != null && PresetLibrary.Remove(removePreset)) {
- this.presetList.Resize = true;
+ this.presetList.ResizeCounter = 1;
}
this.DrawPresetSaveButton();
}
- private ReadoutModule editingReadout = null;
-
-
-
///
/// Initialises all the styles required for this object.
///
private void InitialiseStyles() {
this.windowStyle = new GUIStyle(HighLogic.Skin.window);
+
+ this.windowSubtitleStyle = new GUIStyle(HighLogic.Skin.label) {
+ normal =
+ {
+ textColor = Color.white
+ },
+ margin = new RectOffset(0, 0, 0, 5),
+ padding = new RectOffset(0, 0, 0, 0),
+ alignment = TextAnchor.MiddleCenter,
+ fontSize = 12,
+ fontStyle = FontStyle.Normal,
+ stretchWidth = true,
+ stretchHeight = true,
+ fixedHeight = 16
+ };
+
+ this.colorPickerButtonStyle = new GUIStyle(HighLogic.Skin.button) {
+ normal = { textColor = Color.white },
+ margin = new RectOffset(2, 2, 2, 2),
+ padding = new RectOffset(0, 0, 0, 0),
+ alignment = TextAnchor.MiddleCenter,
+ fontSize = 12,
+ fontStyle = FontStyle.Bold,
+ stretchHeight = true
+ };
this.categoryButtonStyle = new GUIStyle(HighLogic.Skin.button) {
normal =
@@ -399,7 +469,7 @@ private void InitialiseStyles() {
fixedHeight = 30.0f,
stretchWidth = true
};
-
+
this.textStyle = new GUIStyle(HighLogic.Skin.textField) {
margin = new RectOffset(3, 3, 3, 3),
alignment = TextAnchor.MiddleLeft,
@@ -433,6 +503,8 @@ private void InitialiseStyles() {
fontStyle = FontStyle.Bold,
stretchHeight = true
};
+ this.readoutEditButtonStyle = new GUIStyle(this.readoutButtonStyle);
+ this.readoutEditButtonStyle.fontStyle = FontStyle.Normal;
this.helpBoxStyle = new GUIStyle(HighLogic.Skin.box) {
margin = new RectOffset(2, 2, 2, 10),
@@ -483,38 +555,6 @@ private void ShowHelpMessage(ReadoutModule readout) {
GUILayout.EndVertical();
}
- ///
- /// Draws the editor window.
- ///
- private void Window(int windowId) {
- try {
- this.DrawCustomOptions();
- GUILayout.BeginHorizontal();
- this.DrawCategorySelector();
- this.DrawPresetSelector();
- GUILayout.EndHorizontal();
- this.DrawAvailableReadouts();
- GUILayout.Space(5.0f);
- this.DrawInstalledReadouts();
-
- if (GUILayout.Button("CLOSE EDITOR", this.categoryTitleButtonStyle)) {
- this.ParentSection.IsEditorVisible = false;
- }
-
- GUI.DragWindow();
- } catch (Exception ex) {
- MyLogger.Exception(ex);
- }
- }
-
- private void DrawColorPicker() {
- if (editingReadout == null) return;
- editingReadout.ValueStyle.normal.textColor = this.colorPicker.DrawColorPicker(editingReadout.ValueStyle.normal.textColor);
- }
#endregion
-
}
-
-
-
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Sections/SectionModule.cs b/KerbalEngineer/Flight/Sections/SectionModule.cs
index 3b87a7b2..25563884 100644
--- a/KerbalEngineer/Flight/Sections/SectionModule.cs
+++ b/KerbalEngineer/Flight/Sections/SectionModule.cs
@@ -32,15 +32,17 @@
namespace KerbalEngineer.Flight.Sections {
using Presets;
using Unity.Flight;
+
///
/// Object for management and display of readout modules.
///
public class SectionModule : ISectionModule {
#region Fields
- private SectionEditor editor;
- private bool isHud;
- private int numberOfReadouts;
+ protected SectionEditor editor;
+ protected bool isHud;
+ protected bool isVisible;
+ protected int numberOfReadouts;
#endregion
@@ -53,7 +55,7 @@ public SectionModule() {
this.FloatingPositionX = Screen.width * 0.5f - 125.0f;
this.FloatingPositionY = 100.0f;
this.EditorPositionX = Screen.width * 0.5f - SectionEditor.Width * 0.5f;
- this.EditorPositionY = Screen.height * 0.5f - SectionEditor.Height * 0.5f;
+ this.EditorPositionY = Screen.height * 0.37f - SectionEditor.Height * 0.5f;
this.ReadoutModules = new List();
this.InitialiseStyles();
GuiDisplaySize.OnSizeChanged += this.OnSizeChanged;
@@ -104,7 +106,7 @@ public SectionModule() {
///
/// Gets and sets whether the section editor is visible.
///
- public bool IsEditorVisible {
+ public virtual bool IsEditorVisible {
get { return this.editor != null; }
set {
if (value && this.editor == null) {
@@ -118,7 +120,7 @@ public bool IsEditorVisible {
///
/// Gets and sets whether the section is in a floating state.
///
- public bool IsFloating {
+ public virtual bool IsFloating {
get { return this.Window != null; }
set {
if (value && this.Window == null) {
@@ -162,17 +164,51 @@ public bool IsHud {
///
/// Gets and sets the visibility of the section.
///
- public bool IsVisible { get; set; }
+ public bool IsVisible {
+ get { return this.isVisible; }
+ set {
+ if (value && value != this.isVisible) this.IsHudVisible = true;
+ this.isVisible = value;
+ }
+ }
+
+ ///
+ /// Gets and sets the HUD visibility of the section, for use with the group-toggle hotkeys.
+ ///
+ [XmlIgnore]
+ public bool IsHudVisible { get; set; } = true;
///
/// Gets the number of drawn readout lines.
///
public int LineCount { get; set; }
+ ///
+ /// Gets and sets the width of the section. (Only used with serialisation.)
+ ///
+ public float Width { get; set; } = OOPSux.DEFAULT_SECTION_WIDTH;
+ public float HudWidth { get; set; } = OOPSux.DEFAULT_SECTION_WIDTH;
+
+ public Color HudBackgroundColor { get; set; } = OOPSux.DEFAULT_HUD_BACKGROUND_COLOR;
+ public void SetHudBackgroundColor(Color newColor) {
+ HudBackgroundColor = newColor;
+ this.Window?.SetBackgroundTexture();
+ }
+
+ ///
+ /// Whether to display the names/labels in front of each readout in this section when in HUD mode. Can also be toggled per-readout-type in ReadoutModuleConfigNode.
+ ///
+ public bool HideHudReadoutNames { get; set; } = false;
+
///
/// Gets and sets the name of the section.
///
public string Name { get; set; }
+
+ ///
+ /// Which group of sections this is in, for toggling visibility of several HUD elements at once.
+ ///
+ public int HudGroup { get; set; } = 1;
///
/// Gets and sets the names of the installed readout modules. (Only used with serialisation.)
diff --git a/KerbalEngineer/Flight/Sections/SectionWindow.cs b/KerbalEngineer/Flight/Sections/SectionWindow.cs
index 050ed1aa..85534979 100644
--- a/KerbalEngineer/Flight/Sections/SectionWindow.cs
+++ b/KerbalEngineer/Flight/Sections/SectionWindow.cs
@@ -33,6 +33,7 @@ public class SectionWindow : MonoBehaviour {
private bool resizeRequested;
private int windowId;
private Rect windowPosition;
+ private bool dragStartedOnUs = false;
#endregion
@@ -61,6 +62,10 @@ public Rect WindowPosition {
private GUIStyle hudWindowStyle;
private GUIStyle windowStyle;
+ private const int BORDER_WIDTH = 1, BORDER_TEXTURE_DIMENSIONS = BORDER_WIDTH * 2 + 1;
+ private static Texture2D borderTexture;
+ private static GUIStyle borderStyle;
+
#endregion
///
@@ -69,31 +74,33 @@ public Rect WindowPosition {
private void InitialiseStyles() {
this.windowStyle = new GUIStyle(HighLogic.Skin.window) {
margin = new RectOffset(),
- padding = new RectOffset(5, 5, 0, 5),
+ padding = new RectOffset(3, 3, 0, 5),
};
this.hudWindowStyle = new GUIStyle(this.windowStyle) {
- normal =
- {
- background = null
- },
- onNormal =
- {
- background = null
- },
- padding = new RectOffset(5, 5, 0, 8),
- };
-
- this.hudWindowBgStyle = new GUIStyle(this.hudWindowStyle) {
- normal =
- {
- background = TextureHelper.CreateTextureFromColour(new Color(0.0f, 0.0f, 0.0f, 0.5f))
- },
- onNormal =
- {
- background = TextureHelper.CreateTextureFromColour(new Color(0.0f, 0.0f, 0.0f, 0.5f))
- }
+ normal = { background = null },
+ onNormal = { background = null },
+ padding = new RectOffset(3, 3, 0, 10),
};
+ SetBackgroundTexture(); //Initializes hudWindowBgStyle based on hudWindowStyle
+
+ //Hardest stroked DrawRect in the universe
+ if (borderTexture == null) {
+ borderTexture = new Texture2D(BORDER_TEXTURE_DIMENSIONS, BORDER_TEXTURE_DIMENSIONS);
+ Color[] textureArray = new Color[BORDER_TEXTURE_DIMENSIONS * BORDER_TEXTURE_DIMENSIONS];
+ for (int i = 0; i < textureArray.Length; i++) textureArray[i] = new Color(0.0f, 1.0f, 0.0f, 1.0f);
+ borderTexture.filterMode = FilterMode.Point;
+ //borderTexture.wrapMode = TextureWrapMode.Clamp;
+ borderTexture.SetPixels(textureArray);
+ borderTexture.SetPixel(BORDER_WIDTH, BORDER_WIDTH, new Color(0.0f, 0.0f, 0.0f, 0.0f));
+ borderTexture.Apply();
+ }
+ if (borderStyle == null) {
+ borderStyle = new GUIStyle() {
+ normal = { background = borderTexture },
+ border = new RectOffset(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH)
+ };
+ }
}
private void OnSizeChanged() {
@@ -109,9 +116,9 @@ private void OnSizeChanged() {
/// Called to draw the floating section window when the UI is enabled.
///
private void OnGUI() {
- if (!HighLogic.LoadedSceneIsFlight || this.ParentSection == null || !this.ParentSection.IsVisible || DisplayStack.Instance == null || this.ParentSection == null || (DisplayStack.Instance.Hidden && !this.ParentSection.IsHud) || !FlightEngineerCore.IsDisplayable) {
- return;
- }
+ if (!HighLogic.LoadedSceneIsFlight || this.ParentSection == null || !this.ParentSection.IsVisible || DisplayStack.Instance == null ||
+ (DisplayStack.Instance.Hidden && !this.ParentSection.IsHud) || (this.ParentSection.IsHud && !this.ParentSection.IsHudVisible) || !FlightEngineerCore.IsDisplayable)
+ { return; }
if (this.resizeRequested) {
this.windowPosition.width = 0;
@@ -120,16 +127,46 @@ private void OnGUI() {
}
GUI.skin = null;
this.windowPosition = GUILayout.Window(this.windowId, this.windowPosition, this.Window, string.Empty,
- (!this.ParentSection.IsHud || this.ParentSection.IsEditorVisible) ? this.windowStyle
+ !this.ParentSection.IsHud ? this.windowStyle
: this.ParentSection.IsHudBackground && this.ParentSection.LineCount > 0
? this.hudWindowBgStyle
: this.hudWindowStyle);
windowPosition = (ParentSection.IsHud) ? windowPosition.ClampInsideScreen() : windowPosition.ClampToScreen();
+
+ if (this.ParentSection.IsHud && this.ParentSection.IsEditorVisible) {
+ GUI.depth = -1000;
+ GUI.Box(this.windowPosition, GUIContent.none, borderStyle);
+ }
this.ParentSection.FloatingPositionX = this.windowPosition.x;
this.ParentSection.FloatingPositionY = this.windowPosition.y;
+
+
+ switch (Event.current.type) {
+ case EventType.MouseDown:
+ dragStartedOnUs = this.windowPosition.Contains(Event.current.mousePosition);
+
+ if (Event.current.button == 2 /* MMB */ && Event.current.alt && this.ParentSection.IsHud && dragStartedOnUs) {
+ this.ParentSection.IsEditorVisible = !this.ParentSection.IsEditorVisible;
+ }
+ break;
+
+ case EventType.MouseDrag:
+ if ((!this.ParentSection.IsHud || this.ParentSection.IsEditorVisible) &&
+ dragStartedOnUs && ResizingWidth())
+ {
+ if (ParentSection.IsHud) ParentSection.HudWidth += Event.current.delta.x;
+ else ParentSection.Width += Event.current.delta.x;
+ this.resizeRequested = true;
+ }
+ break;
+
+ case EventType.MouseUp:
+ dragStartedOnUs = false;
+ break;
+ }
}
///
@@ -138,7 +175,7 @@ private void OnGUI() {
private void Window(int windowId) {
this.ParentSection.Draw();
- if (!this.ParentSection.IsHud || this.ParentSection.IsEditorVisible) {
+ if ((!this.ParentSection.IsHud || this.ParentSection.IsEditorVisible) && !ResizingWidth() && Event.current.button <= 0 /* LMB */) {
GUI.DragWindow();
}
}
@@ -165,6 +202,14 @@ public void RequestResize() {
this.resizeRequested = true;
}
+ public void SetBackgroundTexture() {
+ var hudBackgroundColorTexture = TextureHelper.CreateTextureFromColour(this.ParentSection == null ? new Color(0.0f, 0.0f, 0.0f, 0.5f) : this.ParentSection.HudBackgroundColor);
+ this.hudWindowBgStyle = new GUIStyle(this.hudWindowStyle) {
+ normal = { background = hudBackgroundColorTexture },
+ onNormal = { background = hudBackgroundColorTexture }
+ };
+ }
+
#endregion
#region Methods: private
@@ -179,6 +224,8 @@ private void Start() {
GuiDisplaySize.OnSizeChanged += this.OnSizeChanged;
}
+ private bool ResizingWidth() { return Event.current.button == 1 /* RMB */ || (Event.current.alt && Event.current.button <= 1 /* LMB/RMB */); }
+
#endregion
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Helpers/Units.cs b/KerbalEngineer/Helpers/Units.cs
index 5d5f3f48..82633f5a 100644
--- a/KerbalEngineer/Helpers/Units.cs
+++ b/KerbalEngineer/Helpers/Units.cs
@@ -30,45 +30,56 @@ public static string Concat(int value1, int value2) {
return value1 + " / " + value2;
}
- public static string ConcatF(double value1, double value2, int decimals = 1) {
+ public static string ConcatF(double value1, double value2, int decimals = -9000) {
+ if (decimals < 0) decimals = 1;
return value1.ToString("F" + decimals) + " / " + value2.ToString("F" + decimals);
}
- public static string ConcatF(double value1, double value2, double value3, int decimals = 1) {
+ public static string ConcatF(double value1, double value2, double value3, int decimals = -9000) {
+ if (decimals < 0) decimals = 1;
return value1.ToString("F" + decimals) + " / " + value2.ToString("F" + decimals) + " / " + value3.ToString("F" + decimals);
}
- public static string ConcatN(double value1, double value2, int decimals = 1) {
+ public static string ConcatN(double value1, double value2, int decimals = -9000) {
+ if (decimals < 0) decimals = 1;
return value1.ToString("N" + decimals) + " / " + value2.ToString("N" + decimals);
}
- public static string ConcatN(double value1, double value2, double value3, int decimals = 1) {
+ public static string ConcatN(double value1, double value2, double value3, int decimals = -9000) {
+ if (decimals < 0) decimals = 1;
return value1.ToString("N" + decimals) + " / " + value2.ToString("N" + decimals) + " / " + value3.ToString("N" + decimals);
}
- public static string Cost(double value, int decimals = 1) {
+ public static string Cost(double value, int decimals = -9000) {
+ if (decimals < 0) decimals = 1;
+
if (value >= 1000000.0) {
return (value / 1000.0).ToString("N" + decimals) + "K";
}
return value.ToString("N" + decimals);
}
- public static string Cost(double value1, double value2, int decimals = 1) {
+ public static string Cost(double value1, double value2, int decimals = -9000) {
+ if (decimals < 0) decimals = 1;
+
if (value1 >= 1000000.0 || value2 >= 1000000.0) {
return (value1 / 1000.0).ToString("N" + decimals) + " / " + (value2 / 1000.0).ToString("N" + decimals) + "K";
}
return value1.ToString("N" + decimals) + " / " + value2.ToString("N" + decimals);
}
- public static string ToAcceleration(double value, int decimals = 2) {
+ public static string ToAcceleration(double value, int decimals = -9000) {
+ if (decimals < 0) decimals = 2;
return value.ToString("N" + decimals) + "m/s²";
}
- public static string ToAcceleration(double value1, double value2, int decimals = 2) {
+ public static string ToAcceleration(double value1, double value2, int decimals = -9000) {
+ if (decimals < 0) decimals = 2;
return value1.ToString("N" + decimals) + " / " + value2.ToString("N" + decimals) + "m/s²";
}
- public static string ToAngle(double value, int decimals = 5) {
+ public static string ToAngle(double value, int decimals = -9000) {
+ if (decimals < 0) decimals = 3;
return value.ToString("F" + decimals) + "°";
}
@@ -82,7 +93,9 @@ public static string ToAngleDMS(double value) {
return string.Format("{0:0}° {1:00}' {2:00}\"", deg, min, sec);
}
- public static string ToDistance(double value, int decimals = 1) {
+ public static string ToDistance(double value, int decimals = -9000) {
+ if (decimals < 0) decimals = 1;
+
if (Math.Abs(value) < 1000000.0) {
if (Math.Abs(value) >= 10.0) {
return value.ToString("N" + decimals) + "m";
@@ -124,7 +137,8 @@ public static string ToMach(double value) {
return value.ToString("0.00") + "Ma";
}
- public static string ToMass(double value, int decimals = 0) {
+ public static string ToMass(double value, int decimals = -9000) {
+ if (decimals < 0) decimals = 0;
if (value > 1 * 10e12) {
return value.ToString("e" + decimals + 8) + "t";
@@ -138,7 +152,9 @@ public static string ToMass(double value, int decimals = 0) {
return value.ToString("N" + decimals) + "kg";
}
- public static string ToMass(double value1, double value2, int decimals = 0) {
+ public static string ToMass(double value1, double value2, int decimals = -9000) {
+ if (decimals < 0) decimals = 0;
+
if (value1 >= 1000.0f || value2 >= 1000.0f) {
return value1.ToString("N" + decimals + 2) + " / " + value2.ToString("N" + decimals + 2) + "t";
}
@@ -148,7 +164,9 @@ public static string ToMass(double value1, double value2, int decimals = 0) {
return value1.ToString("N" + decimals) + " / " + value2.ToString("N" + decimals) + "kg";
}
- public static string ToPercent(double value, int decimals = 2) {
+ public static string ToPercent(double value, int decimals = -9000) {
+ if (decimals < 0) decimals = 2;
+
value *= 100.0;
return value.ToString("F" + decimals) + "%";
}
@@ -157,11 +175,14 @@ public static string ToPressure(double value) {
return value.ToString((value < 100000.0) ? (value < 10000.0) ? (value < 100.0) ? (Math.Abs(value) < double.Epsilon) ? "N0" : "N3" : "N2" : "N1" : "N0") + "kN/m²";
}
- public static string ToRate(double value, int decimals = 1) {
+ public static string ToRate(double value, int decimals = -9000) {
+ if (decimals < 0) decimals = 1;
return value < 1.0 ? (value * 60.0).ToString("F" + decimals) + "/min" : value.ToString("F" + decimals) + "/sec";
}
- public static string ToSpeed(double value, int decimals = 2) {
+ public static string ToSpeed(double value, int decimals = -9000) {
+ if (decimals < 0) decimals = 2;
+
if (Math.Abs(value) < 1.0) {
return (value * 1000.0).ToString("N" + decimals) + "mm/s";
}
diff --git a/KerbalEngineer/Helpers/XmlHelper.cs b/KerbalEngineer/Helpers/XmlHelper.cs
index 77a8cfee..84470d35 100644
--- a/KerbalEngineer/Helpers/XmlHelper.cs
+++ b/KerbalEngineer/Helpers/XmlHelper.cs
@@ -33,7 +33,7 @@ public static T LoadObject(string path)
}
///
- /// Loads and object from disk.
+ /// Loads an object from disk.
///
public static bool LoadObject(string path, out T obj)
{
diff --git a/KerbalEngineer/KerbalEngineer.csproj b/KerbalEngineer/KerbalEngineer.csproj
index e0af6a3a..c3bf010b 100644
--- a/KerbalEngineer/KerbalEngineer.csproj
+++ b/KerbalEngineer/KerbalEngineer.csproj
@@ -1,5 +1,5 @@
-
+
Debug
@@ -9,7 +9,7 @@
Properties
KerbalEngineer
KerbalEngineer
- v4.0
+ v4.8
512
@@ -119,18 +119,21 @@
+
+
+
@@ -138,6 +141,8 @@
+
+
@@ -154,7 +159,13 @@
+
+
+
+
+
+
@@ -280,6 +291,8 @@
+
+
@@ -292,7 +305,7 @@
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\Assembly-CSharp.dll
False
@@ -304,43 +317,43 @@
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.dll
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.AnimationModule.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.AnimationModule.dll
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.AssetBundleModule.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.AssetBundleModule.dll
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.CoreModule.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.CoreModule.dll
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.IMGUIModule.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.IMGUIModule.dll
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.InputLegacyModule.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.InputLegacyModule.dll
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.PhysicsModule.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.PhysicsModule.dll
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.TextRenderingModule.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.TextRenderingModule.dll
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.UI.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.UI.dll
False
- X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.UIModule.dll
+ $(KSP_DEV)\English\KSP_x64_Data\Managed\UnityEngine.UIModule.dll
False
@@ -366,11 +379,11 @@
PostBuildMacros;
xcopy "$(SolutionDir)AssetBundles\*" "$(SolutionDir)Output\KerbalEngineer\AssetBundles\*" /E /Y
-xcopy "$(SolutionDir)Output\*" "$(SolutionDir)..\..\KSP-Environment\GameData\*" /E /Y
+xcopy "$(SolutionDir)Output\*" "$(KSP_DEV)\English\GameData\*" /E /Y
del "$(SolutionDir)Release\*" /Q
xcopy "$(SolutionDir)Documents\*" "$(SolutionDir)Release\Documents\*" /E /Y
-"C:\Program Files (x86)\7-Zip\7z.exe" a -tzip -mx3 "$(SolutionDir)Release\$(ProjectName)-@(VersionNumber).zip" "$(SolutionDir)Output\*"
-"C:\Program Files (x86)\7-Zip\7z.exe" a -tzip -mx3 "$(SolutionDir)Release\$(ProjectName)-@(VersionNumber).zip" "$(SolutionDir)Documents\*"
+"C:\Program Files\7-Zip\7z.exe" a -tzip -mx3 "$(SolutionDir)Release\$(ProjectName)-@(VersionNumber).zip" "$(SolutionDir)Output\*"
+"C:\Program Files\7-Zip\7z.exe" a -tzip -mx3 "$(SolutionDir)Release\$(ProjectName)-@(VersionNumber).zip" "$(SolutionDir)Documents\*"