123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- using System;
- using UnityEngine;
- using SC.InputSystem;
- using SC.InputSystem.InputDeviceHead;
- using SC.InputSystem.InputDeviceHandShank;
- using SC.InputSystem.InputDevice26DofGesture;
- public class API_InputSystem_Bluetooth {
-
-
-
-
-
- public static InputDeviceHandShank BTDevice {
- get {
- if(InputSystem.Instant) {
- return InputSystem.Instant.HandShank;
- }
- return null;
- }
- }
-
-
-
-
- public static InputDeviceHandShankPart BTRight {
- get {
- if(BTDevice && BTDevice.inputDeviceHandShankPartList[0]) {
- return BTDevice.inputDeviceHandShankPartList[0].inputDataBase.isVaild ? BTDevice.inputDeviceHandShankPartList[0] : null;
- }
- return null;
- }
- }
-
-
-
-
- public static InputDeviceHandShankPart BTLeft {
- get {
- if(BTDevice && BTDevice.inputDeviceHandShankPartList[1]) {
- return BTDevice.inputDeviceHandShankPartList[1].inputDataBase.isVaild ? BTDevice.inputDeviceHandShankPartList[1] : null;
- }
- return null;
- }
- }
- public enum BTType {
- Left,
- Right
- }
-
-
-
-
-
-
- public static Quaternion BTRotation(BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataHandShank.rotation;
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataHandShank.rotation;
- }
- return Quaternion.identity;
- }
-
-
-
-
-
-
- public static Vector3 BTPosition(BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataHandShank.position;
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataHandShank.position;
- }
- return Vector3.zero;
- }
-
-
-
-
-
-
- public static bool IsBTTpTouch(BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataHandShank.isTpTouch;
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataHandShank.isTpTouch;
- }
- return false;
- }
-
-
-
-
-
-
- public static Vector2 BTTpTouchInfo(BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataHandShank.tpPosition;
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataHandShank.tpPosition;
- }
- return Vector2.zero;
- }
-
-
-
-
-
-
- public static string BTName(BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataHandShank.blueToothName;
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataHandShank.blueToothName;
- }
- return "";
- }
-
-
-
-
-
-
- public static SCPointEventData BTPointerEventData(BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataBase.pointerEventData;
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataBase.pointerEventData;
- }
- return null;
- }
-
-
-
-
-
-
- public static GameObject BTHitTarget(BTType type = BTType.Right) {
- if(BTPointerEventData(type) != null) {
- return BTPointerEventData(type).target;
- }
- return null;
- }
-
-
-
-
-
- public static RaycastHit BTHitInfo(BTType type = BTType.Right) {
- if(BTPointerEventData(type) != null) {
- return BTPointerEventData(type).hitinfo;
- }
- return new RaycastHit();
- }
-
-
-
-
- public static GameObject BTDragTarget(BTType type = BTType.Right) {
- if(BTPointerEventData(type) != null) {
- return BTPointerEventData(type).dragTarget;
- }
- return null;
- }
-
-
-
-
-
-
- public static bool IsBTKeyDown(InputKeyCode inputKeyCode, BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataBase.GetKeyDown(inputKeyCode);
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataBase.GetKeyDown(inputKeyCode);
- }
- return false;
- }
-
-
-
-
-
-
- public static bool IsBTKeyUp(InputKeyCode inputKeyCode, BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataBase.GetKeyUp(inputKeyCode);
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataBase.GetKeyUp(inputKeyCode);
- }
- return false;
- }
-
-
-
-
-
-
- public static InputKeyState BTKeyState(InputKeyCode inputKeyCode, BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataBase.GetKeyState(inputKeyCode);
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataBase.GetKeyState(inputKeyCode);
- }
- return InputKeyState.Null;
- }
-
-
-
-
-
-
- public static InputKeyState BTKeyCurrentState(InputKeyCode inputKeyCode, BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDataBase.GetKeyCurrentState(inputKeyCode);
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDataBase.GetKeyCurrentState(inputKeyCode);
- }
- return InputKeyState.Null;
- }
-
-
-
-
-
-
- public static void BTKeyAddKey(InputKeyCode inputKeyCode, InputKeyState inputKeyState, BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- BTRight.inputDataBase.InputDataAddKey(inputKeyCode, inputKeyState);
- } else if(BTLeft && type == BTType.Left) {
- BTLeft.inputDataBase.InputDataAddKey(inputKeyCode, inputKeyState);
- }
- }
-
-
-
-
-
- public static void SetBTRayCastDistance(float distance, BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- BTRight.inputDeviceTargetDetecterBase.MaxRaycastRange = distance;
- } else if(BTLeft && type == BTType.Left) {
- BTLeft.inputDeviceTargetDetecterBase.MaxRaycastRange = distance;
- }
- }
-
-
-
-
-
- public static void SetBTEndPointerDistance(float distance, BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- BTRight.inputDeviceTargetDetecterBase.MaxEndPointRange = distance;
- } else if(BTLeft && type == BTType.Left) {
- BTLeft.inputDeviceTargetDetecterBase.MaxEndPointRange = distance;
- }
- }
-
-
-
-
-
- public static Focus GetBTFocus(BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDeviceUIBase.model.lineIndicate.focus;
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDeviceUIBase.model.lineIndicate.focus;
- }
- return null;
- }
-
-
-
-
-
- public static LineRenderer GetBTLine(BTType type = BTType.Right) {
- if(BTRight && type == BTType.Right) {
- return BTRight.inputDeviceUIBase.model.lineIndicate.line;
- } else if(BTLeft && type == BTType.Left) {
- return BTLeft.inputDeviceUIBase.model.lineIndicate.line;
- }
- return null;
- }
-
-
-
-
-
- public static void EnableBT(BTType type = BTType.Right) {
- if(BTDevice && type == BTType.Right) {
- BTDevice.OneHandShankOpen = true;
- } else if(BTDevice && type == BTType.Left) {
- BTDevice.TwoHandShankOpen = true;
- }
- }
-
-
-
-
-
- public static void DisableableBT(BTType type = BTType.Right) {
- if(BTDevice && type == BTType.Right) {
- BTDevice.OneHandShankOpen = false;
- } else if(BTDevice && type == BTType.Left) {
- BTDevice.TwoHandShankOpen = false;
- }
- }
- }
|