mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
ocd
This commit is contained in:
parent
04f35bdc54
commit
dcde01c2a9
9 changed files with 26 additions and 27 deletions
|
@ -89,40 +89,40 @@ public class DesktopVRSwitch : MonoBehaviour
|
|||
}
|
||||
|
||||
//one frame after switch attempt
|
||||
public void FailedVRModeSwitch(bool enterVR)
|
||||
public void FailedVRModeSwitch(bool isVR)
|
||||
{
|
||||
//let tracked objects know a switch failed
|
||||
VRModeSwitchTracker.FailVRModeSwitch(enterVR);
|
||||
VRModeSwitchTracker.FailVRModeSwitch(isVR);
|
||||
}
|
||||
|
||||
//one frame before switch attempt
|
||||
public void PreVRModeSwitch(bool enterVR)
|
||||
public void PreVRModeSwitch(bool isVR)
|
||||
{
|
||||
//let tracked objects know we are attempting to switch
|
||||
VRModeSwitchTracker.PreVRModeSwitch(enterVR);
|
||||
VRModeSwitchTracker.PreVRModeSwitch(isVR);
|
||||
}
|
||||
|
||||
//one frame after switch attempt
|
||||
public void PostVRModeSwitch(bool enterVR)
|
||||
public void PostVRModeSwitch(bool isVR)
|
||||
{
|
||||
//close the menus
|
||||
TryCatchHell.CloseCohtmlMenus();
|
||||
|
||||
//the base of VR checks
|
||||
TryCatchHell.SetCheckVR(enterVR);
|
||||
TryCatchHell.SetMetaPort(enterVR);
|
||||
TryCatchHell.SetCheckVR(isVR);
|
||||
TryCatchHell.SetMetaPort(isVR);
|
||||
|
||||
//game basics for functional gameplay post switch
|
||||
TryCatchHell.RepositionCohtmlHud(enterVR);
|
||||
TryCatchHell.UpdateHudOperations(enterVR);
|
||||
TryCatchHell.RepositionCohtmlHud(isVR);
|
||||
TryCatchHell.UpdateHudOperations(isVR);
|
||||
TryCatchHell.DisableMirrorCanvas();
|
||||
TryCatchHell.SwitchActiveCameraRigs(enterVR);
|
||||
TryCatchHell.SwitchActiveCameraRigs(isVR);
|
||||
TryCatchHell.ResetCVRInputManager();
|
||||
TryCatchHell.UpdateRichPresence();
|
||||
TryCatchHell.UpdateGestureReconizerCam();
|
||||
|
||||
//let tracked objects know we switched
|
||||
VRModeSwitchTracker.PostVRModeSwitch(enterVR);
|
||||
VRModeSwitchTracker.PostVRModeSwitch(isVR);
|
||||
|
||||
//reload avatar by default, optional for debugging
|
||||
if (_reloadLocalAvatar)
|
||||
|
|
|
@ -20,7 +20,7 @@ public class CVRPickupObjectTracker : MonoBehaviour
|
|||
VRModeSwitchTracker.OnPostVRModeSwitch -= PostVRModeSwitch;
|
||||
}
|
||||
|
||||
public void PostVRModeSwitch(bool enterVR, Camera activeCamera)
|
||||
public void PostVRModeSwitch(bool isVR, Camera activeCamera)
|
||||
{
|
||||
if (pickupObject != null)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ public class CameraFacingObjectTracker : MonoBehaviour
|
|||
VRModeSwitchTracker.OnPostVRModeSwitch -= PostVRModeSwitch;
|
||||
}
|
||||
|
||||
public void PostVRModeSwitch(bool enterVR, Camera activeCamera)
|
||||
public void PostVRModeSwitch(bool isVR, Camera activeCamera)
|
||||
{
|
||||
cameraFacingObject.m_Camera = activeCamera;
|
||||
}
|
||||
|
|
|
@ -22,13 +22,13 @@ public class IKSystemTracker : MonoBehaviour
|
|||
VRModeSwitchTracker.OnPostVRModeSwitch -= PostVRModeSwitch;
|
||||
}
|
||||
|
||||
public void PostVRModeSwitch(bool enterVR, Camera activeCamera)
|
||||
public void PostVRModeSwitch(bool isVR, Camera activeCamera)
|
||||
{
|
||||
var _trackingModules = _traverseModules.GetValue<List<TrackingModule>>();
|
||||
SteamVRTrackingModule openVRTrackingModule = _trackingModules.FirstOrDefault(m => m is SteamVRTrackingModule) as SteamVRTrackingModule;
|
||||
if (openVRTrackingModule != null)
|
||||
{
|
||||
if (enterVR)
|
||||
if (isVR)
|
||||
{
|
||||
openVRTrackingModule.ModuleStart();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class MovementSystemTracker : MonoBehaviour
|
|||
VRModeSwitchTracker.OnPostVRModeSwitch -= PostVRModeSwitch;
|
||||
}
|
||||
|
||||
public void PreVRModeSwitch(bool enterVR, Camera activeCamera)
|
||||
public void PreVRModeSwitch(bool isVR, Camera activeCamera)
|
||||
{
|
||||
//correct rotationPivot y position, so we dont teleport up/down
|
||||
Vector3 position = movementSystem.rotationPivot.transform.position;
|
||||
|
@ -36,11 +36,11 @@ public class MovementSystemTracker : MonoBehaviour
|
|||
//so the user can still switch even if avatar is null (if it failed to load for example).
|
||||
}
|
||||
|
||||
public void PostVRModeSwitch(bool enterVR, Camera activeCamera)
|
||||
public void PostVRModeSwitch(bool isVR, Camera activeCamera)
|
||||
{
|
||||
//lazy way of correcting Desktop & VR offset issue (game does the maths)
|
||||
movementSystem.TeleportToPosRot(preSwitchWorldPosition, preSwitchWorldRotation, false);
|
||||
//recenter desktop collision to player object
|
||||
if (!enterVR) movementSystem.UpdateColliderCenter(movementSystem.transform.position);
|
||||
if (!isVR) movementSystem.UpdateColliderCenter(movementSystem.transform.position);
|
||||
}
|
||||
}
|
|
@ -10,35 +10,35 @@ public class VRModeSwitchTracker
|
|||
public static event UnityAction<bool, Camera> OnPostVRModeSwitch;
|
||||
public static event UnityAction<bool, Camera> OnFailVRModeSwitch;
|
||||
|
||||
public static void PreVRModeSwitch(bool enterVR)
|
||||
public static void PreVRModeSwitch(bool isVR)
|
||||
{
|
||||
TryCatchHell.TryCatchWrapper(() =>
|
||||
{
|
||||
DesktopVRSwitchMod.Logger.Msg("Invoking VRModeSwitchTracker.OnPreVRModeSwitch.");
|
||||
Camera activeCamera = PlayerSetup.Instance.GetActiveCamera().GetComponent<Camera>();
|
||||
VRModeSwitchTracker.OnPreVRModeSwitch?.Invoke(enterVR, activeCamera);
|
||||
VRModeSwitchTracker.OnPreVRModeSwitch?.Invoke(isVR, activeCamera);
|
||||
},
|
||||
"Error while invoking VRModeSwitchTracker.OnPreVRModeSwitch. Did someone do a fucky?");
|
||||
}
|
||||
|
||||
public static void PostVRModeSwitch(bool enterVR)
|
||||
public static void PostVRModeSwitch(bool isVR)
|
||||
{
|
||||
TryCatchHell.TryCatchWrapper(() =>
|
||||
{
|
||||
DesktopVRSwitchMod.Logger.Msg("Invoking VRModeSwitchTracker.OnPostVRModeSwitch.");
|
||||
Camera activeCamera = PlayerSetup.Instance.GetActiveCamera().GetComponent<Camera>();
|
||||
VRModeSwitchTracker.OnPostVRModeSwitch?.Invoke(enterVR, activeCamera);
|
||||
VRModeSwitchTracker.OnPostVRModeSwitch?.Invoke(isVR, activeCamera);
|
||||
},
|
||||
"Error while invoking VRModeSwitchTracker.OnPostVRModeSwitch. Did someone do a fucky?");
|
||||
}
|
||||
|
||||
public static void FailVRModeSwitch(bool enterVR)
|
||||
public static void FailVRModeSwitch(bool isVR)
|
||||
{
|
||||
TryCatchHell.TryCatchWrapper(() =>
|
||||
{
|
||||
DesktopVRSwitchMod.Logger.Msg("Invoking VRModeSwitchTracker.OnFailVRModeSwitch.");
|
||||
Camera activeCamera = PlayerSetup.Instance.GetActiveCamera().GetComponent<Camera>();
|
||||
VRModeSwitchTracker.OnFailVRModeSwitch?.Invoke(enterVR, activeCamera);
|
||||
VRModeSwitchTracker.OnFailVRModeSwitch?.Invoke(isVR, activeCamera);
|
||||
},
|
||||
"Error while invoking OnFailVRModeSwitch.OnPreVRModeSwitch. Did someone do a fucky?");
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class VRTrackerManagerTracker : MonoBehaviour
|
|||
VRModeSwitchTracker.OnPostVRModeSwitch -= PostVRModeSwitch;
|
||||
}
|
||||
|
||||
public void PostVRModeSwitch(bool enterVR, Camera activeCamera)
|
||||
public void PostVRModeSwitch(bool isVR, Camera activeCamera)
|
||||
{
|
||||
//force the VRTrackerManager to reset anything its stored
|
||||
//this makes it get correct Left/Right hand if entering VR with different controllers
|
||||
|
|
|
@ -25,6 +25,6 @@ using System.Reflection;
|
|||
namespace NAK.Melons.DesktopVRSwitch.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "4.3.1";
|
||||
public const string Version = "4.3.2";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
|
@ -177,4 +177,3 @@ internal class TryCatchHell
|
|||
"Failed to update CVRGestureRecognizer camera.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue