summaryrefslogtreecommitdiff
path: root/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData')
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/AxisEventData.cs15
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/AxisEventData.cs.meta13
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs42
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs.meta13
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/PointerEventData.cs138
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/PointerEventData.cs.meta13
6 files changed, 234 insertions, 0 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/AxisEventData.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/AxisEventData.cs
new file mode 100644
index 0000000..3278d6d
--- /dev/null
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/AxisEventData.cs
@@ -0,0 +1,15 @@
+namespace UnityEngine.EventSystems
+{
+ public class AxisEventData : BaseEventData
+ {
+ public Vector2 moveVector { get; set; }
+ public MoveDirection moveDir { get; set; }
+
+ public AxisEventData(EventSystem eventSystem)
+ : base(eventSystem)
+ {
+ moveVector = Vector2.zero;
+ moveDir = MoveDirection.None;
+ }
+ }
+}
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/AxisEventData.cs.meta b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/AxisEventData.cs.meta
new file mode 100644
index 0000000..d770a40
--- /dev/null
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/AxisEventData.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 068c7c2e61fdac34ebd23b76779526fd
+timeCreated: 1602119377
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs
new file mode 100644
index 0000000..f353314
--- /dev/null
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs
@@ -0,0 +1,42 @@
+namespace UnityEngine.EventSystems
+{
+ public abstract class AbstractEventData
+ {
+ protected bool m_Used; // 当前事件是否被处理(被吞)
+
+ public virtual void Reset()
+ {
+ m_Used = false;
+ }
+
+ public virtual void Use()
+ {
+ m_Used = true;
+ }
+
+ public virtual bool used
+ {
+ get { return m_Used; }
+ }
+ }
+
+ public class BaseEventData : AbstractEventData
+ {
+ private readonly EventSystem m_EventSystem;
+ public BaseEventData(EventSystem eventSystem)
+ {
+ m_EventSystem = eventSystem;
+ }
+
+ public BaseInputModule currentInputModule
+ {
+ get { return m_EventSystem.currentInputModule; }
+ }
+
+ public GameObject selectedObject
+ {
+ get { return m_EventSystem.currentSelectedGameObject; }
+ set { m_EventSystem.SetSelectedGameObject(value, this); } // 会发送一个selecthandler事件
+ }
+ }
+}
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs.meta b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs.meta
new file mode 100644
index 0000000..5265b51
--- /dev/null
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 8249b81d25be82b4388cb41d127fe369
+timeCreated: 1602119379
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/PointerEventData.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/PointerEventData.cs
new file mode 100644
index 0000000..9b94e00
--- /dev/null
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/PointerEventData.cs
@@ -0,0 +1,138 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+
+namespace UnityEngine.EventSystems
+{
+ /// <summary>
+ /// Each touch event creates one of these containing all the relevant information.
+ /// </summary>
+ 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; }
+
+ // The object that received OnPointerDown
+ private GameObject m_PointerPress;
+ // The object last received OnPointerDown
+ public GameObject lastPress { get; private set; }
+ // The object that the press happened on even if it can not handle the press event
+ public GameObject rawPointerPress { get; set; }
+ // The object that received OnDrag
+ public GameObject pointerDrag { 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; }
+
+ // Current position of the mouse or touch event
+ public Vector2 position { get; set; }
+ // Delta since last update
+ public Vector2 delta { get; set; }
+ // Position of the press event
+ public Vector2 pressPosition { get; set; }
+ // World-space position where a ray cast into the screen hits something
+ [Obsolete("Use either pointerCurrentRaycast.worldPosition or pointerPressRaycast.worldPosition")]
+ public Vector3 worldPosition { get; set; }
+ // World-space normal where a ray cast into the screen hits something
+ [Obsolete("Use either pointerCurrentRaycast.worldNormal or pointerPressRaycast.worldNormal")]
+ public Vector3 worldNormal { get; set; }
+ // The last time a click event was sent out (used for double-clicks)
+ public float clickTime { get; set; }
+ // Number of clicks in a row. 2 for a double-click for example.
+ 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 PointerEventData(EventSystem eventSystem) : base(eventSystem)
+ {
+ eligibleForClick = false;
+
+ pointerId = -1;
+ position = Vector2.zero; // Current position of the mouse or touch event
+ delta = Vector2.zero; // Delta since last update
+ pressPosition = Vector2.zero; // Delta since the event started being tracked
+ clickTime = 0.0f; // The last time a click event was sent out (used for double-clicks)
+ clickCount = 0; // Number of clicks in a row. 2 for a double-click for example.
+
+ scrollDelta = Vector2.zero;
+ useDragThreshold = true;
+ dragging = false;
+ button = InputButton.Left;
+ }
+
+ 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 Rayast:</b>");
+ sb.AppendLine(pointerCurrentRaycast.ToString());
+ sb.AppendLine("<b>Press Rayast:</b>");
+ sb.AppendLine(pointerPressRaycast.ToString());
+ return sb.ToString();
+ }
+ }
+}
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/PointerEventData.cs.meta b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/PointerEventData.cs.meta
new file mode 100644
index 0000000..866eab8
--- /dev/null
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/PointerEventData.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 721b5956a0219d74b9aa58b2fd44ffe3
+timeCreated: 1602119379
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: