mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-16 00:07:52 +08:00
Add keybind for mouse unlock, and aggressive unlock mode
This commit is contained in:
@ -41,6 +41,9 @@ namespace UnityExplorer.Core.Input
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
if (ConfigManager.Aggressive_Force_Unlock.Value)
|
||||
RuntimeProvider.Instance.SetupCameraDelegate();
|
||||
|
||||
SetupPatches();
|
||||
|
||||
UpdateCursorControl();
|
||||
@ -49,6 +52,20 @@ namespace UnityExplorer.Core.Input
|
||||
ConfigManager.Force_Unlock_Mouse.OnValueChanged += (bool val) => { Unlock = val; };
|
||||
}
|
||||
|
||||
public static void OnCameraPostRender(Camera _)
|
||||
{
|
||||
if (!UIManager.ShowMenu)
|
||||
return;
|
||||
UpdateIfNeeded();
|
||||
}
|
||||
|
||||
public static void UpdateIfNeeded()
|
||||
{
|
||||
if ((!ShouldActuallyUnlock && (Cursor.visible || Cursor.lockState == CursorLockMode.None))
|
||||
|| (ShouldActuallyUnlock && (!Cursor.visible || Cursor.lockState != CursorLockMode.None)))
|
||||
UpdateCursorControl();
|
||||
}
|
||||
|
||||
public static void UpdateCursorControl()
|
||||
{
|
||||
try
|
||||
|
Reference in New Issue
Block a user