Too many changes

This commit is contained in:
SDraw 2024-10-05 15:42:32 +03:00
parent 45557943c4
commit a22e5992d0
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
72 changed files with 1064 additions and 927 deletions

View file

@ -25,8 +25,7 @@ namespace ml_bft
if(MetaPort.Instance.isUsingVr)
SetupHandlers();
VRModeSwitchEvents.OnInitializeXR.AddListener(this.OnSwitchToVR);
VRModeSwitchEvents.OnDeinitializeXR.AddListener(this.OnSwitchToDesktop);
VRModeSwitchEvents.OnCompletedVRModeSwitch.AddListener(this.OnVRModeSwitch);
Settings.OnSkeletalInputChanged.AddListener(this.OnSkeletalInputChanged);
@ -39,6 +38,8 @@ namespace ml_bft
RemoveHandlers();
VRModeSwitchEvents.OnCompletedVRModeSwitch.RemoveListener(this.OnVRModeSwitch);
Settings.OnSkeletalInputChanged.RemoveListener(this.OnSkeletalInputChanged);
GameEvents.OnInputUpdate.RemoveListener(this.OnInputUpdate);
@ -133,23 +134,14 @@ namespace ml_bft
}
}
void OnSwitchToVR()
void OnVRModeSwitch(bool p_state)
{
try
{
SetupHandlers();
}
catch(System.Exception e)
{
MelonLoader.MelonLogger.Error(e);
}
}
void OnSwitchToDesktop()
{
try
{
RemoveHandlers();
if(Utils.IsInVR())
SetupHandlers();
else
RemoveHandlers();
}
catch(System.Exception e)
{