示例#1
0
        /// <summary>
        /// Determines when to boot the VR code. In most cases, it makes sense to do the check as described here.
        /// </summary>
        public void OnApplicationStart()
        {
            bool vrDeactivated = Environment.CommandLine.Contains("--novr");
            bool vrActivated   = Environment.CommandLine.Contains("--vr");

            VRLog.Info("Start VRMOD");

#if UNITY_2018_3_OR_NEWER
            foreach (var s in UnityEngine.XR.XRSettings.supportedDevices)
            {
                VRLog.Info($"Supported VR Device :{s}");
            }
            if (vrActivated || (!vrDeactivated && UnityEngine.XR.XRSettings.isDeviceActive))
            {
                UnityEngine.XR.XRSettings.enabled = true;
                VRLog.Info("Create VR Manager");
                var Manager = VRManager.Create(VRSettings.Load <VRSettings>("VRSettings.xml"));
                VRLog.Info("VR Manager Created");
            }
#else
            foreach (var s in UnityEngine.VR.VRSettings.supportedDevices)
            {
                VRLog.Info($"Supported VR Device :{s}");
            }
            VRLog.Info($"VR Device Is Status:{UnityEngine.VR.VRSettings.isDeviceActive}");
            VRLog.Info($"VR Mode Enabled Status:{UnityEngine.VR.VRSettings.enabled}");
            if (vrActivated || (!vrDeactivated && UnityEngine.VR.VRSettings.isDeviceActive))
            {
                UnityEngine.VR.VRSettings.enabled = true;
                VRLog.Info("Create VR Manager");
                var Manager = VRManager.Create(VRSettings.Load <VRSettings>("VRSettings.xml"));
                VRLog.Info("VR Manager Created");
            }
#endif
        }
示例#2
0
        /// <summary>
        /// VRデバイスのロード。
        /// </summary>
        IEnumerator LoadDevice(string newDevice)
        {
            bool vrMode = newDevice != DeviceNone;

            // 指定されたデバイスの読み込み.
            UnityEngine.VR.VRSettings.LoadDeviceByName(newDevice);
            // 次のフレームまで待つ.
            yield return(null);

            // VRモードを有効にする.
            UnityEngine.VR.VRSettings.enabled = vrMode;
            // 次のフレームまで待つ.
            yield return(null);

            // デバイスの読み込みが完了するまで待つ.
            while (UnityEngine.VR.VRSettings.loadedDeviceName != newDevice || UnityEngine.VR.VRSettings.enabled != vrMode)
            {
                yield return(null);
            }


            if (vrMode)
            {
                // Boot VRManager!
                // Note: Use your own implementation of GameInterpreter to gain access to a few useful operatoins
                // (e.g. characters, camera judging, colliders, etc.)
                VRManager.Create <GameInterpreter>(CreateContext("VRContext.xml"));
                VR.Manager.SetMode <GenericStandingMode>();
            }
        }
示例#3
0
 public void OnApplicationStart()
 {
     if (Environment.CommandLine.Contains("--vr"))
     {
         VRManager.Create <HoneyInterpreter>(new HoneyContext());
         VR.Manager.SetMode <HoneySeatedMode>();
     }
 }
示例#4
0
        /// <summary>
        /// VRデバイスのロード。
        /// </summary>
        IEnumerator LoadDevice(string newDevice)
        {
            bool vrMode = newDevice != DeviceNone;

            // 指定されたデバイスの読み込み.
            UnityEngine.XR.XRSettings.LoadDeviceByName(newDevice);
            // 次のフレームまで待つ.
            yield return(null);

            // VRモードを有効にする.
            UnityEngine.XR.XRSettings.enabled = vrMode;
            // 次のフレームまで待つ.
            yield return(null);

            // デバイスの読み込みが完了するまで待つ.
            while (UnityEngine.XR.XRSettings.loadedDeviceName != newDevice || UnityEngine.XR.XRSettings.enabled != vrMode)
            {
                yield return(null);
            }


            //UnityEngine.XR.XRSettings.gameViewRenderMode = UnityEngine.XR.GameViewRenderMode.BothEyes;

            List <UnityEngine.XR.XRNodeState> states = new List <UnityEngine.XR.XRNodeState>();

            UnityEngine.XR.InputTracking.GetNodeStates(states);
            foreach (UnityEngine.XR.XRNodeState state in states)
            {
                string  name    = UnityEngine.XR.InputTracking.GetNodeName(state.uniqueID);
                Vector3 pos     = new Vector3();
                bool    got_pos = state.TryGetPosition(out pos);
                VRLog.Info("XRNode {0}, position available {1} {2}", name, got_pos, pos);
            }

            if (vrMode)
            {
                VRPatcher.Patch();

                // Boot VRManager!
                // Note: Use your own implementation of GameInterpreter to gain access to a few useful operatoins
                // (e.g. characters, camera judging, colliders, etc.)
                VRManager.Create <HS2Interpreter>(CreateContext("VRContext.xml"));
                if (((HS2VRSettings)VR.Settings).DefaultMode.Equals("Seated"))
                {
                    VR.Manager.SetMode <GenericSeatedMode>();
                }
                else
                {
                    VR.Manager.SetMode <GenericStandingMode>();
                }

                if (((HS2VRSettings)VR.Settings).PrivacyMode.Equals(true))
                {
                    PrivacyMode.Enable();
                }
            }
        }
