示例#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 drawOrbit(OrbitData orbitData)
 {
     GUILayout.Label("Orbial information:", Resources.textListHeaderStyle);
     GUILayout.Label("SOI: " + orbitData.SOI, Resources.textVesselExpandedInfoItem);
     GUILayout.Label("Apoapsis: " + orbitData.AP, Resources.textVesselExpandedInfoItem);
     GUILayout.Label("Periapsis: " + orbitData.PE, Resources.textVesselExpandedInfoItem);
     GUILayout.Label("Time to AP: " + orbitData.timeToAP, Resources.textVesselExpandedInfoItem);
     GUILayout.Label("Time to PE: " + orbitData.timeToPE, Resources.textVesselExpandedInfoItem);
     GUILayout.Label("Orbital Period: " + orbitData.Period, Resources.textVesselExpandedInfoItem);
     GUILayout.Label("Inclination: " + orbitData.INC, Resources.textVesselExpandedInfoItem);
     if (orbitData.IsSOIChange)
     {
         GUILayout.Label("SOI Change Time: " + orbitData.SOIChangeTime, Resources.textVesselExpandedInfoItem);
         GUILayout.Label("SOI Change Date: " + orbitData.SOIChangeDate, Resources.textVesselExpandedInfoItem);
     }
 }
示例#3
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;
        }