summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-04-28 17:21:06 +0800
committerchai <chaifix@163.com>2021-04-28 17:21:06 +0800
commitd345feed67b425495dc3b757785a346797da7267 (patch)
treee9c8d4cd61ed840995a250098e94ec67a0dcab39
parentc3979444c23fb831ebd2be4ec8829b691ee71474 (diff)
*Image\RawImage
-rw-r--r--Assets/Test/06_Layout/06_Layout.unity153
-rw-r--r--Assets/Test/06_Layout/UI06Test.cs38
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Graphic.cs1
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Image.cs10
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/RawImage.cs3
5 files changed, 188 insertions, 17 deletions
diff --git a/Assets/Test/06_Layout/06_Layout.unity b/Assets/Test/06_Layout/06_Layout.unity
index 76f31f4..3f7b980 100644
--- a/Assets/Test/06_Layout/06_Layout.unity
+++ b/Assets/Test/06_Layout/06_Layout.unity
@@ -229,6 +229,7 @@ GameObject:
- component: {fileID: 613556426}
- component: {fileID: 613556425}
- component: {fileID: 613556427}
+ - component: {fileID: 613556428}
m_Layer: 5
m_Name: Green
m_TagString: Untagged
@@ -303,9 +304,28 @@ MonoBehaviour:
m_MinHeight: 32
m_PreferredWidth: 64
m_PreferredHeight: 64
- m_FlexibleWidth: 3
- m_FlexibleHeight: 1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
m_LayoutPriority: 1
+--- !u!114 &613556428
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 613556423}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 1ae73daeb8941804886a5ec8aa41dc2a, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: 64
+ m_MinHeight: 64
+ m_PreferredWidth: 128
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 2
--- !u!1 &957653075
GameObject:
m_ObjectHideFlags: 0
@@ -391,8 +411,8 @@ MonoBehaviour:
m_MinHeight: 40
m_PreferredWidth: 50
m_PreferredHeight: 50
- m_FlexibleWidth: 1
- m_FlexibleHeight: 1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &1341807674
GameObject:
@@ -481,6 +501,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1447362004}
+ - {fileID: 1600627337}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -509,6 +530,8 @@ GameObject:
m_Component:
- component: {fileID: 1447362004}
- component: {fileID: 1447362005}
+ - component: {fileID: 1447362006}
+ - component: {fileID: 1447362007}
m_Layer: 5
m_Name: HorizontalLayoutGroup
m_TagString: Untagged
@@ -533,8 +556,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: -590.23, y: 362.81}
- m_SizeDelta: {x: 360.13, y: 266.09}
+ m_AnchoredPosition: {x: -469.1, y: 287.73}
+ m_SizeDelta: {x: 356.27, y: 416.25}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1447362005
MonoBehaviour:
@@ -548,16 +571,124 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Padding:
- m_Left: 30
- m_Right: 40
- m_Top: 50
- m_Bottom: 60
- m_ChildAlignment: 2
+ m_Left: 0
+ m_Right: 0
+ m_Top: 0
+ m_Bottom: 0
+ m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
+--- !u!114 &1447362006
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1447362003}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 742ec49dc902c1f4db49d19ada047c0e, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_HorizontalFit: 0
+ m_VerticalFit: 0
+--- !u!114 &1447362007
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1447362003}
+ m_Enabled: 0
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 49604c30279a7aa44b531ad6ffea458c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_AspectMode: 0
+ m_AspectRatio: 0.42842647
+--- !u!1 &1600627336
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1600627337}
+ - component: {fileID: 1600627340}
+ - component: {fileID: 1600627339}
+ - component: {fileID: 1600627338}
+ m_Layer: 5
+ m_Name: Image
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1600627337
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1600627336}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1341807678}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: 49.1, y: -22.94}
+ m_SizeDelta: {x: 244.06, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1600627338
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1600627336}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 49604c30279a7aa44b531ad6ffea458c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_AspectMode: 1
+ m_AspectRatio: 1
+--- !u!114 &1600627339
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1600627336}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 0cba8e295482e184f9f6a5a8f2b559c3, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, Assembly-CSharp,
+ Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
+ m_Sprite: {fileID: 21300000, guid: e3947587ecd38f84fbd22c51232fb9c7, type: 3}
+ m_Type: 0
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+--- !u!222 &1600627340
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1600627336}
--- !u!1 &1795588620
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Test/06_Layout/UI06Test.cs b/Assets/Test/06_Layout/UI06Test.cs
index 70ec744..da4d269 100644
--- a/Assets/Test/06_Layout/UI06Test.cs
+++ b/Assets/Test/06_Layout/UI06Test.cs
@@ -4,11 +4,44 @@ using System.Collections.Generic;
using UnityEngine;
using System.Linq;
-interface IS
+
+interface ITest
+{
+ void Test();
+}
+interface ITest2
+{
+ void Test();
+}
+
+class Dual : ITest //, ITest2
+{
+
+ void ITest.Test()
+ {
+ Debug.Log("test");
+ }
+
+ //void ITest.Test()
+ //{
+ // Debug.Log("ITest.Test");
+ //}
+
+ //void ITest2.Test()
+ //{
+ // Debug.Log("ITest2.Test");
+ //}
+}
+
+public interface IS
{
void Foo();
}
+public interface IS2
+{
+ void Foo();
+}
struct StructA : IS
{
public static int value2 = 29;
@@ -25,7 +58,6 @@ struct StructA : IS
{
throw new NotImplementedException();
}
-
}
@@ -79,6 +111,8 @@ public class UI06Test : MonoBehaviour {
//StructA? bb;
Nullable<StructA> bb;
bb = null;
+ ITest dual = new Dual();
+ dual.Test();
}
void Foo()
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;
}
}