示例#5
0
        public void OnApplicationStart()
        {
            var manager = VRManager.Create <PlayClubInterpreter>(new PlayClubContext());

            manager.SetMode <PlayClubSeatedMode>();
            if (Environment.CommandLine.Contains("--verbose"))
            {
                Logger.Level = Logger.LogMode.Debug;
            }
        }
示例#6
0
 public void OnEnabled()
 {
     HarmonyHelper.DoOnHarmonyReady(Patcher.PatchAll);
     if (SteamVRDetector.IsRunning)
     {
         var context = new CSLVRContext();
         VRManager.Create <CSLVRInterpreter>(context);
         VR.Manager.SetMode <CSLMode>();
     }
 }
示例#7
0
 public void OnApplicationStart()
 {
     if (Environment.CommandLine.Contains("--vr"))
     {
         var context = new AGHContext();
         VRManager.Create <AGHInterpreter>(context);
         VR.Manager.SetMode <AGHSeatedMode>();
     }
     //VRLog.Info("Layers: " + string.Join(", ", UnityHelper.GetLayerNames(int.MaxValue)));
     //UnityEngine.SceneManagement.SceneManager.LoadScene(7);
 }
示例#8
0
        /// <summary>
        /// Determines when to boot the VR code. In most cases, it makes sense to do the check as described here.
        /// </summary>
        public void OnApplicationStart()
        {
            bool vrDeactivated = Environment.CommandLine.Contains("--novr");
            bool vrActivated   = Environment.CommandLine.Contains("--vr");

            if (vrActivated || (!vrDeactivated && SteamVRDetector.IsRunning))
            {
                // Boot VRManager!
                // Note: Use your own implementation of GameInterpreter to gain access to a few useful operatoins
                // (e.g. characters, camera judging, colliders, etc.)
                VRManager.Create <GameInterpreter>(CreateContext("VRContext.xml"));
                VR.Manager.SetMode <GenericSeatedMode>();
            }
        }
示例#9
0
        public void OnApplicationStart()
        {
            bool steamVrRunning = Process.GetProcesses().Any(process => process.ProcessName == "vrserver");
            bool vrDeactivated  = Environment.CommandLine.Contains("--novr");
            bool vrActivated    = Environment.CommandLine.Contains("--vr");

            if (vrActivated || (!vrDeactivated && steamVrRunning))
            {
                var context = new VookaContext();
                VRManager.Create <RayleeInterpreter>(context);
                VR.Manager.SetMode <VookaSeatedMode>();

                SteamVR_Render.instance.lockPhysicsUpdateRateToRenderFrequency = false;
            }
        }
示例#10
0
 public void OnApplicationStart()
 {
     if (Environment.CommandLine.Contains("--vr"))
     {
         Logger.Info("started");
         var manager = VRManager.Create <SexyStudioInterpreter>(new SexyStudioContext());
         manager.SetMode <SexyStudioSeatedMode>();
         if (Environment.CommandLine.Contains(_MaingameExecutable))
         {
             HSceneUI ui = HSceneUI.Create();
             ui.transform.SetParent(VRGUI.Instance.transform, false);
         }
     }
     if (Environment.CommandLine.Contains("--verbose"))
     {
         Logger.Level = Logger.LogMode.Debug;
     }
 }
示例#11
0
        public void OnApplicationStart()
        {
            if (Environment.CommandLine.Contains("--vr"))
            {
                var context  = new HoneyContext();
                var settings = context.Settings as HoneySettings;

                // Enforce new default
                if (!File.Exists(NEW_DEFAULT_TOKEN))
                {
                    File.Create(NEW_DEFAULT_TOKEN);

                    settings.ApplyShaders = true;
                    settings.Save();
                }
                VRManager.Create <HoneyInterpreter>(context);
                VR.Manager.SetMode <HoneySeatedMode>();
            }
        }
示例#12
0
        protected override void Awake()
        {
            if (Paths.ProcessName.Contains("KoikatuVR"))
            {
                Destroy(this);
                return;
            }

            base.Awake();

            VRLoader.OnVRSuccess += () =>
            {
                if (Paths.ProcessName == "CharaStudio")
                {
                    VRManager.Create <KKCharaStudioInterpreter>(StudioContext.CreateContext("KKCSVRContext.xml"));
                }
                else
                {
                    VRManager.Create <KoikatuInterpreter>(MainGameContext.CreateContext("VRContext.xml"));
                }
            };
        }