diff options
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters')
4 files changed, 116 insertions, 0 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycastResult.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycastResult.cs new file mode 100644 index 0000000..666ef8d --- /dev/null +++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycastResult.cs @@ -0,0 +1,65 @@ +namespace UnityEngine.EventSystems +{ + // UGUIÉäÏß¼ì²â½á¹û + public struct RaycastResult + { + private GameObject m_GameObject; // Game object hit by the raycast + + public GameObject gameObject + { + get { return m_GameObject; } + set { m_GameObject = value; } + } + + public BaseRaycaster module; // Event system that hit this object + public float distance; // The distance from the origin this hit was. + public float index; // The index this element is in the raycastList (used for sorting) + public int depth; + public int sortingLayer; + public int sortingOrder; + // World-space position where a ray cast into the screen hits something + public Vector3 worldPosition; + // World-space normal where a ray cast into the screen hits something + public Vector3 worldNormal; + + public Vector2 screenPosition; + + public bool isValid + { + get { return module != null && gameObject != null; } + } + + public void Clear() + { + gameObject = null; + module = null; + distance = 0; + index = 0; + depth = 0; + sortingLayer = 0; + sortingOrder = 0; + worldNormal = Vector3.up; + worldPosition = Vector3.zero; + screenPosition = Vector2.zero; + } + + public override string ToString() + { + if (!isValid) + return ""; + + return "Name: " + gameObject + "\n" + + "module: " + module + "\n" + + "distance: " + distance + "\n" + + "index: " + index + "\n" + + "depth: " + depth + "\n" + + "worldNormal: " + worldNormal + "\n" + + "worldPosition: " + worldPosition + "\n" + + "screenPosition: " + screenPosition + "\n" + + "module.sortOrderPriority: " + module.sortOrderPriority + "\n" + + "module.renderOrderPriority: " + module.renderOrderPriority + "\n" + + "sortingLayer: " + sortingLayer + "\n" + + "sortingOrder: " + sortingOrder; + } + } +} diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycastResult.cs.meta b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycastResult.cs.meta new file mode 100644 index 0000000..c2d01ba --- /dev/null +++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycastResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5f5a2c96e65809c43ad8a958f062ef1f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycasterManager.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycasterManager.cs new file mode 100644 index 0000000..c3480b4 --- /dev/null +++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycasterManager.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace UnityEngine.EventSystems +{ + internal static class RaycasterManager + { + private static readonly List<BaseRaycaster> s_Raycasters = new List<BaseRaycaster>(); + + public static void AddRaycaster(BaseRaycaster baseRaycaster) + { + if (s_Raycasters.Contains(baseRaycaster)) + return; + + s_Raycasters.Add(baseRaycaster); + } + + public static List<BaseRaycaster> GetRaycasters() + { + return s_Raycasters; + } + + public static void RemoveRaycasters(BaseRaycaster baseRaycaster) + { + if (!s_Raycasters.Contains(baseRaycaster)) + return; + s_Raycasters.Remove(baseRaycaster); + } + } +} diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycasterManager.cs.meta b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycasterManager.cs.meta new file mode 100644 index 0000000..594b8d2 --- /dev/null +++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/RaycasterManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c12b7bf7a4800945ba532802a36b165 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |