1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | // // Copyright (C) 2015 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 <http://www.gnu.org/licenses/>. // namespace KerbalEngineer.Flight.Readouts { using System; using System.Collections.Generic; using System.Linq; using Miscellaneous; using Orbital; using Orbital.ManoeuvreNode; using Rendezvous; using Settings; using Surface; using Thermal; using Vessel; using AltitudeSeaLevel = Surface.AltitudeSeaLevel; using ApoapsisHeight = Orbital.ApoapsisHeight; using OrbitalPeriod = Orbital.OrbitalPeriod; using PeriapsisHeight = Orbital.PeriapsisHeight; using SemiMajorAxis = Orbital.SemiMajorAxis; using SemiMinorAxis = Orbital.SemiMinorAxis; using TimeToApoapsis = Orbital.TimeToApoapsis; using TimeToPeriapsis = Orbital.TimeToPeriapsis; public static class ReadoutLibrary { private static List<ReadoutModule> readouts = new List<ReadoutModule>(); /// <summary> /// Sets up and populates the readout library with the stock readouts. /// </summary> static ReadoutLibrary() { try { ReadoutCategory.SetCategory("Orbital", "Readout for orbital manovoeures."); ReadoutCategory.SetCategory("Surface", "Surface and atmospheric readouts."); ReadoutCategory.SetCategory("Vessel", "Vessel performance statistics."); ReadoutCategory.SetCategory("Rendezvous", "Readouts for rendezvous manovoeures."); ReadoutCategory.SetCategory("Thermal", "Thermal characteristics readouts."); ReadoutCategory.SetCategory("Miscellaneous", "Miscellaneous readouts."); ReadoutCategory.Selected = ReadoutCategory.GetCategory("Orbital"); // Orbital readouts.Add(new ApoapsisHeight()); readouts.Add(new PeriapsisHeight()); readouts.Add(new TimeToApoapsis()); readouts.Add(new TimeToPeriapsis()); readouts.Add(new Inclination()); readouts.Add(new TimeToEquatorialAscendingNode()); readouts.Add(new TimeToEquatorialDescendingNode()); readouts.Add(new AngleToEquatorialAscendingNode()); readouts.Add(new AngleToEquatorialDescendingNode()); readouts.Add(new Eccentricity()); readouts.Add(new OrbitalSpeed()); readouts.Add(new OrbitalPeriod()); readouts.Add(new CurrentSoi()); readouts.Add(new LongitudeOfAscendingNode()); readouts.Add(new LongitudeOfPeriapsis()); readouts.Add(new ArgumentOfPeriapsis()); readouts.Add(new TrueAnomaly()); readouts.Add(new MeanAnomaly()); readouts.Add(new MeanAnomalyAtEpoc()); readouts.Add(new EccentricAnomaly()); readouts.Add(new SemiMajorAxis()); readouts.Add(new SemiMinorAxis()); readouts.Add(new AngleToPrograde()); readouts.Add(new AngleToRetrograde()); readouts.Add(new NodeProgradeDeltaV()); readouts.Add(new NodeNormalDeltaV()); readouts.Add(new NodeRadialDeltaV()); readouts.Add(new NodeTotalDeltaV()); readouts.Add(new NodeBurnTime()); readouts.Add(new NodeHalfBurnTime()); readouts.Add(new NodeTimeToManoeuvre()); readouts.Add(new NodeTimeToHalfBurn()); readouts.Add(new NodeAngleToPrograde()); readouts.Add(new NodeAngleToRetrograde()); readouts.Add(new PostBurnApoapsis()); readouts.Add(new PostBurnPeriapsis()); readouts.Add(new SpeedAtApoapsis()); readouts.Add(new SpeedAtPeriapsis()); readouts.Add(new TimeToAtmosphere()); // Surface readouts.Add(new AltitudeSeaLevel()); readouts.Add(new AltitudeTerrain()); readouts.Add(new VerticalSpeed()); readouts.Add(new VerticalAcceleration()); readouts.Add(new HorizontalSpeed()); readouts.Add(new HorizontalAcceleration()); readouts.Add(new MachNumber()); readouts.Add(new Latitude()); readouts.Add(new Longitude()); readouts.Add(new GeeForce()); readouts.Add(new TerminalVelocity()); readouts.Add(new AtmosphericEfficiency()); readouts.Add(new Biome()); readouts.Add(new Situation()); readouts.Add(new Slope()); readouts.Add(new ImpactTime()); readouts.Add(new ImpactLongitude()); readouts.Add(new ImpactLatitude()); readouts.Add(new ImpactAltitude()); readouts.Add(new ImpactBiome()); // Vessel readouts.Add(new Name()); readouts.Add(new DeltaVStaged()); readouts.Add(new DeltaVCurrent()); readouts.Add(new DeltaVTotal()); readouts.Add(new DeltaVCurrentTotal()); readouts.Add(new SpecificImpulse()); readouts.Add(new Mass()); readouts.Add(new Thrust()); readouts.Add(new ThrustToWeight()); readouts.Add(new ThrustOffsetAngle()); readouts.Add(new ThrustTorque()); readouts.Add(new SurfaceThrustToWeight()); readouts.Add(new Acceleration()); readouts.Add(new SuicideBurnAltitude()); readouts.Add(new SuicideBurnDistance()); readouts.Add(new SuicideBurnDeltaV()); readouts.Add(new IntakeAirUsage()); readouts.Add(new IntakeAirDemand()); readouts.Add(new IntakeAirSupply()); readouts.Add(new IntakeAirDemandSupply()); readouts.Add(new PartCount()); readouts.Add(new Heading()); readouts.Add(new Pitch()); readouts.Add(new Roll()); readouts.Add(new HeadingRate()); readouts.Add(new PitchRate()); readouts.Add(new RollRate()); // Rendezvous readouts.Add(new TargetSelector()); readouts.Add(new PhaseAngle()); readouts.Add(new InterceptAngle()); readouts.Add(new RelativeVelocity()); readouts.Add(new RelativeSpeed()); readouts.Add(new RelativeInclination()); readouts.Add(new TimeToRelativeAscendingNode()); readouts.Add(new TimeToRelativeDescendingNode()); readouts.Add(new AngleToRelativeAscendingNode()); readouts.Add(new AngleToRelativeDescendingNode()); readouts.Add(new Rendezvous.AltitudeSeaLevel()); readouts.Add(new Rendezvous.ApoapsisHeight()); readouts.Add(new Rendezvous.PeriapsisHeight()); readouts.Add(new Rendezvous.TimeToApoapsis()); readouts.Add(new Rendezvous.TimeToPeriapsis()); readouts.Add(new Distance()); readouts.Add(new Rendezvous.OrbitalPeriod()); readouts.Add(new Rendezvous.SemiMajorAxis()); readouts.Add(new Rendezvous.SemiMinorAxis()); readouts.Add(new Rendezvous.RelativeRadialVelocity()); readouts.Add(new Rendezvous.TimeToRendezvous()); // Thermal readouts.Add(new InternalFlux()); readouts.Add(new ConvectionFlux()); readouts.Add(new RadiationFlux()); readouts.Add(new CriticalPart()); readouts.Add(new CriticalTemperature()); readouts.Add(new CriticalSkinTemperature()); readouts.Add(new CriticalThermalPercentage()); readouts.Add(new HottestPart()); readouts.Add(new HottestTemperature()); readouts.Add(new HottestSkinTemperature()); readouts.Add(new CoolestPart()); readouts.Add(new CoolestTemperature()); readouts.Add(new CoolestSkinTemperature()); // Misc readouts.Add(new Separator()); readouts.Add(new GuiSizeAdjustor()); readouts.Add(new SimulationDelay()); readouts.Add(new VectoredThrustToggle()); readouts.Add(new SystemTime()); readouts.Add(new LogSimToggle()); LoadHelpStrings(); } catch (Exception ex) { Logger.Exception(ex); } } /// <summary> /// Gets and sets the available readout modules. /// </summary> public static List<ReadoutModule> Readouts { get { return readouts; } set { readouts = value; } } /// <summary> /// Gets a list of readout modules which are associated with the specified category. /// </summary> public static List<ReadoutModule> GetCategory(ReadoutCategory category) { return readouts.Where(r => r.Category == category).ToList(); } /// <summary> /// Gets a readout module with the specified name or class name. (Returns null if not found.) /// </summary> public static ReadoutModule GetReadout(string name) { return readouts.FirstOrDefault(r => r.Name == name || r.GetType().Name == name || r.Category + "." + r.GetType().Name == name); } /// <summary> /// Resets all the readout modules. /// </summary> public static void Reset() { foreach (ReadoutModule readout in readouts) { readout.Reset(); } } /// <summary> /// Loads the help strings from file. /// </summary> private static void LoadHelpStrings() { try { SettingHandler handler = SettingHandler.Load("HelpStrings.xml"); foreach (ReadoutModule readout in readouts) { readout.HelpString = handler.GetSet(readout.Category + "." + readout.GetType().Name, readout.HelpString); } handler.Save("HelpStrings.xml"); } catch (Exception ex) { Logger.Exception(ex); } } } } |