-
Notifications
You must be signed in to change notification settings - Fork 0
/
InputManager.cs
104 lines (92 loc) · 2.5 KB
/
InputManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System;
using System.Collections;
using Rewired;
using UnityEngine;
// Token: 0x020003B9 RID: 953
public class InputManager : MonoBehaviour
{
// Token: 0x06001E9F RID: 7839 RVA: 0x0008FEB4 File Offset: 0x0008E2B4
private void Start()
{
Cursor.visible = false;
player1 = ReInput.players.GetPlayer(PlayerID);
player1.controllers.maps.SetMapsEnabled(true, ControlStyle);
MouseControl = true;
player1.controllers.hasKeyboard = true;
player1.controllers.hasMouse = true;
}
// Token: 0x06001EA0 RID: 7840 RVA: 0x0008FF24 File Offset: 0x0008E324
private void Update()
{
player1.controllers.maps.SetMapsEnabled(true, ControlStyle);
if (!stop)
{
string[] joystickNames = Input.GetJoystickNames();
for (int i = 0; i < joystickNames.Length; i++)
{
Debug.Log("Length " + i);
if (!string.IsNullOrEmpty(joystickNames[i]))
{
Debug.Log(string.Concat(new object[]
{
"Controller ",
i,
" is connected using: ",
joystickNames[i]
}));
Controllers();
}
else if (string.IsNullOrEmpty(joystickNames[i]))
{
Debug.Log("Controller: " + i + " is disconnected.");
MouseControls();
}
}
}
}
// Token: 0x06001EA1 RID: 7841 RVA: 0x0008FFFC File Offset: 0x0008E3FC
private void MouseControls()
{
stop = true;
StartCoroutine("ControllerCheck");
player1.controllers.hasKeyboard = true;
player1.controllers.hasMouse = true;
MouseControl = true;
}
// Token: 0x06001EA2 RID: 7842 RVA: 0x0009003A File Offset: 0x0008E43A
private void Controllers()
{
stop = true;
StartCoroutine("ControllerCheck");
player1.controllers.hasKeyboard = false;
player1.controllers.hasMouse = false;
MouseControl = false;
}
// Token: 0x06001EA3 RID: 7843 RVA: 0x00090078 File Offset: 0x0008E478
public void AddControls()
{
ControlStyle++;
}
// Token: 0x06001EA4 RID: 7844 RVA: 0x00090088 File Offset: 0x0008E488
public void SubControls()
{
ControlStyle--;
}
// Token: 0x06001EA5 RID: 7845 RVA: 0x00090098 File Offset: 0x0008E498
private IEnumerator ControllerCheck()
{
yield return new WaitForSecondsRealtime(2f);
stop = false;
yield break;
}
// Token: 0x040010C6 RID: 4294
public int PlayerID;
// Token: 0x040010C7 RID: 4295
public Player player1;
// Token: 0x040010C8 RID: 4296
public bool MouseControl;
// Token: 0x040010C9 RID: 4297
public int ControlStyle;
// Token: 0x040010CA RID: 4298
private bool stop;
}