Example #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
        }
Example #2
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;
     DontDestroyOnLoad(gameObject);
 }
Example #3
0
        /// <summary>
        /// Set up numSegments field controls
        /// </summary>
        private void setupNumSegmentsControls()
        {
            var numSegmentsField = Fields[nameof(numSegments)];

            numSegmentsField.OnValueModified += onNumSegmentsChange;
            if (numSegmentsField.uiControlEditor is UI_FloatRange numSegmentsControlEditor)
            {
                numSegmentsControlEditor.maxValue = MaxSegments;
            }
            if (numSegmentsField.uiControlFlight is UI_FloatRange numSegmentsControlFlight)
            {
                numSegmentsControlFlight.maxValue = MaxSegments;
            }
            numSegmentsField.guiActive = GLB.TestingMode;
#if NIGHTBUILD
            GlobalsReloader.AddListener(onGlobalsLoaded);
#endif
        }