public override bool GetTouch(XRButton button)
 {
     if (controller == null || !focusMappings.ContainsKey(button))
     {
         return(false);
     }
     return(controller.GetTouch(focusMappings[button]));
 }
        private void UpdateDeviceInput(uint deviceIndex, WaveVR_Controller.Device deviceInput)
        {
#if VIU_WAVEVR_2_1_0_OR_NEWER
            const WVR_InputId digitalTrggerBumpID = WVR_InputId.WVR_InputId_Alias1_Digital_Trigger;
#else
            const WVR_InputId digitalTrggerBumpID = WVR_InputId.WVR_InputId_Alias1_Bumper;
#endif

            IVRModuleDeviceState   prevState;
            IVRModuleDeviceStateRW currState;

            if (!TryGetValidDeviceState(deviceIndex, out prevState, out currState) || !deviceInput.connected)
            {
                return;
            }

            if (deviceInput != null)
            {
                var systemPressed         = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_System);
                var menuPressed           = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_Menu);
                var triggerPressed        = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_Trigger);
                var digitalTriggerPressed = deviceInput.GetPress(digitalTrggerBumpID);
                var gripPressed           = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_Grip);
                var touchpadPressed       = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_Touchpad);
                var dpadLeftPressed       = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_DPad_Left);
                var dpadUpPressed         = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_DPad_Up);
                var dpadRightPressed      = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_DPad_Right);
                var dpadDownPressed       = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_DPad_Down);
                currState.SetButtonPress(VRModuleRawButton.System, systemPressed);
                currState.SetButtonPress(VRModuleRawButton.ApplicationMenu, menuPressed);
                currState.SetButtonPress(VRModuleRawButton.Touchpad, touchpadPressed || dpadLeftPressed || dpadUpPressed || dpadRightPressed || dpadDownPressed);
                currState.SetButtonPress(VRModuleRawButton.Trigger, triggerPressed || digitalTriggerPressed);
                currState.SetButtonPress(VRModuleRawButton.Grip, gripPressed);
                currState.SetButtonPress(VRModuleRawButton.DPadLeft, dpadLeftPressed);
                currState.SetButtonPress(VRModuleRawButton.DPadUp, dpadUpPressed);
                currState.SetButtonPress(VRModuleRawButton.DPadRight, dpadRightPressed);
                currState.SetButtonPress(VRModuleRawButton.DPadDown, dpadDownPressed);

                var systemTouched         = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_System);
                var menuTouched           = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_Menu);
                var triggerTouched        = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_Trigger);
                var digitalTriggerTouched = deviceInput.GetTouch(digitalTrggerBumpID);
                var gripTouched           = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_Grip);
                var touchpadTouched       = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_Touchpad);
                var dpadLeftTouched       = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_DPad_Left);
                var dpadUpTouched         = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_DPad_Up);
                var dpadRightTouched      = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_DPad_Right);
                var dpadDownTouched       = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_DPad_Down);
                currState.SetButtonTouch(VRModuleRawButton.System, systemTouched);
                currState.SetButtonTouch(VRModuleRawButton.ApplicationMenu, menuTouched);
                currState.SetButtonTouch(VRModuleRawButton.Touchpad, touchpadTouched || dpadLeftTouched || dpadUpTouched || dpadRightTouched || dpadDownTouched);
                currState.SetButtonTouch(VRModuleRawButton.Trigger, triggerTouched || digitalTriggerTouched);
                currState.SetButtonTouch(VRModuleRawButton.Grip, gripTouched);
                currState.SetButtonTouch(VRModuleRawButton.DPadLeft, dpadLeftTouched);
                currState.SetButtonTouch(VRModuleRawButton.DPadUp, dpadUpTouched);
                currState.SetButtonTouch(VRModuleRawButton.DPadRight, dpadRightTouched);
                currState.SetButtonTouch(VRModuleRawButton.DPadDown, dpadDownTouched);

                var triggerAxis = deviceInput.GetAxis(WVR_InputId.WVR_InputId_Alias1_Trigger);
                var touchAxis   = deviceInput.GetAxis(WVR_InputId.WVR_InputId_Alias1_Touchpad);
                currState.SetAxisValue(VRModuleRawAxis.Trigger, triggerAxis.x);
                currState.SetAxisValue(VRModuleRawAxis.TouchpadX, touchAxis.x);
                currState.SetAxisValue(VRModuleRawAxis.TouchpadY, touchAxis.y);
            }
            else
            {
                currState.buttonPressed = 0u;
                currState.buttonTouched = 0u;
                currState.ResetAxisValues();
            }
        }