TestInput.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using RayNeo.Tool;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. public class TestInput : MonoBehaviour
  5. {
  6. [SerializeField]
  7. private Text InputTxt;
  8. private void OnEnable()
  9. {
  10. TouchEventCtrl.Instance.OnTouchStart += OnTouchStart;
  11. TouchEventCtrl.Instance.OnTouchDown += OnTouchDown;
  12. TouchEventCtrl.Instance.OnTouchUp += OnTouchUp;
  13. TouchEventCtrl.Instance.OnSwipeLeftEnd += OnSwipeLeftEnd;
  14. TouchEventCtrl.Instance.OnSwipeRightEnd += OnSwipeRightEnd;
  15. TouchEventCtrl.Instance.OnSwipeLeft += OnSwipeLeft;
  16. TouchEventCtrl.Instance.OnSwipeRight += OnSwipeRight;
  17. TouchEventCtrl.Instance.OnSimpleTap += OnSimpleTap;
  18. TouchEventCtrl.Instance.OnDoubleTap += OnDoubleTap;
  19. TouchEventCtrl.Instance.OnTripleTap += OnTripleTap;
  20. TouchEventCtrl.Instance.OnLongTap += OnLongTap;
  21. }
  22. private void OnDisable()
  23. {
  24. TouchEventCtrl.Instance.OnTouchStart -= OnTouchStart;
  25. TouchEventCtrl.Instance.OnTouchDown -= OnTouchDown;
  26. TouchEventCtrl.Instance.OnTouchUp -= OnTouchUp;
  27. TouchEventCtrl.Instance.OnSwipeLeftEnd -= OnSwipeLeftEnd;
  28. TouchEventCtrl.Instance.OnSwipeRightEnd -= OnSwipeRightEnd;
  29. TouchEventCtrl.Instance.OnSwipeLeft -= OnSwipeLeft;
  30. TouchEventCtrl.Instance.OnSwipeRight -= OnSwipeRight;
  31. TouchEventCtrl.Instance.OnDoubleTap -= OnDoubleTap;
  32. TouchEventCtrl.Instance.OnSimpleTap -= OnSimpleTap;
  33. TouchEventCtrl.Instance.OnTripleTap -= OnTripleTap;
  34. TouchEventCtrl.Instance.OnLongTap -= OnLongTap;
  35. }
  36. private void OnTouchStart()
  37. {
  38. Debug.Log("[MercuryX2]:OnTouchStart");
  39. InputTxt.text = "OnTouchStart";
  40. }
  41. private void OnTouchDown()
  42. {
  43. Debug.Log("[MercuryX2]:OnTouchDown");
  44. InputTxt.text = "OnTouchDown";
  45. }
  46. private void OnTouchUp()
  47. {
  48. Debug.Log("[MercuryX2]:OnTouchUp");
  49. InputTxt.text = "OnTouchUp";
  50. }
  51. private void OnSwipeLeftEnd()
  52. {
  53. Debug.Log("[MercuryX2]:OnSwipeLeftEnd");
  54. InputTxt.text = "OnSwipeLeftEnd";
  55. }
  56. private void OnSwipeRightEnd()
  57. {
  58. Debug.Log("[MercuryX2]:OnSwipeRightEnd");
  59. InputTxt.text = "OnSwipeRightEnd";
  60. }
  61. private void OnSwipeLeft()
  62. {
  63. Debug.Log("[MercuryX2]:OnSwipeLeft");
  64. InputTxt.text = "OnSwipeLeft";
  65. }
  66. private void OnSwipeRight()
  67. {
  68. Debug.Log("[MercuryX2]:OnSwipeRight");
  69. InputTxt.text = "OnSwipeRight";
  70. }
  71. private void OnDoubleTap()
  72. {
  73. Debug.LogError("[MercuryX2]:OnDoubleTap");
  74. InputTxt.text = "OnDoubleTap";
  75. }
  76. private void OnSimpleTap()
  77. {
  78. Debug.LogError("[MercuryX2]:OnSimpleTap");
  79. InputTxt.text = "OnSimpleTap";
  80. }
  81. private void OnTripleTap()
  82. {
  83. Debug.LogError("[MercuryX2]:OnTripleTap");
  84. InputTxt.text = "OnTripleTap";
  85. }
  86. private void OnLongTap()
  87. {
  88. Debug.LogError("[MercuryX2]:OnLongTap");
  89. InputTxt.text = "OnLongTap";
  90. }
  91. }