InputDeviceGCPartEventTouchTP.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. namespace SC.XR.Unity.Module_InputSystem.InputDeviceGC {
  8. public class InputDeviceGCPartEventTouchTP : InputDeviceGCPartEventBase {
  9. InputDevicePartDispatchEventGC inputDevicePartDispatchEventGC;
  10. public InputDeviceGCPartEventTouchTP(InputDevicePartDispatchEventGC inputDevicePartDispatchEventGC) : base(inputDevicePartDispatchEventGC) {
  11. this.inputDevicePartDispatchEventGC = inputDevicePartDispatchEventGC;
  12. }
  13. protected override void OnUpdateEvent() {
  14. if(inputDevicePartDispatchEventGC.inputDeviceGCPart.inputDataGC.isTpTouch == true) {
  15. if(previousEvent == GCEventType.TouchDown || previousEvent == GCEventType.TouchDrag) {
  16. currentEvent = GCEventType.TouchDrag;
  17. } else {
  18. currentEvent = GCEventType.TouchDown;
  19. }
  20. } else {
  21. if(previousEvent == GCEventType.TouchDown || previousEvent == GCEventType.TouchDrag) {
  22. currentEvent = GCEventType.TouchUp;
  23. } else {
  24. currentEvent = GCEventType.Null;
  25. }
  26. }
  27. previousEvent = currentEvent;
  28. }
  29. }
  30. }