mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
[DesktopVRSwitch] Further cleanup
This commit is contained in:
parent
6774c3ff6d
commit
f89a41772b
5 changed files with 14 additions and 23 deletions
|
@ -44,10 +44,9 @@ public class VRModeSwitchManager : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
public bool _useWorldTransition = true;
|
public bool UseWorldTransition = true;
|
||||||
public bool _reloadLocalAvatar = true;
|
public bool ReloadLocalAvatar = true;
|
||||||
|
|
||||||
// Info
|
|
||||||
public bool SwitchInProgress { get; private set; }
|
public bool SwitchInProgress { get; private set; }
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
|
@ -75,12 +74,12 @@ public class VRModeSwitchManager : MonoBehaviour
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
|
|
||||||
if (_useWorldTransition)
|
if (UseWorldTransition)
|
||||||
{ // start visual transition and wait for it to complete
|
{ // start visual transition and wait for it to complete
|
||||||
WorldTransitionSystem.Instance.StartTransition();
|
WorldTransitionSystem.Instance.StartTransition();
|
||||||
yield return new WaitForSeconds(WorldTransitionSystem.Instance.CurrentInLength);
|
yield return new WaitForSeconds(WorldTransitionSystem.Instance.CurrentInLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if OpenVR is running
|
// Check if OpenVR is running
|
||||||
bool isUsingVr = IsInVR();
|
bool isUsingVr = IsInVR();
|
||||||
|
|
||||||
|
@ -100,7 +99,7 @@ public class VRModeSwitchManager : MonoBehaviour
|
||||||
if (isUsingVr != IsInVR())
|
if (isUsingVr != IsInVR())
|
||||||
{
|
{
|
||||||
// reload the local avatar
|
// reload the local avatar
|
||||||
if (_reloadLocalAvatar)
|
if (ReloadLocalAvatar)
|
||||||
{
|
{
|
||||||
Utils.ClearLocalAvatar();
|
Utils.ClearLocalAvatar();
|
||||||
Utils.ReloadLocalAvatar();
|
Utils.ReloadLocalAvatar();
|
||||||
|
@ -113,9 +112,9 @@ public class VRModeSwitchManager : MonoBehaviour
|
||||||
InvokeOnFailedSwitch(!isUsingVr);
|
InvokeOnFailedSwitch(!isUsingVr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_useWorldTransition)
|
if (UseWorldTransition)
|
||||||
{ // would be cool to have out length
|
{ // would be cool to have out length
|
||||||
WorldTransitionSystem.Instance.ContinueTransitionCoroutine();
|
WorldTransitionSystem.Instance.ContinueTransition();
|
||||||
yield return new WaitForSeconds(WorldTransitionSystem.Instance.CurrentInLength);
|
yield return new WaitForSeconds(WorldTransitionSystem.Instance.CurrentInLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class CVRWorldTracker : VRModeTracker
|
||||||
CVRWorld.Instance.UpdatePostProcessing();
|
CVRWorld.Instance.UpdatePostProcessing();
|
||||||
UpdateCVRDesktopCameraController();
|
UpdateCVRDesktopCameraController();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateCVRDesktopCameraController()
|
private void UpdateCVRDesktopCameraController()
|
||||||
{
|
{
|
||||||
// Just making sure- Starting in VR will not call Start() as rig is disabled
|
// Just making sure- Starting in VR will not call Start() as rig is disabled
|
||||||
|
|
|
@ -16,14 +16,6 @@ public class CheckVRTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
CheckVR _checkVR = CheckVR.Instance;
|
CheckVR.Instance.hasVrDeviceLoaded = intoVR;
|
||||||
if (_checkVR == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting CheckVR!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg($"Setting CheckVR hasVrDeviceLoaded to {intoVR}.");
|
|
||||||
|
|
||||||
_checkVR.hasVrDeviceLoaded = intoVR;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,7 +52,7 @@ public class IKSystemTracker : VRModeTracker
|
||||||
BodySystem.isCalibratedAsFullBody = false;
|
BodySystem.isCalibratedAsFullBody = false;
|
||||||
BodySystem.isCalibrating = false;
|
BodySystem.isCalibrating = false;
|
||||||
BodySystem.isRecalibration = false;
|
BodySystem.isRecalibration = false;
|
||||||
|
|
||||||
// Make it so you don't instantly end up in FBT from Desktop
|
// Make it so you don't instantly end up in FBT from Desktop
|
||||||
IKSystem.firstAvatarLoaded = DesktopVRSwitch.EntryEnterCalibrationOnSwitch.Value;
|
IKSystem.firstAvatarLoaded = DesktopVRSwitch.EntryEnterCalibrationOnSwitch.Value;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class MovementSystemTracker : VRModeTracker
|
||||||
MovementSystem.Instance.ChangeCrouch(false);
|
MovementSystem.Instance.ChangeCrouch(false);
|
||||||
MovementSystem.Instance.ChangeProne(false);
|
MovementSystem.Instance.ChangeProne(false);
|
||||||
MovementSystem.Instance.SetImmobilized(true);
|
MovementSystem.Instance.SetImmobilized(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFailedSwitch(bool intoVR)
|
private void OnFailedSwitch(bool intoVR)
|
||||||
|
@ -50,7 +50,7 @@ public class MovementSystemTracker : VRModeTracker
|
||||||
// Lazy
|
// Lazy
|
||||||
MelonLoader.MelonCoroutines.Start(TeleportFrameAfter(intoVR));
|
MelonLoader.MelonCoroutines.Start(TeleportFrameAfter(intoVR));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator TeleportFrameAfter(bool intoVR)
|
private IEnumerator TeleportFrameAfter(bool intoVR)
|
||||||
{
|
{
|
||||||
yield return null; // need to wait a frame
|
yield return null; // need to wait a frame
|
||||||
|
@ -66,7 +66,7 @@ public class MovementSystemTracker : VRModeTracker
|
||||||
MovementSystem.Instance.ChangeCrouch(false);
|
MovementSystem.Instance.ChangeCrouch(false);
|
||||||
MovementSystem.Instance.ChangeProne(false);
|
MovementSystem.Instance.ChangeProne(false);
|
||||||
MovementSystem.Instance.SetImmobilized(false);
|
MovementSystem.Instance.SetImmobilized(false);
|
||||||
|
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue