remember gamepad enabled value

This commit is contained in:
NotAKidoS 2022-11-02 00:18:54 -05:00
parent 0f5781aec1
commit 628189bad2

View file

@ -37,6 +37,7 @@ public class PickupPushPull_Module : CVRInputModule
private CVRInputManager _inputManager; private CVRInputManager _inputManager;
private ControllerRay desktopControllerRay; private ControllerRay desktopControllerRay;
private float deadzoneRightValue; private float deadzoneRightValue;
private bool controlGamepadEnabled;
//SteamVR Input //SteamVR Input
private SteamVR_Action_Vector2 vrLookAction; private SteamVR_Action_Vector2 vrLookAction;
@ -66,10 +67,19 @@ public class PickupPushPull_Module : CVRInputModule
UpdateVRBinding(); UpdateVRBinding();
controlGamepadEnabled = (bool)MetaPort.Instance.settings.GetSettingsBool("ControlDeadZoneRight", false);
MetaPort.Instance.settings.settingBoolChanged.AddListener(new UnityAction<string, bool>(SettingsBoolChanged));
deadzoneRightValue = (float)MetaPort.Instance.settings.GetSettingInt("ControlDeadZoneRight", 0) / 100f; deadzoneRightValue = (float)MetaPort.Instance.settings.GetSettingInt("ControlDeadZoneRight", 0) / 100f;
MetaPort.Instance.settings.settingIntChanged.AddListener(new UnityAction<string, int>(SettingsIntChanged)); MetaPort.Instance.settings.settingIntChanged.AddListener(new UnityAction<string, int>(SettingsIntChanged));
} }
private void SettingsBoolChanged(string name, bool value)
{
if (name == "ControlEnableGamepad")
controlGamepadEnabled = value;
}
private void SettingsIntChanged(string name, int value) private void SettingsIntChanged(string name, int value)
{ {
if (name == "ControlDeadZoneRight") if (name == "ControlDeadZoneRight")
@ -146,6 +156,8 @@ public class PickupPushPull_Module : CVRInputModule
private void DoGamepadInput() private void DoGamepadInput()
{ {
if (!controlGamepadEnabled) return;
//not sure how to make settings for this //not sure how to make settings for this
bool button1 = Input.GetButton("Controller Left Button"); bool button1 = Input.GetButton("Controller Left Button");
bool button2 = Input.GetButton("Controller Right Button"); bool button2 = Input.GetButton("Controller Right Button");