예제 #1
0
        private void OnDestroy()
        {
            if (vessel != null &&
                vessel.gameObject.activeInHierarchy &&
                FlightGlobals.fetch != null &&
                ReferenceEquals(FlightGlobals.fetch.VesselTarget, this))
            {
                vessel.StartCoroutine(CallbackUtil.DelayedCallback(1,
                                                                   FlightGlobals.fetch.SetVesselTarget,
                                                                   vessel,
                                                                   false));
            }
            Fields[nameof(numSegments)].OnValueModified        -= onNumSegmentsChange;
            Fields[nameof(ShowUI)].OnValueModified             -= showUI;
            Fields[nameof(ShowConstructionUI)].OnValueModified -= showConstructionUI;
            GameEvents.onVesselWasModified.Remove(onVesselWasModified);
            GameEvents.onVesselCrewWasModified.Remove(onVesselCrewWasModified);
            axisController?.Disconnect();
            axisController = null;
            UI?.Close();
            cUI?.Close();
#if NIGHTBUILD
            GlobalsReloader.RemoveListener(onGlobalsLoaded);
#endif
        }