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
19
19
20
20
public static ConfigElement < KeyCode > Main_Menu_Toggle ;
21
21
public static ConfigElement < bool > Force_Unlock_Mouse ;
22
+ public static ConfigElement < bool > Aggressive_Force_Unlock ;
22
23
public static ConfigElement < MenuPages > Default_Tab ;
23
24
public static ConfigElement < int > Default_Page_Limit ;
24
25
public static ConfigElement < string > Default_Output_Path ;
@@ -78,6 +79,10 @@ private static void CreateConfigElements()
78
79
"Force the Cursor to be unlocked (visible) when the UnityExplorer menu is open." ,
79
80
true ) ;
80
81
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
+
81
86
Default_Page_Limit = new ConfigElement < int > ( "Default Page Limit" ,
82
87
"The default maximum number of elements per 'page' in UnityExplorer." ,
83
88
25 ) ;
Original file line number Diff line number Diff line change 7
7
using UnityExplorer . Core . Config ;
8
8
using UnityExplorer . Core ;
9
9
using UnityExplorer . UI ;
10
+ using System . Collections ;
10
11
#if ML
11
12
using Harmony ;
12
13
#else
@@ -48,6 +49,36 @@ public static void Init()
48
49
49
50
Unlock = ConfigManager . Force_Unlock_Mouse . Value ;
50
51
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
+ }
51
82
}
52
83
53
84
public static void UpdateCursorControl ( )
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ namespace UnityExplorer
14
14
public class ExplorerCore
15
15
{
16
16
public const string NAME = "UnityExplorer" ;
17
- public const string VERSION = "3.3.12 " ;
17
+ public const string VERSION = "3.3.13 " ;
18
18
public const string AUTHOR = "Sinai" ;
19
19
public const string GUID = "com.sinai.unityexplorer" ;
20
20
You can’t perform that action at this time.
0 commit comments