From d345feed67b425495dc3b757785a346797da7267 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 28 Apr 2021 17:21:06 +0800 Subject: *Image\RawImage --- Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Graphic.cs | 1 + Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Image.cs | 10 ++++++++-- Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/RawImage.cs | 3 +-- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics') diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Graphic.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Graphic.cs index e0d70f3..845bfc4 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Graphic.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Graphic.cs @@ -532,6 +532,7 @@ namespace UnityEngine.UI if (canvas != null && canvas.overrideSorting) continueTraversal = false; + // 如果实现了这个接口再进一步判断一下 var filter = components[i] as ICanvasRaycastFilter; if (filter == null) diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Image.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Image.cs index 4844c19..65e0cfd 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Image.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Image.cs @@ -202,8 +202,12 @@ namespace UnityEngine.UI } } - public virtual void OnBeforeSerialize() {} + public virtual void OnBeforeSerialize() + { + //Debug.Log("OnBeforeSerialize"); + } + // 序列化之后,即修改了序列化参数之后。校正一下结果 public virtual void OnAfterDeserialize() { if (m_FillOrigin < 0) @@ -321,11 +325,12 @@ namespace UnityEngine.UI return; } + //如果是ETC压缩格式,会生成一份alphaTex只保存透明度信息,不在_MainTex里 Texture2D alphaTex = activeSprite.associatedAlphaSplitTexture; if (alphaTex != null) { - canvasRenderer.SetAlphaTexture(alphaTex); + canvasRenderer.SetAlphaTexture(alphaTex); // _AlphaTex } } @@ -1082,6 +1087,7 @@ namespace UnityEngine.UI public virtual int layoutPriority { get { return 0; } } + //会根据透明度做更细致的射线检测,透明的地方不算 public virtual bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera) { if (alphaHitTestMinimumThreshold <= 0) diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/RawImage.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/RawImage.cs index 35f0508..e6dab1b 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/RawImage.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/RawImage.cs @@ -29,14 +29,13 @@ namespace UnityEngine.UI get { if (m_Texture == null) - { + { if (material != null && material.mainTexture != null) { return material.mainTexture; } return s_WhiteTexture; } - return m_Texture; } } -- cgit v1.1-26-g67d0