Added readout help strings.
--- a/KerbalEngineer/Flight/Readouts/Orbital/ApoapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/ApoapsisHeight.cs
@@ -10,7 +10,7 @@
{
this.Name = "Apoapsis Height";
this.Category = ReadoutCategory.Orbital;
- this.HelpMessage = "Shows the vessel's <b><i>apoapsis height</i></b> relative to sea level.";
+ this.HelpString = "Shows the vessel's apoapsis height relative to sea level. (Apoapsis is the highest point of an orbit.)";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/Eccentricity.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/Eccentricity.cs
@@ -16,6 +16,7 @@
{
this.Name = "Eccentricity";
this.Category = ReadoutCategory.Orbital;
+ this.HelpString = "Shows the vessel's orbital eccentricity.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/Inclination.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/Inclination.cs
@@ -16,6 +16,7 @@
{
this.Name = "Inclination";
this.Category = ReadoutCategory.Orbital;
+ this.HelpString = "Shows the vessel's orbital inclination.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfAscendingNode.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfAscendingNode.cs
@@ -16,6 +16,7 @@
{
this.Name = "Longitude of AN";
this.Category = ReadoutCategory.Orbital;
+ this.HelpString = "Shows the vessel's longitude of the ascending node.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfPeriapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/LongitudeOfPeriapsis.cs
@@ -16,6 +16,7 @@
{
this.Name = "Longitude of Pe";
this.Category = ReadoutCategory.Orbital;
+ this.HelpString = "Shows the vessel's longitude of periapsis.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/OrbitalPeriod.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/OrbitalPeriod.cs
@@ -15,6 +15,8 @@
public OrbitalPeriod()
{
this.Name = "Orbital Period";
+ this.Category = ReadoutCategory.Orbital;
+ this.HelpString = "Shows the amount of time it will take to complete a full orbit.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/PeriapsisHeight.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/PeriapsisHeight.cs
@@ -10,7 +10,7 @@
{
this.Name = "Periapsis Height";
this.Category = ReadoutCategory.Orbital;
- this.HelpMessage = "Shows the vessel's <b><i>periapsis height</i></b> relative to sea level.";
+ this.HelpString = "Shows the vessel's periapsis height relative to sea level. (Periapsis is the lowest point of an orbit.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/SemiMajorAxis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/SemiMajorAxis.cs
@@ -16,6 +16,7 @@
{
this.Name = "Semi-Major Axis";
this.Category = ReadoutCategory.Orbital;
+ this.HelpString = "Shows the distance from the centre of an orbit to the farthest edge.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/SemiMinorAxis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/SemiMinorAxis.cs
@@ -16,6 +16,7 @@
{
this.Name = "Semi-Minor Axis";
this.Category = ReadoutCategory.Orbital;
+ this.HelpString = "Shows the distance from the centre of an orbit to the nearest edge.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToApoapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToApoapsis.cs
@@ -16,6 +16,7 @@
{
this.Name = "Time to Apoapsis";
this.Category = ReadoutCategory.Orbital;
+ this.HelpString = "Shows the time until the vessel reaches apoapsis, the highest point of the orbit.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToPeriapsis.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToPeriapsis.cs
@@ -16,6 +16,7 @@
{
this.Name = "Time to Periapsis";
this.Category = ReadoutCategory.Orbital;
+ this.HelpString = "Shows the time until the vessel reaches periapsis, the lowest point of the orbit.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
@@ -9,6 +9,7 @@
using KerbalEngineer.Flight.Readouts.Orbital;
using KerbalEngineer.Flight.Readouts.Surface;
+using KerbalEngineer.Settings;
#endregion
@@ -62,6 +63,8 @@
this.readoutModules.Add(new Longitude());
this.readoutModules.Add(new Latitude());
this.readoutModules.Add(new GeeForce());
+
+ this.LoadHelpStrings();
}
#endregion
@@ -79,7 +82,7 @@
#endregion
- #region Methods
+ #region Public Methods
/// <summary>
/// Gets a readout module with the specified name or class name. (Returns null if not found.)
@@ -109,5 +112,22 @@
}
#endregion
+
+ #region Private Methods
+
+ /// <summary>
+ /// Loads the help strings from file.
+ /// </summary>
+ private void LoadHelpStrings()
+ {
+ var handler = SettingHandler.Load("HelpStrings.xml");
+ foreach (var readout in this.readoutModules)
+ {
+ readout.HelpString = handler.GetSet(readout.GetType().Name, readout.HelpString);
+ }
+ handler.Save("HelpStrings.xml");
+ }
+
+ #endregion
}
}
--- a/KerbalEngineer/Flight/Readouts/ReadoutModule.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutModule.cs
@@ -31,7 +31,7 @@
/// </summary>
public string Name { get; set; }
- public string HelpMessage { get; set; }
+ public string HelpString { get; set; }
public bool ShowHelp { get; set; }
@@ -113,7 +113,7 @@
#endregion
- #region Public Methods
+ #region Protected Methods
/// <summary>
/// Draws a single data line.
--- a/KerbalEngineer/Flight/Readouts/Surface/AltitudeSeaLevel.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/AltitudeSeaLevel.cs
@@ -16,6 +16,7 @@
{
this.Name = "Altitude (Sea Level)";
this.Category = ReadoutCategory.Surface;
+ this.HelpString = "Shows the vessel's altitude above sea level.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Surface/AltitudeTerrain.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/AltitudeTerrain.cs
@@ -16,6 +16,7 @@
{
this.Name = "Altitude (Terrain)";
this.Category = ReadoutCategory.Surface;
+ this.HelpString = "Shows the vessel's altitude above the terrain.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Surface/GeeForce.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/GeeForce.cs
@@ -12,6 +12,7 @@
{
this.Name = "G-Force";
this.Category = ReadoutCategory.Surface;
+ this.HelpString = "Shows the current g-force and maximum g-force experienced.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Surface/HorizontalSpeed.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/HorizontalSpeed.cs
@@ -16,6 +16,7 @@
{
this.Name = "Horizontal Speed";
this.Category = ReadoutCategory.Surface;
+ this.HelpString = "Shows the vessel's horizontal speed across a celestial bodies surface.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Surface/Latitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Latitude.cs
@@ -16,6 +16,7 @@
{
this.Name = "Latitude";
this.Category = ReadoutCategory.Surface;
+ this.HelpString = "Shows the vessel's latitude position around the celestial body. Latitude is the angle from the equator to poles.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
@@ -16,6 +16,7 @@
{
this.Name = "Longitude";
this.Category = ReadoutCategory.Surface;
+ this.HelpString = "Shows the vessel's longitude around a celestial body. Longitude is the angle from the bodies prime meridian.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Readouts/Surface/VerticalSpeed.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/VerticalSpeed.cs
@@ -16,6 +16,7 @@
{
this.Name = "Vertical Speed";
this.Category = ReadoutCategory.Surface;
+ this.HelpString = "Shows the vessel's vertical speed up and down.";
}
public override void Draw()
--- a/KerbalEngineer/Flight/Sections/SectionEditor.cs
+++ b/KerbalEngineer/Flight/Sections/SectionEditor.cs
@@ -349,9 +349,9 @@
if (readout.ShowHelp)
{
GUILayout.BeginVertical(this.helpBoxStyle);
- if (readout.HelpMessage != null && readout.HelpMessage.Length > 0)
- {
- GUILayout.Label(readout.HelpMessage, this.helpTextStyle);
+ if (readout.HelpString != null && readout.HelpString.Length > 0)
+ {
+ GUILayout.Label(readout.HelpString, this.helpTextStyle);
}
else
{
--- a/KerbalEngineer/Settings/SettingHandler.cs
+++ b/KerbalEngineer/Settings/SettingHandler.cs
@@ -121,6 +121,50 @@
#endregion
+ #region GetSet Methods
+
+ /// <summary>
+ /// Gets a setting from its name or return the default object. Will add the object to the handler if it does not exist.
+ /// </summary>
+ public T GetSet<T>(string name, T defaultObject)
+ {
+ foreach (var item in this.Items)
+ {
+ if (item.Name == name)
+ {
+ return (T)Convert.ChangeType(item.Value, typeof(T));
+ }
+ }
+ if (defaultObject != null)
+ {
+ this.Items.Add(new SettingItem(name, defaultObject));
+ }
+ return defaultObject;
+ }
+
+ /// <summary>
+ /// Gets a setting from its name and inputs it into the output object. Will add the object to the handler if it does
+ /// not exist.
+ /// </summary>
+ public bool GetSet<T>(string name, ref T outputObject)
+ {
+ foreach (var item in this.Items)
+ {
+ if (item.Name == name)
+ {
+ outputObject = (T)Convert.ChangeType(item.Value, typeof(T));
+ return true;
+ }
+ }
+ if (outputObject != null)
+ {
+ this.Items.Add(new SettingItem(name, outputObject));
+ }
+ return false;
+ }
+
+ #endregion
+
#region Saving
/// <summary>
Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