static bool Prefix(MFDVehicleOptions __instance)
    {
        Traverse mfdTraverse = new Traverse(__instance);

        Debug.Log("measurements");
        MeasurementManager measurements = (MeasurementManager)mfdTraverse.Field("measurements").GetValue();

        Debug.Log("mfdPage");
        object  obj1    = mfdTraverse.Field("mfdPage").GetValue();
        MFDPage mfdPage = null;

        if (obj1 != null)
        {
            mfdPage = (MFDPage)obj1;
        }

        Debug.Log("portalPage");
        object        obj2       = mfdTraverse.Field("portalPage").GetValue();
        MFDPortalPage portalPage = null;

        if (obj2 != null)
        {
            portalPage = (MFDPortalPage)obj2;
        }

        Bananaspersecond.speedMode = (Bananaspersecond.speedMode + 1) % Bananaspersecond.units.measurementSpeedUnits.Count;
        Bananaspersecond.UpdateDisplay(measurements, mfdPage, portalPage);
        return(false);
    }
Exemplo n.º 2
0
    public static void UpdateDisplay(MeasurementManager measurements, MFDPage mfdPage, MFDPortalPage portalPage)
    {
        string text  = units.measurementAltUnits[altMode].name;
        string text2 = units.measurementDistUnits[distMode].name;
        string text3 = units.measurementSpeedUnits[speedMode].name;

        if (mfdPage)
        {
            mfdPage.SetText("AltModeText", text);
            mfdPage.SetText("DistModeText", text2);
            mfdPage.SetText("SpeedModeText", text3);
            return;
        }
        if (portalPage)
        {
            portalPage.SetText("AltModeText", text);
            portalPage.SetText("DistModeText", text2);
            portalPage.SetText("SpeedModeText", text3);
        }
    }