C# (CSharp) BetterBurnTime Пространство имен

Классы

Имя Описание
BetterBurnTime
BetterBurnTimeData This class is intended as the "public API" of the BetterBurnTime mod. It exposes the various numbers that BetterBurnTime produces, in a way that's programmatically accessible to other mods. Since it's considered to be a public API, the author will try to ensure, where possible, that this API will stay consistent even when other internals of BetterBurnTime may change around. This is so that mods which may depend on this API won't break. Since this is a VesselModule, KSP will automatically add an instance of it to every ship in the game. The default state for a freshly-created BetterBurnTimeData is for it to contain no data (e.g. burn type will be None, values will be placeholders such as NaN, -1, etc.). Consumers of the data here need to check for validity (e.g. "is it NaN?") whenever reading a value, and handle the not-valid case appropriately. Note that the BetterBurnTime mod only actually tracks the currently piloted vessel. The BetterBurnTimeData object for the current vessel will be continuously updated by the mod. The BetterBurnTimeData objects for all other vessels (i.e. those that aren't currently being piloted) won't be updated, they'll just sit there with obsolete data. Therefore, you should only ever use the BetterBurnTimeData object for the currently piloted vessel. You can access this via the static Current property on the class, which will return null if there's not any current vessel. How you consume this API depends on whether your mod has a "hard" or a "soft" depedency on BetterBurnTime. If you have a "hard" dependency-- i.e. if your mod's assembly has an actual reference to BetterBurnTime's assembly, and won't load unless BetterBurnTime is present-- then you can just call the Current property, and (if it's not null) access the data members on it. If you have a "soft" dependency-- i.e. no assembly reference, and you want your mod to be able to run regardless of whether BetterBurnTime is present-- then you can ask the currently-piloted vessel for its VesselModule list, iterate the list until you find one whose class name is BetterBurnTimeData, then access the properties by name via the Fields property on it. For an example of code that talks to this API via a soft dependency, see the BetterBurnTimeDataExample.cs file.
ClosestApproachTracker
ImpactTracker
ImpactTracker.PartAltitude
SafeText Provides a safe wrapper to avoid getting NullReferenceExceptions from Unity 5. See comments on their bizarre, insane implementation of operator== here: http://blogs.unity3d.com/2014/05/16/custom-operator-should-we-keep-it/ ...the moral of the story being, if you have a persistent reference to a UI object, you have to check it for "== null" every time you want to use it.