예제 #1
0
        private void updateVesselData()
        {
            var vessel = this.currentVessel;

            bool hasNextNode = false;

            var nextNodeTime = Vessel.GetNextManeuverTime(vessel, out hasNextNode);

            // some stuff doesn't need to be updated if it's not changing
            var shouldUpdate = vessel.isActiveVessel || vessel.loaded || !this.vesselData.Id.Equals(vessel.id);

            var vesselData = new VesselData
            {
                Id           = vessel.id,
                OrbitData    = OrbitData.FromOrbit(vessel.orbit),
                Resources    = shouldUpdate ? updateVesselResourceData(vessel) : this.vesselData.Resources,
                CrewData     = shouldUpdate ? this.updateVesselCrewData(vessel) : this.vesselData.CrewData,
                MET          = Converters.Duration(Math.Abs(vessel.missionTime)),
                HasNextNode  = hasNextNode,
                NextNodeIn   = "T " + KSPUtil.PrintTime(Planetarium.GetUniversalTime() - nextNodeTime, 3, true),
                NextNodeTime = KSPUtil.PrintDateCompact(nextNodeTime, true, true),
                Situation    = Vessel.GetSituationString(vessel),
            };

            this.vesselData = vesselData;
        }
예제 #2
0
        private void updateBodyData()
        {
            var body = this.currentBody;
            var same = body.bodyName.GetHashCode() == this.bodyData.Id;

            var newBodyData = new BodyData
            {
                Id        = body.bodyName.GetHashCode(),
                OrbitData = body.orbit != null?OrbitData.FromOrbit(body.orbit) : new OrbitData(),
                                PhysicalData = same ? this.bodyData.PhysicalData : getPhysicalData(body),
                                AtmData      = same ? this.bodyData.AtmData : getAtmData(body),
                                SciData      = same ? this.bodyData.SciData : getSciData(body),
                                Satellites   = same ? this.bodyData.Satellites : getSatellites(body),
            };

            this.bodyData = newBodyData;
        }