public void OnVesselRecoveryRequested(Vessel vessel)
        {
            long currentEndTime = GetTimeInTicks();

            EndFlightEvent endFlight = new EndFlightEvent();

            endFlight.time      = currentEndTime;
            endFlight.finalMass = 0;

            foreach (var part in vessel.parts)
            {
                endFlight.finalMass += part.GetResourceMass() + part.mass;
            }
            endFlight.crewMembers = new List <string>();
            foreach (ProtoCrewMember kerbal in vessel.GetVesselCrew())
            {
                endFlight.crewMembers.Add(kerbal.name);
            }

            LaunchEvent launch = GetLaunch(vessel);

            launch.shipID = vessel.id.ToString();
            if (launch != null)
            {
                launch.AddEvent(endFlight);
            }

            foreach (ProtoCrewMember kerbal in vessel.GetVesselCrew())
            {
                EndFlightCrewEvent crewEndFlight = new EndFlightCrewEvent();
                crewEndFlight.time = currentEndTime;
                GetKerbalLaunch(kerbal.name).AddEvent(crewEndFlight);
            }
            FlightGUI.SaveData();
        }
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         InitEventListeners();
     }
 }
 internal void OnRecoveryProcessing(ProtoVessel data0, MissionRecoveryDialog data1, float data2)
 {
     foreach (var launch in launches)
     {
         if (data0.vesselID.ToString() == launch.shipID)
         {
             launch.SetSciencePoints(data1.scienceEarned);
         }
     }
     FlightGUI.SaveData();
 }
        internal void OnEndFlight(ProtoVessel protoVessel, bool data1)
        {
            LaunchEvent launch = GetLaunchByVesselId(protoVessel.vesselID.ToString());

            if (launch == null || launch.GetLastEvent() is EndFlightEvent)
            {
                return;
            }
            EndFlightEvent endFlight = new EndFlightEvent();

            endFlight.finalMass = 0;
            foreach (var part in protoVessel.protoPartSnapshots)
            {
                endFlight.finalMass += part.mass;
            }
            endFlight.crewMembers = new List <string>();
            foreach (var kerbal in protoVessel.GetVesselCrew())
            {
                endFlight.crewMembers.Add(kerbal.name);
            }
            launch.AddEvent(endFlight);
            FlightGUI.SaveData();
        }