using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; 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; 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(); public event ClickHandler OnClick; 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 a; RectTransform rect = GetComponent(); 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 d = new Dictionary(); 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 bb; bb = null; ITest dual = new Dual(); dual.Test(); } void Foo() { Debug.Log("Foo()"); } }