Ejemplo n.º 1
0
        private static void ShowRecenterDialog(On.RoR2.UI.MainMenu.MainMenuController.orig_Start orig, RoR2.UI.MainMenu.MainMenuController self)
        {
            orig(self);

            if (hasRecentered)
            {
                return;
            }

            hasRecentered = true;

            string glyphString = ControllerGlyphs.GetGlyph(25);

            SimpleDialogBox dialogBox = SimpleDialogBox.Create(null);

            dialogBox.headerToken = new SimpleDialogBox.TokenParamsPair()
            {
                token        = "Recenter",
                formatParams = null
            };

            ControllerGlyphs.ApplySpriteAsset(dialogBox.descriptionLabel);

            dialogBox.descriptionToken = new SimpleDialogBox.TokenParamsPair()
            {
                token        = "Use {0} to recenter your HMD.",
                formatParams = new object[] { glyphString }
            };

            dialogBox.AddCancelButton(CommonLanguageTokens.ok, Array.Empty <object>());
        }
Ejemplo n.º 2
0
        private IEnumerator InitVR(bool useOculus)
        {
            XRSettings.LoadDeviceByName(useOculus ? "Oculus" : "OpenVR");
            yield return(null);

            if (XRSettings.loadedDeviceName != (useOculus ? "Oculus" : "OpenVR"))
            {
                yield break;
            }

            XRSettings.enabled = true;
            XRDevice.SetTrackingSpaceType(ModConfig.InitialRoomscaleValue ? TrackingSpaceType.RoomScale : TrackingSpaceType.Stationary);

            if (!useOculus)
            {
                Valve.VR.SteamVR_Settings.instance.trackingSpace = ModConfig.InitialRoomscaleValue ? Valve.VR.ETrackingUniverseOrigin.TrackingUniverseStanding : Valve.VR.ETrackingUniverseOrigin.TrackingUniverseSeated;
                Valve.VR.SteamVR_Settings.instance.pauseGameWhenDashboardVisible = false;
                Valve.VR.SteamVR.Initialize();
                Valve.VR.SteamVR_Actions.gameplay.Activate();
                Valve.VR.SteamVR_Actions.ui.Activate();
            }
            Controllers.Init();
            ControllerGlyphs.Init();
        }