InputDeviceHandPartStaticEvent.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 InputDeviceHandPartStaticEvent : InputDeviceHandPartEventBase {
  10. public InputDeviceHandPartStaticEvent(InputDevicePartDispatchEventHand inputDevicePartDispatchEventHand) : base(inputDevicePartDispatchEventHand) {
  11. }
  12. public override void OnSCStart() {
  13. base.OnSCStart();
  14. newEvent = previousEvent = currentEvent = HandEventType.Null;
  15. }
  16. HandEventType newEvent;
  17. protected override void OnUpdateEvent() {
  18. currentEvent = HandEventType.Null;
  19. if (handInfo.iv_extinfo.ges_static[0] > -1 && handInfo.iv_extinfo.ges_static[0] < 13) {
  20. if (0 == handInfo.iv_extinfo.ges_static[0]) {
  21. newEvent = HandEventType.Static_Fist;
  22. }else if (1 == handInfo.iv_extinfo.ges_static[0]) {
  23. newEvent = HandEventType.Static_Point;
  24. } else if (2 == handInfo.iv_extinfo.ges_static[0]) {
  25. newEvent = HandEventType.Static_Peace;
  26. } else if (3 == handInfo.iv_extinfo.ges_static[0]) {
  27. newEvent = HandEventType.Static_Three;
  28. } else if (4 == handInfo.iv_extinfo.ges_static[0]) {
  29. newEvent = HandEventType.Static_Four;
  30. } else if (5 == handInfo.iv_extinfo.ges_static[0]) {
  31. newEvent = HandEventType.Static_Five;
  32. } else if (6 == handInfo.iv_extinfo.ges_static[0]) {
  33. newEvent = HandEventType.Static_Phone;
  34. } else if (7 == handInfo.iv_extinfo.ges_static[0]) {
  35. newEvent = HandEventType.Static_Damn;
  36. } else if (8 == handInfo.iv_extinfo.ges_static[0]) {
  37. newEvent = HandEventType.Static_Gun;
  38. } else if (9 == handInfo.iv_extinfo.ges_static[0]) {
  39. newEvent = HandEventType.Static_Like;
  40. } else if (10 == handInfo.iv_extinfo.ges_static[0]) {
  41. newEvent = HandEventType.Static_No_Like;
  42. } else if (11 == handInfo.iv_extinfo.ges_static[0]) {
  43. newEvent = HandEventType.Static_OK;
  44. } else if (12 == handInfo.iv_extinfo.ges_static[0]) {
  45. newEvent = HandEventType.Static_RockAndRoll;
  46. } else if (-1 == handInfo.iv_extinfo.ges_static[0]) {
  47. newEvent = HandEventType.Static_Other;
  48. }
  49. }
  50. if (newEvent != previousEvent) {
  51. previousEvent = newEvent;
  52. currentEvent = newEvent;
  53. }
  54. //if (currentEvent != HandEventType.Null) {
  55. // DebugMy.Log(inputDeviceHandPart.PartType + " Event -----> " + currentEvent, this, true);
  56. //}
  57. }
  58. public override void OnSCDisable() {
  59. if (previousEvent != HandEventType.Null) {
  60. currentEvent = HandEventType.Null;
  61. }
  62. base.OnSCDisable();
  63. }
  64. }
  65. }