-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathInput.cs
More file actions
97 lines (78 loc) · 3.64 KB
/
Input.cs
File metadata and controls
97 lines (78 loc) · 3.64 KB
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
// OculusReportMenu
// (C) Copyright 2024 - 2026 SirKingBinx (Bingus)
// MIT License
using UnityEngine.InputSystem;
using UnityEngine.XR;
using Valve.VR;
namespace OculusReportMenu {
internal class Input {
/*
* This handles binding report menu buttons
*/
internal static float Sensitivity = 0.5f;
internal static ORM_Button OpenButton1 = "LS";
internal static ORM_Button OpenButton2 = "RS";
internal static bool EnableTabOpening, UseCustomKeybinds;
internal static bool Activated {
get {
bool normal = !UseCustomKeybinds
&& ControllerInputPoller.instance.leftControllerSecondaryButton
&& ControllerInputPoller.instance.rightControllerSecondaryButton
;
bool custom = UseCustomKeybinds
&& CheckButtonPressedStatus(OpenButton1)
&& CheckButtonPressedStatus(OpenButton2)
;
bool tab = EnableTabOpening
&& Keyboard.current.tabKey.wasPressedThisFrame
;
return normal || custom || tab;
}
}
private static bool CheckButtonPressedStatus(ORM_Button thisEntry)
{
bool temporarySClick;
switch (thisEntry)
{
case ORM_Button.LeftPrimary: return ControllerInputPoller.instance.leftControllerPrimaryButton;
case ORM_Button.LeftSecondary: return ControllerInputPoller.instance.leftControllerSecondaryButton;
case ORM_Button.LeftTrigger: return ControllerInputPoller.instance.leftControllerIndexFloat > Sensitivity;
case ORM_Button.LeftGrip: return ControllerInputPoller.instance.leftControllerGripFloat > Sensitivity;
case ORM_Button.LeftJoystickClick:
if (Plugin.Instance._platformSteam)
temporarySClick = SteamVR_Actions.gorillaTag_LeftJoystickClick.state;
else
InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).TryGetFeatureValue(UnityEngine.XR.CommonUsages.primary2DAxisClick, out temporarySClick);
return temporarySClick;
// right hand
case ORM_Button.RightPrimary: return ControllerInputPoller.instance.rightControllerPrimaryButton;
case ORM_Button.RightSecondary: return ControllerInputPoller.instance.rightControllerSecondaryButton;
case ORM_Button.RightTrigger: return ControllerInputPoller.instance.rightControllerIndexFloat > Sensitivity;
case ORM_Button.RightGrip: return ControllerInputPoller.instance.rightControllerGripFloat > Sensitivity;
case ORM_Button.RightJoystickClick:
if (Plugin.Instance._platformSteam)
temporarySClick = SteamVR_Actions.gorillaTag_RightJoystickClick.state;
else
InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(UnityEngine.XR.CommonUsages.primary2DAxisClick, out temporarySClick);
return temporarySClick;
// NAN
case ORM_Button.None:
return true;
}
return false;
}
}
public enum ORM_Button {
None = -1,
LeftPrimary = 0,
LeftSecondary,
LeftGrip,
LeftTrigger,
LeftJoystickClick,
RightPrimary = 10,
RightSecondary,
RightGrip,
RightTrigger,
RightJoystickClick
}
}