HandDispatcher.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using UnityEngine;
  7. using UnityEngine.EventSystems;
  8. namespace SC.XR.Unity.Module_InputSystem.InputDeviceHand {
  9. public class HandDispatcher : DispatcherBase {
  10. public HandDispatcher(InputDevicePartDispatchEventHand inputDevicePartDispatchEventHand) :base(inputDevicePartDispatchEventHand) {
  11. }
  12. /// <summary>
  13. /// When Any part Device of Any key Down will invoke this delegate
  14. /// </summary>
  15. /// <param name="keyCode">which key</param>
  16. /// <param name="part">which part,part.PartType</param>
  17. //public static event HandEventDelegate HandCatchEventDelegate;
  18. //public static void OnHandTurnFaceDown(GameObject obj, InputDevice26DofGesturePart devicePart, SCPointEventData eventData = null) {
  19. // ExecuteEvents.Execute<IGestureHandTurnFaceDownHandler>(obj, null, (x, y) => x.OnHandTurnFaceDown(devicePart, eventData));
  20. //}
  21. //public static void OnHandTurnFaceUp(GameObject obj, InputDevice26DofGesturePart devicePart, SCPointEventData eventData = null) {
  22. // ExecuteEvents.Execute<IGestureHandTurnFaceUpHandler>(obj, null, (x, y) => x.OnHandTurnFaceUp(devicePart, eventData));
  23. //}
  24. //public static void OnHandTurnFaceDrag(GameObject obj, InputDevice26DofGesturePart devicePart, SCPointEventData eventData = null) {
  25. // ExecuteEvents.Execute<IGestureHandTurnFaceDragHandler>(obj, null, (x, y) => x.OnHandTurnFaceDrag(devicePart, eventData));
  26. //}
  27. //public static void OnJointTouchEnter(GameObject obj, InputDevice26DofGesturePart devicePart, SCPointEventData eventData = null) {
  28. // ExecuteEvents.Execute<IGestureJointTouchEnterHandler>(obj, null, (x, y) => x.OnJointTouchEnter(devicePart, eventData));
  29. //}
  30. //public static void OnJointTouchExit(GameObject obj, InputDevice26DofGesturePart devicePart, SCPointEventData eventData = null) {
  31. // ExecuteEvents.Execute<IGestureJointTouchExitHandler>(obj, null, (x, y) => x.OnJointTouchExit(devicePart, eventData));
  32. //}
  33. public static void OnHandCatchDown(GameObject obj, InputDeviceHandPart inputDeviceHandPart, SCPointEventData sCPointEventData = null) {
  34. ExecuteEvents.Execute<IHandCatchDownHandler>(obj, null, (x, y) => x.OnHandCatchDown(inputDeviceHandPart, sCPointEventData));
  35. }
  36. public static void OnHandCatchUp(GameObject obj, InputDeviceHandPart inputDeviceHandPart, SCPointEventData sCPointEventData = null) {
  37. ExecuteEvents.Execute<IHandCatchUpHandler>(obj, null, (x, y) => x.OnHandCatchUp(inputDeviceHandPart, sCPointEventData));
  38. }
  39. public static void OnHandCatchDrag(GameObject obj, InputDeviceHandPart inputDeviceHandPart, SCPointEventData sCPointEventData = null) {
  40. ExecuteEvents.Execute<IHandCatchDragHandler>(obj, null, (x, y) => x.OnHandCatchDrag(inputDeviceHandPart, sCPointEventData));
  41. }
  42. //public static void OnHandPinchDown(GameObject obj, InputDevice26DofGesturePart devicePart, SCPointEventData eventData = null) {
  43. // ExecuteEvents.Execute<IGestureHandPinchDownHandler>(obj, null, (x, y) => x.OnHandPinchDown(devicePart, eventData));
  44. //}
  45. //public static void OnHandPinchUp(GameObject obj, InputDevice26DofGesturePart devicePart, SCPointEventData eventData = null) {
  46. // ExecuteEvents.Execute<IGestureHandPinchUpHandler>(obj, null, (x, y) => x.OnHandPinchUp(devicePart, eventData));
  47. //}
  48. public static void OnPokeDown(GameObject obj, TouchPointer touchPointer, SCPointEventData sCPointEventData = null) {
  49. ExecuteEvents.Execute<IPokeDownHandler>(obj, null, (x, y) => x.OnPokeDown(touchPointer, sCPointEventData));
  50. }
  51. public static void OnPokeUp(GameObject obj, TouchPointer touchPointer, SCPointEventData sCPointEventData = null) {
  52. ExecuteEvents.Execute<IPokeUpHandler>(obj, null, (x, y) => x.OnPokeUp(touchPointer, sCPointEventData));
  53. }
  54. public static void OnPokeUpdated(GameObject obj, TouchPointer touchPointer, SCPointEventData sCPointEventData = null) {
  55. ExecuteEvents.Execute<IPokeUpdatedHandler>(obj, null, (x, y) => x.OnPokeUpdated(touchPointer, sCPointEventData));
  56. }
  57. }
  58. public interface IPokeDownHandler : IEventSystemHandler {
  59. void OnPokeDown(TouchPointer touchPointer, SCPointEventData eventData);
  60. }
  61. public interface IPokeUpHandler : IEventSystemHandler {
  62. void OnPokeUp(TouchPointer touchPointer, SCPointEventData eventData);
  63. }
  64. public interface IPokeUpdatedHandler : IEventSystemHandler {
  65. void OnPokeUpdated(TouchPointer touchPointer, SCPointEventData eventData);
  66. }
  67. //public interface IGestureJointTouchEnterHandler : IEventSystemHandler {
  68. // void OnJointTouchEnter(InputDevice26DofGesturePart devicePart, SCPointEventData eventData);
  69. //}
  70. //public interface IGestureJointTouchExitHandler : IEventSystemHandler {
  71. // void OnJointTouchExit(InputDevice26DofGesturePart devicePart, SCPointEventData eventData);
  72. //}
  73. //public interface IGestureHandPinchDownHandler : IEventSystemHandler {
  74. // void OnHandPinchDown(InputDevice26DofGesturePart devicePart, SCPointEventData eventData);
  75. //}
  76. //public interface IGestureHandPinchUpHandler : IEventSystemHandler {
  77. // void OnHandPinchUp(InputDevice26DofGesturePart devicePart, SCPointEventData eventData);
  78. //}
  79. }