@@ -10,64 +10,64 @@ namespace Explorer.Input
10
10
{
11
11
public class InputSystem : IAbstractInput
12
12
{
13
- public static Type TKeyboard => _keyboard ?? ( _keyboard = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.Keyboard" ) ) ;
14
- private static Type _keyboard ;
13
+ public static Type TKeyboard => m_tKeyboard ?? ( m_tKeyboard = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.Keyboard" ) ) ;
14
+ private static Type m_tKeyboard ;
15
15
16
- public static Type TMouse => _mouse ?? ( _mouse = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.Mouse" ) ) ;
17
- private static Type _mouse ;
16
+ public static Type TMouse => m_tMouse ?? ( m_tMouse = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.Mouse" ) ) ;
17
+ private static Type m_tMouse ;
18
18
19
- public static Type TKey => _key ?? ( _key = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.Key" ) ) ;
20
- private static Type _key ;
19
+ public static Type TKey => m_tKey ?? ( m_tKey = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.Key" ) ) ;
20
+ private static Type m_tKey ;
21
21
22
- private static PropertyInfo _btnIsPressedProp ;
23
- private static PropertyInfo _btnWasPressedProp ;
22
+ private static PropertyInfo m_btnIsPressedProp ;
23
+ private static PropertyInfo m_btnWasPressedProp ;
24
24
25
- private static object CurrentKeyboard => _currentKeyboard ?? ( _currentKeyboard = _kbCurrentProp . GetValue ( null , null ) ) ;
26
- private static object _currentKeyboard ;
27
- private static PropertyInfo _kbCurrentProp ;
28
- private static PropertyInfo _kbIndexer ;
25
+ private static object CurrentKeyboard => m_currentKeyboard ?? ( m_currentKeyboard = m_kbCurrentProp . GetValue ( null , null ) ) ;
26
+ private static object m_currentKeyboard ;
27
+ private static PropertyInfo m_kbCurrentProp ;
28
+ private static PropertyInfo m_kbIndexer ;
29
29
30
- private static object CurrentMouse => _currentMouse ?? ( _currentMouse = _mouseCurrentProp . GetValue ( null , null ) ) ;
31
- private static object _currentMouse ;
32
- private static PropertyInfo _mouseCurrentProp ;
30
+ private static object CurrentMouse => m_currentMouse ?? ( m_currentMouse = m_mouseCurrentProp . GetValue ( null , null ) ) ;
31
+ private static object m_currentMouse ;
32
+ private static PropertyInfo m_mouseCurrentProp ;
33
33
34
- private static object LeftMouseButton => _lmb ?? ( _lmb = _leftButtonProp . GetValue ( CurrentMouse , null ) ) ;
35
- private static object _lmb ;
36
- private static PropertyInfo _leftButtonProp ;
34
+ private static object LeftMouseButton => m_lmb ?? ( m_lmb = m_leftButtonProp . GetValue ( CurrentMouse , null ) ) ;
35
+ private static object m_lmb ;
36
+ private static PropertyInfo m_leftButtonProp ;
37
37
38
- private static object RightMouseButton => _rmb ?? ( _rmb = _rightButtonProp . GetValue ( CurrentMouse , null ) ) ;
39
- private static object _rmb ;
40
- private static PropertyInfo _rightButtonProp ;
38
+ private static object RightMouseButton => m_rmb ?? ( m_rmb = m_rightButtonProp . GetValue ( CurrentMouse , null ) ) ;
39
+ private static object m_rmb ;
40
+ private static PropertyInfo m_rightButtonProp ;
41
41
42
- private static object MousePositionInfo => _pos ?? ( _pos = _positionProp . GetValue ( CurrentMouse , null ) ) ;
43
- private static object _pos ;
44
- private static PropertyInfo _positionProp ;
45
- private static MethodInfo _readVector2InputMethod ;
42
+ private static object MousePositionInfo => m_pos ?? ( m_pos = m_positionProp . GetValue ( CurrentMouse , null ) ) ;
43
+ private static object m_pos ;
44
+ private static PropertyInfo m_positionProp ;
45
+ private static MethodInfo m_readVector2InputMethod ;
46
46
47
- public Vector2 MousePosition => ( Vector2 ) _readVector2InputMethod . Invoke ( MousePositionInfo , new object [ 0 ] ) ;
47
+ public Vector2 MousePosition => ( Vector2 ) m_readVector2InputMethod . Invoke ( MousePositionInfo , new object [ 0 ] ) ;
48
48
49
49
public bool GetKeyDown ( KeyCode key )
50
50
{
51
51
var parsedKey = Enum . Parse ( TKey , key . ToString ( ) ) ;
52
- var actualKey = _kbIndexer . GetValue ( CurrentKeyboard , new object [ ] { parsedKey } ) ;
52
+ var actualKey = m_kbIndexer . GetValue ( CurrentKeyboard , new object [ ] { parsedKey } ) ;
53
53
54
- return ( bool ) _btnWasPressedProp . GetValue ( actualKey , null ) ;
54
+ return ( bool ) m_btnWasPressedProp . GetValue ( actualKey , null ) ;
55
55
}
56
56
57
57
public bool GetKey ( KeyCode key )
58
58
{
59
59
var parsed = Enum . Parse ( TKey , key . ToString ( ) ) ;
60
- var actualKey = _kbIndexer . GetValue ( CurrentKeyboard , new object [ ] { parsed } ) ;
60
+ var actualKey = m_kbIndexer . GetValue ( CurrentKeyboard , new object [ ] { parsed } ) ;
61
61
62
- return ( bool ) _btnIsPressedProp . GetValue ( actualKey , null ) ;
62
+ return ( bool ) m_btnIsPressedProp . GetValue ( actualKey , null ) ;
63
63
}
64
64
65
65
public bool GetMouseButtonDown ( int btn )
66
66
{
67
67
switch ( btn )
68
68
{
69
- case 0 : return ( bool ) _btnWasPressedProp . GetValue ( LeftMouseButton , null ) ;
70
- case 1 : return ( bool ) _btnWasPressedProp . GetValue ( RightMouseButton , null ) ;
69
+ case 0 : return ( bool ) m_btnWasPressedProp . GetValue ( LeftMouseButton , null ) ;
70
+ case 1 : return ( bool ) m_btnWasPressedProp . GetValue ( RightMouseButton , null ) ;
71
71
// case 2: return (bool)_btnWasPressedProp.GetValue(MiddleMouseButton, null);
72
72
default : throw new NotImplementedException ( ) ;
73
73
}
@@ -77,8 +77,8 @@ public bool GetMouseButton(int btn)
77
77
{
78
78
switch ( btn )
79
79
{
80
- case 0 : return ( bool ) _btnIsPressedProp . GetValue ( LeftMouseButton , null ) ;
81
- case 1 : return ( bool ) _btnIsPressedProp . GetValue ( RightMouseButton , null ) ;
80
+ case 0 : return ( bool ) m_btnIsPressedProp . GetValue ( LeftMouseButton , null ) ;
81
+ case 1 : return ( bool ) m_btnIsPressedProp . GetValue ( RightMouseButton , null ) ;
82
82
// case 2: return (bool)_btnIsPressedProp.GetValue(MiddleMouseButton, null);
83
83
default : throw new NotImplementedException ( ) ;
84
84
}
@@ -88,21 +88,21 @@ public void Init()
88
88
{
89
89
ExplorerCore . Log ( "Initializing new InputSystem support..." ) ;
90
90
91
- _kbCurrentProp = TKeyboard . GetProperty ( "current" ) ;
92
- _kbIndexer = TKeyboard . GetProperty ( "Item" , new Type [ ] { TKey } ) ;
91
+ m_kbCurrentProp = TKeyboard . GetProperty ( "current" ) ;
92
+ m_kbIndexer = TKeyboard . GetProperty ( "Item" , new Type [ ] { TKey } ) ;
93
93
94
94
var btnControl = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.Controls.ButtonControl" ) ;
95
- _btnIsPressedProp = btnControl . GetProperty ( "isPressed" ) ;
96
- _btnWasPressedProp = btnControl . GetProperty ( "wasPressedThisFrame" ) ;
95
+ m_btnIsPressedProp = btnControl . GetProperty ( "isPressed" ) ;
96
+ m_btnWasPressedProp = btnControl . GetProperty ( "wasPressedThisFrame" ) ;
97
97
98
- _mouseCurrentProp = TMouse . GetProperty ( "current" ) ;
99
- _leftButtonProp = TMouse . GetProperty ( "leftButton" ) ;
100
- _rightButtonProp = TMouse . GetProperty ( "rightButton" ) ;
98
+ m_mouseCurrentProp = TMouse . GetProperty ( "current" ) ;
99
+ m_leftButtonProp = TMouse . GetProperty ( "leftButton" ) ;
100
+ m_rightButtonProp = TMouse . GetProperty ( "rightButton" ) ;
101
101
102
- _positionProp = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.Pointer" )
102
+ m_positionProp = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.Pointer" )
103
103
. GetProperty ( "position" ) ;
104
104
105
- _readVector2InputMethod = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.InputControl`1" )
105
+ m_readVector2InputMethod = ReflectionHelpers . GetTypeByName ( "UnityEngine.InputSystem.InputControl`1" )
106
106
. MakeGenericType ( typeof ( Vector2 ) )
107
107
. GetMethod ( "ReadValue" ) ;
108
108
}
0 commit comments