protected override void OnLoad(ConfigNode node) { if (!TimekeeperSettings.ModEnabled) { return; } Core.Log("OnLoad(" + node.CountValues + " values)"); if (node.HasValue("mode")) { mode = (CountModes)Enum.Parse(typeof(CountModes), node.GetValue("mode"), true); } else { mode = CountModes.None; } if ((mode == CountModes.None) || ((mode == CountModes.Orbits) && !TimekeeperSettings.CountOrbits) || ((mode == CountModes.Sols) && !TimekeeperSettings.CountSols)) { mode = CountModes.None; return; } time = Core.GetDouble(node, "time"); count = Core.GetInt(node, "count"); if (mode == CountModes.Orbits) { phase = Core.GetDouble(node, "phase"); } else { paused = Core.GetBool(node, "paused"); } }
void SolsStart() { if (!TimekeeperSettings.CountSols) { return; } mode = CountModes.Sols; count = 0; time = Planetarium.GetUniversalTime(); paused = false; Core.Log(Vessel.vesselName + " has begun counting sols at UT " + time); DisplayData(); }
void OrbitsStart() { if (!TimekeeperSettings.CountOrbits) { return; } mode = CountModes.Orbits; count = 0; time = Planetarium.GetUniversalTime(); phase = 0; paused = false; Core.Log(Vessel.vesselName + " has begun orbiting @ " + time + " with period of " + Vessel.orbit.period.ToString("F1")); DisplayData(); }
public TimerText(SpriteFont font, TimerModes mode, CountModes countMode, int frames, Vector2 justify, Action onComplete = null) : base(true) { this.font = font; this.timerMode = mode; this.CountMode = countMode; this.frames = frames; this.justify = justify; #if DEBUG if (frames < 0) throw new Exception("Frames must be larger than or equal to zero!"); #endif OnComplete = onComplete; UpdateText(); CalculateOrigin(); }
public TimerText(SpriteFont font, TimerModes mode, CountModes countMode, int frames, Vector2 justify, Action onComplete = null) : base(true) { this.font = font; this.timerMode = mode; this.CountMode = countMode; this.frames = frames; this.justify = justify; #if DEBUG if (frames < 0) { throw new Exception("Frames must be larger than or equal to zero!"); } #endif OnComplete = onComplete; UpdateText(); CalculateOrigin(); }
void StopTimekeeping() { mode = CountModes.None; count = 0; }