public override void OnLoad(ConfigNode node)
        {
            if (node == null)
            {
                return;
            }

            Util.DebugLog("");

            //version = Util.ConfigValue(node, "version", Version);     // get saved version, defaults to current version if none

            Settings ??= new Settings();                          // get trajectories settings from the config.xml file if it exists or create a new one
            if (Settings != null)
            {
                Settings.Load();

                DescentProfile.Start();
                Trajectory.Start();
                MapOverlay.Start();
                FlightOverlay.Start();
                NavBallOverlay.Start();
                MainGUI.Start();
                AppLauncherButton.Start();
            }
            else
            {
                Util.LogError("There was a problem with the config.xml settings file");
            }
        }
 internal void Destroy()
 {
     Util.DebugLog("");
     DescentProfile.Destroy();
     FlightOverlay.Destroy();
     NavBallOverlay.Destroy();
     MapOverlay.Destroy();
 }
 internal Trajectory(Vessel vessel)
 {
     AttachedVessel = vessel;
     TargetProfile  = new TargetProfile(this);
     DescentProfile = new DescentProfile(this);
     FlightOverlay  = new FlightOverlay(this);
     MapOverlay     = new MapOverlay(this);
     NavBallOverlay = new NavBallOverlay(this);
     Util.DebugLog("Constructing");
 }
 internal void OnDestroy()
 {
     Util.DebugLog("");
     AttachedVessel = null;
     AppLauncherButton.DestroyToolbarButton();
     MainGUI.DeSpawn();
     NavBallOverlay.DestroyTransforms();
     FlightOverlay.Destroy();
     MapOverlay.DestroyRenderer();
     Trajectory.Destroy();
     DescentProfile.Clear();
 }
 internal void OnApplicationQuit()
 {
     Util.Log("Ending after {0} seconds", Time.time);
     AttachedVessel = null;
     AppLauncherButton.Destroy();
     MainGUI.Destroy();
     NavBallOverlay.Destroy();
     FlightOverlay.Destroy();
     MapOverlay.Destroy();
     Trajectory.Destroy();
     DescentProfile.Destroy();
     if (Settings != null)
     {
         Settings.Destroy();
     }
     Settings = null;
 }
Exemple #6
0
        /*public override void OnSave(ConfigNode node)
         * {
         *  if (node == null)
         *      return;
         *
         *  Util.DebugLog("Node: {0}", node.name);
         *
         *  //node.AddValue("version", Version);                       // save version
         * }*/

        internal void Update()
        {
            if (Util.IsPaused || Settings == null || !Util.IsFlight)
            {
                return;
            }

            if (AttachedVessel != FlightGlobals.ActiveVessel)
            {
                AttachVessel();
            }

            Trajectory.Update();
            MapOverlay.Update();
            FlightOverlay.Update();
            NavBallOverlay.Update();
            MainGUI.Update();
        }
        internal void Update()
        {
            //Profiler.Start("Trajectory.Update");

            // compute game frame time
            GameFrameTime = GameFrameTime * 0.9d + Util.ElapsedMilliseconds(frame_time) * 0.1d;
            frame_time    = Util.Clocks;

            // should the trajectory be calculated?
            if (Settings.DisplayTrajectories || Settings.AlwaysUpdate || TargetProfile.WorldPosition.HasValue)
            {
                ComputeTrajectory();
            }

            // compute computation time
            ComputationTime = ComputationTime * 0.9d + increment_time * 0.1d;

            //Profiler.Stop("Trajectory.Update");
            FlightOverlay.Update();
            MapOverlay.Update();
            NavBallOverlay.Update();
        }
        /*public override void OnSave(ConfigNode node)
         * {
         *  if (node == null)
         *      return;
         *
         *  Util.DebugLog("Node: {0}", node.name);
         *
         *  //node.AddValue("version", Version);                       // save version
         * }*/

        internal void Update()
        {
            if (Util.IsPaused || Settings == null || !Util.IsFlight)
            {
                return;
            }

            if (AttachedVessel != FlightGlobals.ActiveVessel)
            {
                AttachVessel();
            }

            Trajectory.Update();
            MapOverlay.Update();
            FlightOverlay.Update();
            NavBallOverlay.Update();
            MainGUI.Update();
            if (!Settings.NewGui)
#pragma warning disable CS0618 // Type or member is obsolete
            {
                OldGUI.Update();
            }
#pragma warning restore CS0618 // Type or member is obsolete
        }