From 628189bad24ded05181f586d64e5d3a39d8afeeb Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 2 Nov 2022 00:18:54 -0500 Subject: [PATCH] remember gamepad enabled value --- PickupPushPull/InputModules/PickupPushPull_Module.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/PickupPushPull/InputModules/PickupPushPull_Module.cs b/PickupPushPull/InputModules/PickupPushPull_Module.cs index daccc2e..70a5519 100644 --- a/PickupPushPull/InputModules/PickupPushPull_Module.cs +++ b/PickupPushPull/InputModules/PickupPushPull_Module.cs @@ -37,6 +37,7 @@ public class PickupPushPull_Module : CVRInputModule private CVRInputManager _inputManager; private ControllerRay desktopControllerRay; private float deadzoneRightValue; + private bool controlGamepadEnabled; //SteamVR Input private SteamVR_Action_Vector2 vrLookAction; @@ -66,10 +67,19 @@ public class PickupPushPull_Module : CVRInputModule UpdateVRBinding(); + controlGamepadEnabled = (bool)MetaPort.Instance.settings.GetSettingsBool("ControlDeadZoneRight", false); + MetaPort.Instance.settings.settingBoolChanged.AddListener(new UnityAction(SettingsBoolChanged)); + deadzoneRightValue = (float)MetaPort.Instance.settings.GetSettingInt("ControlDeadZoneRight", 0) / 100f; MetaPort.Instance.settings.settingIntChanged.AddListener(new UnityAction(SettingsIntChanged)); } + private void SettingsBoolChanged(string name, bool value) + { + if (name == "ControlEnableGamepad") + controlGamepadEnabled = value; + } + private void SettingsIntChanged(string name, int value) { if (name == "ControlDeadZoneRight") @@ -146,6 +156,8 @@ public class PickupPushPull_Module : CVRInputModule private void DoGamepadInput() { + if (!controlGamepadEnabled) return; + //not sure how to make settings for this bool button1 = Input.GetButton("Controller Left Button"); bool button2 = Input.GetButton("Controller Right Button");