This repository was archived by the owner on May 9, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ public static class ConfigManager
1919
2020 public static ConfigElement < KeyCode > Main_Menu_Toggle ;
2121 public static ConfigElement < bool > Force_Unlock_Mouse ;
22+ public static ConfigElement < bool > Aggressive_Force_Unlock ;
2223 public static ConfigElement < MenuPages > Default_Tab ;
2324 public static ConfigElement < int > Default_Page_Limit ;
2425 public static ConfigElement < string > Default_Output_Path ;
@@ -78,6 +79,10 @@ private static void CreateConfigElements()
7879 "Force the Cursor to be unlocked (visible) when the UnityExplorer menu is open." ,
7980 true ) ;
8081
82+ Aggressive_Force_Unlock = new ConfigElement < bool > ( "Aggressive Mouse Unlock" ,
83+ "Use WaitForEndOfFrame to aggressively force the Mouse to be unlocked (requires game restart)." ,
84+ false ) ;
85+
8186 Default_Page_Limit = new ConfigElement < int > ( "Default Page Limit" ,
8287 "The default maximum number of elements per 'page' in UnityExplorer." ,
8388 25 ) ;
Original file line number Diff line number Diff line change 77using UnityExplorer . Core . Config ;
88using UnityExplorer . Core ;
99using UnityExplorer . UI ;
10+ using System . Collections ;
1011#if ML
1112using Harmony ;
1213#else
@@ -48,6 +49,36 @@ public static void Init()
4849
4950 Unlock = ConfigManager . Force_Unlock_Mouse . Value ;
5051 ConfigManager . Force_Unlock_Mouse . OnValueChanged += ( bool val ) => { Unlock = val ; } ;
52+
53+ if ( ConfigManager . Aggressive_Force_Unlock . Value )
54+ SetupAggressiveUnlock ( ) ;
55+ }
56+
57+ public static void SetupAggressiveUnlock ( )
58+ {
59+ try
60+ {
61+ RuntimeProvider . Instance . StartCoroutine ( AggressiveUnlockCoroutine ( ) ) ;
62+ }
63+ catch ( Exception ex )
64+ {
65+ ExplorerCore . LogWarning ( $ "Exception setting up Camera.onPostRender callback: { ex } ") ;
66+ }
67+ }
68+
69+ private static readonly WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame ( ) ;
70+
71+ private static IEnumerator AggressiveUnlockCoroutine ( )
72+ {
73+ while ( true )
74+ {
75+ ExplorerCore . Log ( "Yielding end of frame" ) ;
76+ yield return _waitForEndOfFrame ;
77+ ExplorerCore . Log ( "Yielded" ) ;
78+
79+ if ( UIManager . ShowMenu )
80+ UpdateCursorControl ( ) ;
81+ }
5182 }
5283
5384 public static void UpdateCursorControl ( )
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ namespace UnityExplorer
1414 public class ExplorerCore
1515 {
1616 public const string NAME = "UnityExplorer" ;
17- public const string VERSION = "3.3.12 " ;
17+ public const string VERSION = "3.3.13 " ;
1818 public const string AUTHOR = "Sinai" ;
1919 public const string GUID = "com.sinai.unityexplorer" ;
2020
You can’t perform that action at this time.
0 commit comments