2
2
using System . Diagnostics . CodeAnalysis ;
3
3
using UnityEngine ;
4
4
using UnityEngine . EventSystems ;
5
+ using UnityExplorer . UI ;
5
6
6
7
namespace UnityExplorer . Core . Input
7
8
{
@@ -16,37 +17,42 @@ public static class InputManager
16
17
{
17
18
public static InputType CurrentType { get ; private set ; }
18
19
19
- private static IHandleInput m_inputModule ;
20
+ private static IHandleInput m_inputHandler ;
20
21
21
- public static Vector3 MousePosition => m_inputModule . MousePosition ;
22
+ public static Vector3 MousePosition => m_inputHandler . MousePosition ;
22
23
23
24
public static bool GetKeyDown ( KeyCode key )
24
25
{
25
26
if ( key == KeyCode . None )
26
27
return false ;
27
- return m_inputModule . GetKeyDown ( key ) ;
28
+ return m_inputHandler . GetKeyDown ( key ) ;
28
29
}
29
30
30
31
public static bool GetKey ( KeyCode key )
31
32
{
32
33
if ( key == KeyCode . None )
33
34
return false ;
34
- return m_inputModule . GetKey ( key ) ;
35
+ return m_inputHandler . GetKey ( key ) ;
35
36
}
36
37
37
- public static bool GetMouseButtonDown ( int btn ) => m_inputModule . GetMouseButtonDown ( btn ) ;
38
- public static bool GetMouseButton ( int btn ) => m_inputModule . GetMouseButton ( btn ) ;
38
+ public static bool GetMouseButtonDown ( int btn ) => m_inputHandler . GetMouseButtonDown ( btn ) ;
39
+ public static bool GetMouseButton ( int btn ) => m_inputHandler . GetMouseButton ( btn ) ;
39
40
40
- public static BaseInputModule UIInput => m_inputModule . UIModule ;
41
+ public static BaseInputModule UIInput => m_inputHandler . UIInputModule ;
41
42
42
- public static Vector2 MouseScrollDelta => m_inputModule . MouseScrollDelta ;
43
-
44
- public static void ActivateUIModule ( ) => m_inputModule . ActivateModule ( ) ;
43
+ public static Vector2 MouseScrollDelta => m_inputHandler . MouseScrollDelta ;
45
44
46
45
public static void AddUIModule ( )
47
46
{
48
- m_inputModule . AddUIInputModule ( ) ;
49
- ActivateUIModule ( ) ;
47
+ m_inputHandler . AddUIInputModule ( ) ;
48
+ //ActivateUIModule();
49
+ CursorUnlocker . SetEventSystem ( ) ;
50
+ }
51
+
52
+ public static void ActivateUIModule ( )
53
+ {
54
+ UIManager . EventSys . m_CurrentInputModule = UIInput ;
55
+ m_inputHandler . ActivateModule ( ) ;
50
56
}
51
57
52
58
public static void Init ( )
@@ -65,7 +71,7 @@ private static void InitHandler()
65
71
{
66
72
try
67
73
{
68
- m_inputModule = new LegacyInput ( ) ;
74
+ m_inputHandler = new LegacyInput ( ) ;
69
75
CurrentType = InputType . Legacy ;
70
76
71
77
// make sure its working
@@ -84,7 +90,7 @@ private static void InitHandler()
84
90
{
85
91
try
86
92
{
87
- m_inputModule = new InputSystem ( ) ;
93
+ m_inputHandler = new InputSystem ( ) ;
88
94
CurrentType = InputType . InputSystem ;
89
95
ExplorerCore . Log ( "Initialized new InputSystem support." ) ;
90
96
return ;
@@ -96,7 +102,7 @@ private static void InitHandler()
96
102
}
97
103
98
104
ExplorerCore . LogWarning ( "Could not find any Input Module Type!" ) ;
99
- m_inputModule = new NoInput ( ) ;
105
+ m_inputHandler = new NoInput ( ) ;
100
106
CurrentType = InputType . None ;
101
107
}
102
108
}
0 commit comments