summaryrefslogtreecommitdiff
path: root/Assets
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-04-26 21:16:23 +0800
committerchai <chaifix@163.com>2021-04-26 21:16:23 +0800
commit83eb6c0dc5773c40b5ee4d9b2fb1d72a7d5294f5 (patch)
treef8be10f80451f730529d66ecef7cad0c40e3505c /Assets
parentd4e02e80388649a184bc6eb247e035102eb3c81d (diff)
*misc
Diffstat (limited to 'Assets')
-rw-r--r--Assets/Test/06_Layout/06_Layout.unity67
-rw-r--r--Assets/Test/06_Layout/New Flare.flare36
-rw-r--r--Assets/Test/06_Layout/New Flare.flare.meta8
-rw-r--r--Assets/Test/06_Layout/UI06Test.cs90
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs10
5 files changed, 168 insertions, 43 deletions
diff --git a/Assets/Test/06_Layout/06_Layout.unity b/Assets/Test/06_Layout/06_Layout.unity
index e447d2e..1a3995c 100644
--- a/Assets/Test/06_Layout/06_Layout.unity
+++ b/Assets/Test/06_Layout/06_Layout.unity
@@ -29,7 +29,7 @@ RenderSettings:
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
- m_FlareFadeSpeed: 3
+ m_FlareFadeSpeed: 4.09
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
@@ -113,6 +113,46 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
+--- !u!1 &359363332
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 359363334}
+ - component: {fileID: 359363333}
+ m_Layer: 0
+ m_Name: GameObject
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &359363333
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 359363332}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: a3b693bfc0703244ca4330d08ad9bb3c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+--- !u!4 &359363334
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 359363332}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 334.28125, y: 963.4125, z: 0.25}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &577020334
GameObject:
m_ObjectHideFlags: 0
@@ -138,7 +178,7 @@ Light:
m_Enabled: 1
serializedVersion: 8
m_Type: 1
- m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
@@ -154,7 +194,7 @@ Light:
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
- m_RenderMode: 0
+ m_RenderMode: 1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
@@ -512,7 +552,7 @@ MonoBehaviour:
m_Right: 40
m_Top: 50
m_Bottom: 60
- m_ChildAlignment: 0
+ m_ChildAlignment: 2
m_Spacing: 0
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
@@ -591,7 +631,6 @@ GameObject:
- component: {fileID: 2097713100}
- component: {fileID: 2097713099}
- component: {fileID: 2097713098}
- - component: {fileID: 2097713102}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@@ -621,7 +660,7 @@ Camera:
m_GameObject: {fileID: 2097713097}
m_Enabled: 1
serializedVersion: 2
- m_ClearFlags: 1
+ m_ClearFlags: 2
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
@@ -655,21 +694,11 @@ Transform:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2097713097}
- m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: 0, y: 1, z: -10}
+ m_LocalRotation: {x: 0.00000003352761, y: -0.00000008940696, z: -0.0000000372529,
+ w: 1}
+ m_LocalPosition: {x: -1.6310556, y: -19.635422, z: -44}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!114 &2097713102
-MonoBehaviour:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 2097713097}
- m_Enabled: 1
- m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: a3b693bfc0703244ca4330d08ad9bb3c, type: 3}
- m_Name:
- m_EditorClassIdentifier:
diff --git a/Assets/Test/06_Layout/New Flare.flare b/Assets/Test/06_Layout/New Flare.flare
new file mode 100644
index 0000000..dc175e5
--- /dev/null
+++ b/Assets/Test/06_Layout/New Flare.flare
@@ -0,0 +1,36 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!121 &12100000
+Flare:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: New Flare
+ m_FlareTexture: {fileID: 2800000, guid: e0e4486c00f607e45928a93eaea43e63, type: 3}
+ m_TextureLayout: 1
+ m_Elements:
+ - m_ImageIndex: 0
+ m_Position: 0
+ m_Size: 6.41
+ m_Color: {r: 1, g: 1, b: 1, a: 0}
+ m_UseLightColor: 1
+ m_Rotate: 0
+ m_Zoom: 1
+ m_Fade: 0
+ - m_ImageIndex: 0
+ m_Position: 0.64
+ m_Size: 15.1
+ m_Color: {r: 1, g: 1, b: 1, a: 0}
+ m_UseLightColor: 1
+ m_Rotate: 0
+ m_Zoom: 1
+ m_Fade: 0
+ - m_ImageIndex: 0
+ m_Position: 0.96
+ m_Size: 6.41
+ m_Color: {r: 1, g: 1, b: 1, a: 0}
+ m_UseLightColor: 1
+ m_Rotate: 0
+ m_Zoom: 1
+ m_Fade: 0
+ m_UseFog: 0
diff --git a/Assets/Test/06_Layout/New Flare.flare.meta b/Assets/Test/06_Layout/New Flare.flare.meta
new file mode 100644
index 0000000..510b38f
--- /dev/null
+++ b/Assets/Test/06_Layout/New Flare.flare.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2a25de8eb662fde48825b292d1dbff29
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 12100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Test/06_Layout/UI06Test.cs b/Assets/Test/06_Layout/UI06Test.cs
index 5b3dcb7..70ec744 100644
--- a/Assets/Test/06_Layout/UI06Test.cs
+++ b/Assets/Test/06_Layout/UI06Test.cs
@@ -4,6 +4,32 @@ using System.Collections.Generic;
using UnityEngine;
using System.Linq;
+interface IS
+{
+ void Foo();
+}
+
+struct StructA : IS
+{
+ public static int value2 = 29;
+ public int value;
+ public RectTransform rectTransform;
+ public StructA(RectTransform rect, int v)
+ {
+ // Debug.Log("StructA()");
+ this.rectTransform = rect;
+ this.value = v;
+ }
+
+ public void Foo()
+ {
+ throw new NotImplementedException();
+ }
+
+}
+
+
+
public class UI06Test : MonoBehaviour {
public delegate void ClickHandler();
@@ -11,26 +37,50 @@ public class UI06Test : MonoBehaviour {
public delegate void BroadcastCallback(params object[] objs);
// Use this for initialization
- void Start () {
- // OnClick += () => { Debug.Log("1"); };
- // OnClick += () => { Debug.Log("2"); };
- // OnClick += Foo;
- // OnClick += Foo;
- // OnClick += Foo;
- // OnClick += () => { Debug.Log("3"); };
- // OnClick += () => { Debug.Log("4"); };
- // OnClick += () => { Debug.Log("5"); };
- // OnClick -= Foo;
- // OnClick -= Foo;
- // OnClick -= Foo;
- // OnClick = OnClick - Foo;
- //// Delegate.Remove(OnClick, Foo);
- // OnClick();
- // ClickHandler f2 = new ClickHandler(Foo);
- // ClickHandler f3 = Foo;
- // Dictionary<int, float> a;
- }
-
+ void Start () {
+ // OnClick += () => { Debug.Log("1"); };
+ // OnClick += () => { Debug.Log("2"); };
+ // OnClick += Foo;
+ // OnClick += Foo;
+ // OnClick += Foo;
+ // OnClick += () => { Debug.Log("3"); };
+ // OnClick += () => { Debug.Log("4"); };
+ // OnClick += () => { Debug.Log("5"); };
+ // OnClick -= Foo;
+ // OnClick -= Foo;
+ // OnClick -= Foo;
+ // OnClick = OnClick - Foo;
+ //// Delegate.Remove(OnClick, Foo);
+ // OnClick();
+ // ClickHandler f2 = new ClickHandler(Foo);
+ // ClickHandler f3 = Foo;
+ // Dictionary<int, float> a;
+ RectTransform rect = GetComponent<RectTransform>();
+ StructA a = new StructA(rect, 1);
+ Debug.Log(a.GetHashCode());
+ StructA a2 = new StructA(null, 1);
+ Debug.Log(a2.GetHashCode());
+ StructA b = new StructA(rect, 2);
+ Debug.Log(b.GetHashCode());
+ Dictionary<StructA, int> d = new Dictionary<StructA, int>();
+ d.Add(a, 10);
+ if (d.ContainsKey(a2))
+ {
+ Debug.Log("包含");
+ }
+ else
+ {
+ Debug.Log("不包含");
+ }
+ System.Object obj = new object();
+ Debug.Log(obj.GetHashCode());
+ System.Object obj2 = new object();
+ Debug.Log(obj2.GetHashCode());
+ //StructA? bb;
+ Nullable<StructA> bb;
+ bb = null;
+ }
+
void Foo()
{
Debug.Log("Foo()");
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs
index da201a7..6edd5b5 100644
--- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs
@@ -7,7 +7,7 @@ namespace UnityEngine.UI
{
// m_ToRebuildһILayoutGroup
private RectTransform m_ToRebuild;
- //There are a few of reasons we need to cache the Hash fromt he transform:
+ //There are a few of reasons we need to cache the Hash from the transform:
// - This is a ValueType (struct) and .Net calculates Hash from the Value Type fields.
// - The key of a Dictionary should have a constant Hash value.
// - It's possible for the Transform to get nulled from the Native side.
@@ -15,6 +15,7 @@ namespace UnityEngine.UI
// So this struct gets used as a key to a dictionary, so we need to guarantee a constant Hash value.
private int m_CachedHashFromTransform;
+ // һrebuilderṹij
static ObjectPool<LayoutRebuilder> s_Rebuilders = new ObjectPool<LayoutRebuilder>(null, x => x.Clear());
private void Initialize(RectTransform controller)
@@ -141,13 +142,14 @@ namespace UnityEngine.UI
ListPool<Component>.Release(components);
}
+ // ҵrectȽڵеlayoutGroup
public static void MarkLayoutForRebuild(RectTransform rect)
{
if (rect == null)
return;
var comps = ListPool<Component>.Get();
- RectTransform layoutRoot = rect;
+ RectTransform layoutRoot = rect; // ȽڵеlayoutGroup
while (true)
{
var parent = layoutRoot.parent as RectTransform;
@@ -183,7 +185,6 @@ namespace UnityEngine.UI
{
if (layoutRoot == null)
return false;
-
layoutRoot.GetComponents(typeof(ILayoutController), comps);
StripDisabledBehavioursFromList(comps);
var valid = comps.Count > 0;
@@ -197,13 +198,14 @@ namespace UnityEngine.UI
var rebuilder = s_Rebuilders.Get();
rebuilder.Initialize(controller);
- // עȥ
+ // עᵽCanvasUpdateRegistry
if (!CanvasUpdateRegistry.TryRegisterCanvasElementForLayoutRebuild(rebuilder))
s_Rebuilders.Release(rebuilder);
}
public void LayoutComplete()
{
+ // Żس
s_Rebuilders.Release(this);
}