SCPointEventData.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 {
  9. public class SCPointEventData : PointerEventData {
  10. public InputDevicePartBase inputDevicePartBase;
  11. public SCPointEventData(InputDevicePartBase inputDevicePartBase, EventSystem eventSystem) : base(eventSystem) {
  12. this.inputDevicePartBase = inputDevicePartBase;
  13. }
  14. public PointerInputModule.MouseButtonEventData MouseButtonEventData = new PointerInputModule.MouseButtonEventData();
  15. /// <summary>
  16. /// 触摸Press的百分比,当为0-1 1表示Press触发
  17. /// </summary>
  18. public float TouchPressPercent = 0;
  19. public Action<float,float> TouchPressPercentDelegate;
  20. /// <summary>
  21. ///碰撞物体中心相对于HitPointer的局部坐标
  22. /// </summary>
  23. public Vector3 HitPointerRelativeRayCasterCamera = Vector3.zero;
  24. public Vector3 HitPointerDeltaDragObjCenter = Vector3.zero;
  25. /// <summary>
  26. /// Drag实时位置,是物体中心位置而不是Focus,通过hitPointer的位置和SelfCentreRelativehitPointerPosition算出的物体因该在的位置
  27. /// </summary>
  28. public Vector3 dragObjPosition = Vector3.zero;
  29. public Vector3 dragAnchorPosition3D = Vector3.zero;
  30. public Vector3 Position3D = Vector3.zero;
  31. public Vector3 PressPosition3D = Vector3.zero;
  32. public Vector3 pressForward = Vector3.zero;
  33. public Vector3 Forward = Vector3.zero;
  34. public GameObject DownPressGameObject;
  35. public float downtimer = 0;
  36. public float TriggerDeltaTime = 0.25f;
  37. public void Clear() {
  38. TouchPressPercent = 0;
  39. TouchPressPercentDelegate = null;
  40. HitPointerRelativeRayCasterCamera = Vector3.zero;
  41. HitPointerDeltaDragObjCenter = Vector3.zero;
  42. dragObjPosition = Vector3.zero;
  43. dragAnchorPosition3D = Vector3.zero;
  44. Position3D = Vector3.zero;
  45. PressPosition3D = Vector3.zero;
  46. pressForward = Vector3.zero;
  47. Forward = Vector3.zero;
  48. HitPointerRelativeRayCasterCamera = Vector3.zero;
  49. DownPressGameObject = null;
  50. }
  51. }
  52. }