Пример #1
0
        public void LateUpdate() //modify UI in late update or KSP default overrides afaik
        {
            try
            {
                if (_tumbler == null || _tumbler.tumbler == null)
                {
                    _tumbler = UnityEngine.Object.FindObjectOfType <KSP.UI.Screens.Flight.AltitudeTumbler>();

                    lhBtn = _tumbler.gameObject.AddComponent <Button>();
                    lhBtn.onClick.AddListener(() => { lhButtonClick(); });
                    AddText();
                }

                if (FlightGlobals.speedDisplayMode == FlightGlobals.SpeedDisplayModes.Surface && LHFlightData.lhGUImodeStatic == 1 || FlightGlobals.speedDisplayMode == FlightGlobals.SpeedDisplayModes.Surface && LHFlightData.lhGUImodeStatic == 2 || LHFlightData.lhGUImodeStatic == 4) //only override if in surface mode
                {
                    _tumbler.tumbler.SetValue(heightToLand());
                    _tumbler.SetModeTumbler(AltimeterDisplayState.AGL);
                }
                else if (FlightGlobals.speedDisplayMode == FlightGlobals.SpeedDisplayModes.Orbit)
                {
                    _tumbler.SetModeTumbler(AltimeterDisplayState.ASL);
                }
                if (spdDisp != FlightGlobals.speedDisplayMode) //how we detect mouse click on speed display mode.
                {
                    SetGUITextMode();
                }
            }
            catch
            {
                _tumbler = null;
                //no tumbler object found, we hit this on scene change, silently fail
            }
        }