protected override void OnWindow(int id)
            {
                // back
                GUI.DrawTexture(skinBounds, back);
                // text
                double value = GetValue();

                if (value == float.NaN)
                {
                    value = 0;
                }
                double scale = NanoGauges.configuration.gaugeScaling;

                if (value > MAX_VALUE)
                {
                    value = MAX_VALUE;
                }
                if (value < MIN_VALUE)
                {
                    value = MIN_VALUE;
                }
                display.SetValue((int)value);
                display.Draw((float)(10.0 * scale), (float)(17.0 * scale));
                // skin
                GUI.DrawTexture(skinBounds, skin);
            }
            protected override void AjustValues()
            {
                base.AjustValues();

                if (FlightInputHandler.state != null)
                {
                    int throttle = (int)(FlightInputHandler.state.mainThrottle * 100 + 0.5f);
                    if (throttle <= 100 && throttle >= 0)
                    {
                        throttleDisplay.SetValue(throttle);
                    }
                    else
                    {
                        throttleDisplay.SetValue(999);
                    }
                }
                else
                {
                    throttleDisplay.SetValue(0);
                }
            }
示例#3
0
            private void SetDigitals()
            {
                Vessel vessel = FlightGlobals.ActiveVessel;

                if (vessel == null)
                {
                    return;
                }
                switch (mode)
                {
                case DISPLAY_MODE.ORBIT:
                    int apa = 0;
                    int pea = 0;
                    int inc = 0;
                    if (vessel != null)
                    {
                        Orbit orbit = vessel.orbit;
                        apa = Bounds((orbit.ApA + 500) / 1000, 0, 99999);
                        pea = Bounds((orbit.PeA + 500) / 1000, 0, 99999);
                        inc = Bounds((orbit.inclination + 0.5), 0, 99999);
                    }
                    digital1.SetValue(apa);
                    digital2.SetValue(pea);
                    digital3.SetValue(inc);
                    break;

                case DISPLAY_MODE.VELOCITY:
                    digital1.SetValue(vessel.horizontalSrfSpeed);
                    digital2.SetValue(vessel.obt_speed);
                    digital3.SetValue(vessel.verticalSpeed);
                    break;

                case DISPLAY_MODE.RUNWAY:
                    Airfield airfield = NavGlobals.destinationAirfield;
                    int      id       = 0;
                    int      rway     = 0;
                    if (airfield != null)
                    {
                        id = airfield.id;
                        Runway runway = NavGlobals.landingRunway;
                        if (runway != null)
                        {
                            rway = (int)runway.heading;
                        }
                    }
                    digital1.SetValue(id);
                    digital2.SetValue(rway);
                    digital3.SetValue(NavGlobals.bearingToAirfield);
                    break;

                case DISPLAY_MODE.GLIDE:
                    digital1.SetValue(NavGlobals.horizontalGlideslopeDeviation);
                    digital2.SetValue(NavGlobals.verticalGlideslopeDeviation);
                    digital3.SetValue(NavGlobals.distanceToRunway);
                    break;

                case DISPLAY_MODE.TRIM:
                    digital1.SetValue(vessel.ctrlState.pitchTrim * 100);
                    digital2.SetValue(vessel.ctrlState.rollTrim * 100);
                    digital3.SetValue(vessel.ctrlState.yawTrim * 100
                                      );
                    break;

                default:
                    digital1.SetValue(88888);
                    digital2.SetValue(88888);
                    digital3.SetValue(88888);
                    break;
                }
            }