/// <summary> /// Here when the player manually changes the crew assignments in the editor. /// </summary> /// <param name="construct"></param> private void OnCrewChanged(ShipConstruct construct) { if (Crewable.CanList(construct)) { Logging.Log("Crew edited, persisting kerbal assignments."); AssignmentLogic.PersistKerbalAssignments(construct); LogVesselManifest(); } }
/// <summary> /// Here when exiting the crew panel. /// </summary> /// <param name="construct"></param> private void OnExitCrewPanel(ShipConstruct construct) { try { Logging.Log("Leaving crew screen, persisting kerbal assignments."); AssignmentLogic.PersistKerbalAssignments(CurrentShipConstruct); LogVesselManifest(); } catch (Exception e) { Logging.Exception(e); } }
/// <summary> /// Here when a ship is loaded in the editor. /// </summary> /// <param name="construct"></param> /// <param name="loadType"></param> private void OnShipLoaded(ShipConstruct construct, CraftBrowserDialog.LoadType loadType) { try { Logging.Log("Ship loaded, " + construct.Count + " parts. "); LogPreferredAssignments(construct); AssignmentLogic.AssignKerbals(construct); LogVesselManifest(); } catch (Exception e) { Logging.Exception(e); } }
/// <summary> /// Here when the ship is modified. /// </summary> /// <param name="construct"></param> private void OnShipModified(ShipConstruct construct) { try { if (Crewable.CanList(construct)) { Logging.Log("Ship modified, " + construct.Count + " parts."); AssignmentLogic.AssignKerbals(construct); } } catch (Exception e) { Logging.Exception(e); } }
/// <summary> /// Here when an event happens to the part in the editor. /// </summary> /// <param name="eventType"></param> /// <param name="part"></param> private void OnEditorPartEvent(ConstructionEventType eventType, Part part) { try { if (eventType != ConstructionEventType.PartAttached) { return; } if (Crewable.CanList(CurrentShipConstruct)) { Logging.Log("Attached " + Logging.ToString(part) + "."); AssignmentLogic.AssignKerbals(CurrentShipConstruct); } } catch (Exception e) { Logging.Exception(e); } }