123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606 |
- using Rokid.UXR.Interaction;
- using Rokid.UXR.Module;
- using SC.XR.Unity.Module_InputSystem;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Android;
- using UnityEngine.InputSystem;
- using UnityEngine.XR;
- using UnityEngine.XR.OpenXR.Input;
- public class XRInputManager : MonoBehaviour
- {
- public static bool isCheckHand;
- public static bool leftDown;
- public static bool rightDown;
- public Transform left = null;
- public Transform right = null;
- public InputActionProperty inputEvent;
- public List<InputActionReference> listinput;
- int xy = 8;
- private void Awake()
- {
- if (!Permission.HasUserAuthorizedPermission("android.permission.RECORD_AUDIO"))
- {
- Permission.RequestUserPermission("android.permission.RECORD_AUDIO");
- }
- isHand = true;
- isCheckHand = isHand;
- }
- public void OnReceive(string msg)
- {
- }
- // Start is called before the first frame update
- void Start()
- {
- ModuleManager.Instance.RegistModule("com.rokid.voicecommand.VoiceCommandHelper", false);
- // API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- /*
- NRInput.AddDownListener(ControllerHandEnum.Right, ControllerButton.APP, () => {
- Debug.Log("ControllerButton.APP===>Down");
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- });
- NRInput.AddDownListener(ControllerHandEnum.Right, ControllerButton.BEGIN, () => {
- Debug.Log("ControllerButton.BEGIN===>Down");
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- });
- NRInput.AddDownListener(ControllerHandEnum.Right, ControllerButton.END, () => {
- Debug.Log("ControllerButton.END===>Down");
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- });
- NRInput.AddDownListener(ControllerHandEnum.Right, ControllerButton.GRIP, () => {
- Debug.Log("ControllerButton.GRIP===>Down");
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- });
- NRInput.AddDownListener(ControllerHandEnum.Right, ControllerButton.HOME, () => {
- Debug.Log("ControllerButton.HOME===>Down");
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- });*/
- /*
- NRInput.AddDownListener(ControllerHandEnum.Right, ControllerButton.TRIGGER, () => {
- Debug.Log("ControllerButton.TRIGGER===>Down");
- if (isHand)
- {
- // API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- rightDown = true;
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- }
- else
- {
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- }
- });*/
- /*
- NRInput.AddDownListener(ControllerHandEnum.Right, ControllerButton.TOUCHPAD_BUTTON, () => {
- Debug.Log("ControllerButton.TOUCHPAD_BUTTON===>Down");
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- });
-
- NRInput.AddUpListener(ControllerHandEnum.Right, ControllerButton.APP, () => {
- Debug.Log("ControllerButton.APP===>UP");
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- });
- NRInput.AddUpListener(ControllerHandEnum.Right, ControllerButton.BEGIN, () => {
- Debug.Log("ControllerButton.BEGIN===>UP");
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- });
- NRInput.AddUpListener(ControllerHandEnum.Right, ControllerButton.END, () => {
- Debug.Log("ControllerButton.END===>UP");
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- });
- NRInput.AddUpListener(ControllerHandEnum.Right, ControllerButton.GRIP, () => {
- Debug.Log("ControllerButton.GRIP===>UP");
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- });
- NRInput.AddUpListener(ControllerHandEnum.Right, ControllerButton.HOME, () => {
- Debug.Log("ControllerButton.HOME===>UP");
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- });*/
- /*
- NRInput.AddUpListener(ControllerHandEnum.Right, ControllerButton.TRIGGER, () => {
- Debug.Log("ControllerButton.HOME===>TRIGGER");
- if (isHand)
- {
- rightDown = false;
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- // API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- }else
- {
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- }
- });*/
- /*
- NRInput.AddUpListener(ControllerHandEnum.Right, ControllerButton.TOUCHPAD_BUTTON, () => {
- Debug.Log("ControllerButton.HOME===>TOUCHPAD_BUTTON");
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- });
- *//*
- NRInput.AddDownListener(ControllerHandEnum.Left, ControllerButton.TRIGGER, () => {
- Debug.Log("ControllerButton.HOME===>TRIGGER");
- if (isHand)
- {
- leftDown = false;
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- }
- });
- NRInput.AddUpListener(ControllerHandEnum.Left, ControllerButton.TRIGGER, () => {
- Debug.Log("ControllerButton.HOME===>TRIGGER");
- if (isHand)
- {
- leftDown = false;
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- // API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- }
- });*/
- Invoke("startXR", 1f);
- /*
- return;
- for (int i = 0; i < 15; i++)
- {
- listinput[i].action.Enable();
- listinput[i].action.performed += OnEventL;
- listinput[i].action.canceled += OnCanceledEventL;
- }
- for (int i = 15; i < listinput.Count; i++)
- {
- listinput[i].action.Enable();
- listinput[i].action.performed += OnEventR;
- listinput[i].action.canceled += OnCanceledEventR;
- }
- InputDevices.deviceConnected += onDeviceConnected;
- InputDevices.deviceDisconnected += onDeviceDisConnected;
- Invoke("startXR", 1f);*/
- }
- private void downTP()
- {
- }
- public static bool isHand;
- List<Vector3> leftInfo = new List<Vector3>();
- List<Vector3> rightInfo = new List<Vector3>();
- void startXR()
- {
- InteractorGroup.OnDownOrUp += OnDownOrUp;
- InputModuleManager.OnModuleActive += OnModuleActive;
- InteractorStateChange.OnPokePoseUpdate += OnPokePoseUpdate;
- ThreeDofEventInput.OnPhoneRayForward += OnPhoneRayForward;
- if (isHand)
- {
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.KS, false);
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.Head, false);
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.GGT26Dof, true);
- }else
- {
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.KS, true);
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.Head, false);
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.GGT26Dof, false);
- }
- isHand=!InputModuleManager.Instance.GetThreeDofActive();
- #if UNITY_EDITOR
- // Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.KS, false);
- // Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.Head, true);
- // Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.GGT26Dof, false);
- #endif
- /*
- left.gameObject.SetActive(false);
- right.gameObject.SetActive(false);
- List<UnityEngine.XR.InputDevice> inputDevices = new List<UnityEngine.XR.InputDevice>();
- InputDevices.GetDevices(inputDevices);
- for (int i = 0; i < inputDevices.Count; i++)
- {
- onDeviceConnected(inputDevices[i]);
- }*/
- }
- private void OnDownOrUp(bool obj)
- {
- if(!isHand)
- {
- if (obj)
- {
- // API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- // API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- }
- else
- {
- // API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- }
- }
- }
- private void OnModuleActive(InputModuleType obj)
- {
- if(obj==InputModuleType.ThreeDof)
- {
- isHand = false;
- }
- else
- {
- isHand = true;
- }
- }
- private void OnPhoneRayForward(Vector3 obj)
- {
- if(!isHand)
- {
- rootRightHand.transform.eulerAngles = obj;
- // rootLeftHand.transform.localPosition = new Vector3(rootLeftHand.transform.localPosition.x-20, rootLeftHand.transform.localPosition.y, rootLeftHand.transform.localPosition.z);
- rootRightHand.transform.localPosition = new Vector3(0, -0.5f, 0.2f);
- }
- }
- public GameObject rootLeftHand;
- public GameObject rootRightHand;
- private void OnPokePoseUpdate(HandType arg0, UnityEngine.Pose arg1)
- {
- if (isHand)
- {
- if (HandType.LeftHand == arg0)
- {
- // rootLeftHand.transform.position = arg1.position;
- // rootLeftHand.transform.rotation = arg1.rotation;
- }
- else
- {
- // rootRightHand.transform.position = arg1.position;
- // rootRightHand.transform.rotation = arg1.rotation;
- }
- }
- }
- private void Update()
- {
- if (Input.GetKeyDown(KeyCode.I))
- {
- isHand = false;
- }
- if (Input.GetKeyDown(KeyCode.U))
- {
- isHand = true;
- }
- if (Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow) || Input.GetKeyUp(KeyCode.UpArrow) || Input.GetKeyUp(KeyCode.DownArrow)
- || RKNativeInput.Instance.GetKeyUp(RKKeyEvent.KEY_LEFT) || RKNativeInput.Instance.GetKeyUp(RKKeyEvent.KEY_RIGHT) || RKNativeInput.Instance.GetKeyUp(RKKeyEvent.KEY_UP) || RKNativeInput.Instance.GetKeyUp(RKKeyEvent.KEY_DOWN)
- || Input.GetKeyUp(KeyCode.JoystickButton0))
- {
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- }
- if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.DownArrow)
- || RKNativeInput.Instance.GetKeyDown(RKKeyEvent.KEY_LEFT) || RKNativeInput.Instance.GetKeyDown(RKKeyEvent.KEY_RIGHT) || RKNativeInput.Instance.GetKeyDown(RKKeyEvent.KEY_UP) || RKNativeInput.Instance.GetKeyDown(RKKeyEvent.KEY_DOWN)
- || Input.GetKeyDown(KeyCode.JoystickButton0))
- {
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- }
- bool ldown = GesEventInput.Instance.GetHandDown(HandType.LeftHand);
- if(ldown)
- {
- Debug.Log(".GetHandDown(HandType.LeftHand)");
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- }
- bool rdown = GesEventInput.Instance.GetHandDown(HandType.RightHand);
- if (rdown)
- {
- Debug.Log(".GetHandDown(HandType.RightHand)");
- // rightDown = false;
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- }
- bool lup = GesEventInput.Instance.GetHandUp(HandType.LeftHand);
- if (lup)
- {
- Debug.Log(".GetHandUp(HandType.LeftHand)");
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- }
- bool rup = GesEventInput.Instance.GetHandUp(HandType.RightHand);
- if (rup)
- {
- Debug.Log(".GetHandUp(HandType.RightHand)");
- // rightDown = false;
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- }
- if (Input.GetKeyDown(KeyCode.X))
- {
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- //API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.X, InputKeyState.DOWN);
- }
- if (Input.GetKeyUp(KeyCode.X))
- {
- API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- // API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.X, InputKeyState.UP);
- }
- }
- private void onDeviceDisConnected(UnityEngine.XR.InputDevice obj)
- {
- if (obj.characteristics.ToString().Contains(InputDeviceCharacteristics.Left.ToString()))
- {
- Debug.Log("Left===>" + obj.isValid);
- left.gameObject.SetActive(obj.isValid);
- }
- if (obj.characteristics.ToString().Contains(InputDeviceCharacteristics.Right.ToString()))
- {
- Debug.Log("Right===>" + obj.isValid);
- right.gameObject.SetActive(obj.isValid);
- }
- }
- private void OnApplicationPause(bool pause)
- {
- if (!pause)
- {
- List<UnityEngine.XR.InputDevice> inputDevices = new List<UnityEngine.XR.InputDevice>();
- InputDevices.GetDevices(inputDevices);
- for (int i = 0; i < inputDevices.Count; i++)
- {
- onDeviceConnected(inputDevices[i]);
- }
- }
- }
- private void onDeviceConnected(UnityEngine.XR.InputDevice obj)
- {
- if (obj.characteristics.ToString().Contains(InputDeviceCharacteristics.Left.ToString()))
- {
- Debug.Log("Left===>" + obj.isValid);
- left.gameObject.SetActive(obj.isValid);
- }
- if (obj.characteristics.ToString().Contains(InputDeviceCharacteristics.Right.ToString()))
- {
- Debug.Log("Right===>" + obj.isValid);
- right.gameObject.SetActive(obj.isValid);
- }
- }
- private void OnCanceledEventL(InputAction.CallbackContext context)
- {
- Debug.Log("OnCanceledEventL" + context.control.name);
- switch (context.control.name)
- {
- case "secondarytouched":
- break;
- case "secondarybutton":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Y, InputKeyState.UP);
- break;
- case "primarytouched":
- break;
- case "primarybutton":
- Debug.Log("InputKeyCode.A===¡·UP");
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.X, InputKeyState.UP);
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- break;
- case "touchpadtouched":
- break;
- case "thumbstickclicked":
- break;
- case "thumbstick":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.JoystickX = xy + (int)(context.ReadValue<Vector2>().x * 10);
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.JoystickY = xy + (int)(context.ReadValue<Vector2>().y * 10);
- break;
- case "grip":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.HallInside = 10 - (int)((context.ReadValue<float>()) * 10f);
- break;
- case "grippressed":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.LHallInside, InputKeyState.UP);
- break;
- case "trigger":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.HallFoward = 10 - (int)((context.ReadValue<float>()) * 10f);
- break;
- case "menu":
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.KS, true);
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.Head, false);
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.LFunction, InputKeyState.UP);
- break;
- }
- }
- void OnEventL(InputAction.CallbackContext context)
- {
- Debug.Log("OnEventL" + context.control.name);
- switch (context.control.name)
- {
- case "secondarytouched":
- break;
- case "secondarybutton":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Y, InputKeyState.DOWN);
- break;
- case "primarytouched":
- break;
- case "primarybutton":
- Debug.Log("InputKeyCode.A===¡·DOWN");
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.X, InputKeyState.DOWN);
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- break;
- case "touchpadtouched":
- break;
- case "thumbstickclicked":
- break;
- case "thumbstick":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.JoystickX = xy + (int)(context.ReadValue<Vector2>().x * 10);
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.JoystickY = xy + (int)(context.ReadValue<Vector2>().y * 10);
- break;
- case "grip":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.HallInside = 10 - (int)((context.ReadValue<float>()) * 10f);
- break;
- case "grippressed":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.LHallInside, InputKeyState.DOWN);
- break;
- case "trigger":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.HallFoward = 10 - (int)((context.ReadValue<float>()) * 10f);
- break;
- case "menu":
- API_GSXR_Module_InputSystem_KS.GSXR_KSLeft.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.LFunction, InputKeyState.DOWN);
- break;
- }
- }
- private void OnCanceledEventR(InputAction.CallbackContext context)
- {
- Debug.Log("OnCanceledEventR" + context.control.name);
- switch (context.control.name)
- {
- case "secondarytouched":
- break;
- case "secondarybutton":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.B, InputKeyState.UP);
- break;
- case "primarytouched":
- break;
- case "primarybutton":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.A, InputKeyState.UP);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.UP);
- break;
- case "touchpadtouched":
- break;
- case "thumbstickclicked":
- break;
- case "thumbstick":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.JoystickX = xy + (int)(context.ReadValue<Vector2>().x * 10);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.JoystickY = xy + (int)(context.ReadValue<Vector2>().y * 10);
- break;
- case "grip":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.HallInside = 10 - (int)((context.ReadValue<float>()) * 10f);
- break;
- case "grippressed":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.RHallInside, InputKeyState.UP);
- break;
- case "trigger":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.HallFoward = 10 - (int)((context.ReadValue<float>()) * 10f);
- break;
- case "menu":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.RFunction, InputKeyState.UP);
- break;
- }
- }
- void OnEventR(InputAction.CallbackContext context)
- {
- Debug.Log("OnEventR" + context.control.name);
- switch (context.control.name)
- {
- case "secondarytouched":
- break;
- case "secondarybutton":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.B, InputKeyState.DOWN);
- break;
- case "primarytouched":
- break;
- case "primarybutton":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.A, InputKeyState.DOWN);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.Enter, InputKeyState.DOWN);
- break;
- case "touchpadtouched":
- break;
- case "thumbstickclicked":
- break;
- case "thumbstick":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.JoystickX = xy + (int)(context.ReadValue<Vector2>().x * 10);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.JoystickY = xy + (int)(context.ReadValue<Vector2>().y * 10);
- break;
- case "grip":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.HallInside = 10 - (int)((context.ReadValue<float>()) * 10f);
- break;
- case "grippressed":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.RHallInside, InputKeyState.DOWN);
- break;
- case "trigger":
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.HallFoward = 10 - (int)((context.ReadValue<float>()) * 10f);
- break;
- case "menu":
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.KS, true);
- Module_InputSystem.instance.SetActiveInputDevice(InputDeviceType.Head, false);
- API_GSXR_Module_InputSystem_KS.GSXR_KSRight.inputDataKS.inputKeys.InputDataAddKey(InputKeyCode.RFunction, InputKeyState.DOWN);
- break;
- }
- }
- // Debug.Log("OnEvent=name==>" + context.control.name);
- /*
- Debug.Log("OnEvent=layout==>" + context.control.layout);
- Debug.Log("OnEvent=noisy==>" + context.control.noisy);
- Debug.Log("OnEvent=path==>" + context.control.path);
- Debug.Log("OnEvent=shortDisplayName==>" + context.control.shortDisplayName);
- Debug.Log("OnEvent=synthetic==>" + context.control.synthetic);
- Debug.Log("OnEvent=valueSizeInBytes==>" + context.control.valueSizeInBytes);
- Debug.Log("OnEvent=valueType==>" + context.control.valueType.Name);
- Debug.Log("OnEvent=variants==>" + context.control.variants);
- Debug.Log("OnEvent=variants==>" + context.control.EvaluateMagnitude());*/
- }
|