123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- using System;
- using System.Text;
- using System.Collections.Generic;
- namespace UnityEngine.EventSystems
- {
-
-
-
- public class PointerEventData : BaseEventData
- {
-
-
-
- public enum InputButton
- {
-
-
-
- Left = 0,
-
-
-
- Right = 1,
-
-
-
- Middle = 2
- }
-
-
-
- public enum FramePressState
- {
-
-
-
- Pressed,
-
-
-
- Released,
-
-
-
- PressedAndReleased,
-
-
-
- NotChanged
- }
-
-
-
- public GameObject pointerEnter { get; set; }
-
- private GameObject m_PointerPress;
-
-
-
- public GameObject lastPress { get; private set; }
-
-
-
- public GameObject rawPointerPress { get; set; }
-
-
-
- public GameObject pointerDrag { get; set; }
-
-
-
- public GameObject pointerClick { get; set; }
-
-
-
- public RaycastResult pointerCurrentRaycast { get; set; }
-
-
-
- public RaycastResult pointerPressRaycast { get; set; }
- public List<GameObject> hovered = new List<GameObject>();
-
-
-
- public bool eligibleForClick { get; set; }
-
-
-
- public int pointerId { get; set; }
-
-
-
- public Vector2 position { get; set; }
-
-
-
- public Vector2 delta { get; set; }
-
-
-
- public Vector2 pressPosition { get; set; }
-
-
-
- [Obsolete("Use either pointerCurrentRaycast.worldPosition or pointerPressRaycast.worldPosition")]
- public Vector3 worldPosition { get; set; }
-
-
-
- [Obsolete("Use either pointerCurrentRaycast.worldNormal or pointerPressRaycast.worldNormal")]
- public Vector3 worldNormal { get; set; }
-
-
-
- public float clickTime { get; set; }
-
-
-
-
-
-
-
-
- public int clickCount { get; set; }
-
-
-
- public Vector2 scrollDelta { get; set; }
-
-
-
-
-
-
- public bool useDragThreshold { get; set; }
-
-
-
- public bool dragging { get; set; }
-
-
-
- public InputButton button { get; set; }
-
-
-
-
-
-
-
- public float pressure { get; set; }
-
-
-
-
- public float tangentialPressure { get; set; }
-
-
-
-
-
-
-
- public float altitudeAngle { get; set; }
-
-
-
-
-
-
-
- public float azimuthAngle { get; set; }
-
-
-
-
- public float twist { get; set; }
-
-
-
-
-
-
-
- public Vector2 radius { get; set; }
-
-
-
-
-
-
- public Vector2 radiusVariance { get; set; }
-
-
-
- public bool fullyExited { get; set; }
-
-
-
- public bool reentered { get; set; }
-
- public PointerEventData(EventSystem eventSystem) : base(eventSystem)
- {
- eligibleForClick = false;
- pointerId = -1;
- position = Vector2.zero;
- delta = Vector2.zero;
- pressPosition = Vector2.zero;
- clickTime = 0.0f;
- clickCount = 0;
- scrollDelta = Vector2.zero;
- useDragThreshold = true;
- dragging = false;
- button = InputButton.Left;
- pressure = 0f;
- tangentialPressure = 0f;
- altitudeAngle = 0f;
- azimuthAngle = 0f;
- twist = 0f;
- radius = Vector2.zero;
- radiusVariance = Vector2.zero;
- }
-
-
-
- public bool IsPointerMoving()
- {
- return delta.sqrMagnitude > 0.0f;
- }
-
-
-
- public bool IsScrolling()
- {
- return scrollDelta.sqrMagnitude > 0.0f;
- }
-
-
-
- public Camera enterEventCamera
- {
- get { return pointerCurrentRaycast.module == null ? null : pointerCurrentRaycast.module.eventCamera; }
- }
-
-
-
- public Camera pressEventCamera
- {
- get { return pointerPressRaycast.module == null ? null : pointerPressRaycast.module.eventCamera; }
- }
-
-
-
- public GameObject pointerPress
- {
- get { return m_PointerPress; }
- set
- {
- if (m_PointerPress == value)
- return;
- lastPress = m_PointerPress;
- m_PointerPress = value;
- }
- }
- public override string ToString()
- {
- var sb = new StringBuilder();
- sb.AppendLine("<b>Position</b>: " + position);
- sb.AppendLine("<b>delta</b>: " + delta);
- sb.AppendLine("<b>eligibleForClick</b>: " + eligibleForClick);
- sb.AppendLine("<b>pointerEnter</b>: " + pointerEnter);
- sb.AppendLine("<b>pointerPress</b>: " + pointerPress);
- sb.AppendLine("<b>lastPointerPress</b>: " + lastPress);
- sb.AppendLine("<b>pointerDrag</b>: " + pointerDrag);
- sb.AppendLine("<b>Use Drag Threshold</b>: " + useDragThreshold);
- sb.AppendLine("<b>Current Raycast:</b>");
- sb.AppendLine(pointerCurrentRaycast.ToString());
- sb.AppendLine("<b>Press Raycast:</b>");
- sb.AppendLine(pointerPressRaycast.ToString());
- sb.AppendLine("<b>pressure</b>: " + pressure);
- sb.AppendLine("<b>tangentialPressure</b>: " + tangentialPressure);
- sb.AppendLine("<b>altitudeAngle</b>: " + altitudeAngle);
- sb.AppendLine("<b>azimuthAngle</b>: " + azimuthAngle);
- sb.AppendLine("<b>twist</b>: " + twist);
- sb.AppendLine("<b>radius</b>: " + radius);
- sb.AppendLine("<b>radiusVariance</b>: " + radiusVariance);
- return sb.ToString();
- }
- }
- }
|