InputDeviceGCPartEventConnect.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 InputDeviceGCPartEventConnect : InputDeviceGCPartEventBase {
  9. InputDevicePartDispatchEventGC inputDevicePartDispatchEventGC;
  10. public InputDeviceGCPartEventConnect(InputDevicePartDispatchEventGC inputDevicePartDispatchEventGC) : base(inputDevicePartDispatchEventGC) {
  11. this.inputDevicePartDispatchEventGC = inputDevicePartDispatchEventGC;
  12. }
  13. public override void OnSCStart() {
  14. base.OnSCStart();
  15. newevent = previousEvent = currentEvent = GCEventType.Null;
  16. }
  17. GCEventType newevent;
  18. protected override void OnUpdateEvent() {
  19. currentEvent = GCEventType.Null;
  20. if (inputDevicePartDispatchEventGC.inputDeviceGCPart.inputDataGC.isConnected == true) {
  21. newevent = GCEventType.Connect;
  22. } else if (inputDevicePartDispatchEventGC.inputDeviceGCPart.inputDataGC.isConnected == false) {
  23. newevent = GCEventType.DisConnect;
  24. }
  25. if (newevent != previousEvent) {
  26. previousEvent = newevent;
  27. currentEvent = newevent;
  28. }
  29. }
  30. }
  31. }