using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace UnityExplorer.Tests { public static class TestClass { public static IEnumerable ANestedList = new List>> { new List> { new List { "one", "two", "one", "two", "one", "two", "one", "two", "one", "two", "one", "two", "one", "two", "one", "two", }, new List { "three", "four", } }, new List> { new List { "five" } } }; public static IDictionary DictTest = new Dictionary { { 1, 2 }, { "one", "two" }, { true, false }, { new Vector3(0,1,2), new Vector3(1,2,3) }, { CameraClearFlags.Depth, CameraClearFlags.Color }, { "################################################\r\n##########", null }, { "subdict", new Dictionary { { "key", "value" } } } }; public const int ConstantInt = 5; public static byte[] ByteArray = new byte[16]; public static string LongString = new string('#', 10000); public static List BigList = new List(10000); public static List RandomList { get { var list = new List(); int count = UnityEngine.Random.Range(0, 100); for (int i = 0; i < count; i++) list.Add(GetRandomObject()); return list; } } private static void TestGeneric() { ExplorerCore.Log("Test1 " + typeof(T).FullName); } private static void TestGenericClass() where T : class { ExplorerCore.Log("Test2 " + typeof(T).FullName); } //private static void TestGenericMultiInterface() where T : IEnumerable, IList, ICollection //{ // ExplorerCore.Log("Test3 " + typeof(T).FullName); //} private static void TestComponent() where T : Component { ExplorerCore.Log("Test3 " + typeof(T).FullName); } private static void TestStruct() where T : struct { ExplorerCore.Log("Test3 " + typeof(T).FullName); } private static object GetRandomObject() { object ret = null; int ran = UnityEngine.Random.Range(0, 7); switch (ran) { case 0: return null; case 1: return 123; case 2: return true; case 3: return "hello"; case 4: return 50.5f; case 5: return UnityEngine.CameraClearFlags.Color; case 6: return new List { "sub list", "lol" }; } return ret; } #if CPP public static string testStringOne = "Test"; public static Il2CppSystem.Object testStringTwo = "string boxed as cpp object"; public static Il2CppSystem.String testStringThree = "string boxed as cpp string"; public static string nullString = null; public static List boxedList; public static Il2CppSystem.Object boxedInt; public static Il2CppSystem.Int32 cppint; public static Il2CppSystem.Collections.Hashtable testHashset; public static Il2CppSystem.Collections.Generic.List testList; //public static Il2CppSystem.Nullable NullableQuaternion; //public static Il2CppSystem.Nullable NullableInt = new Il2CppSystem.Nullable(5); //public static Il2CppSystem.Nullable NullableBool = new Il2CppSystem.Nullable(false); #endif static TestClass() { for (int i = 0; i < BigList.Capacity; i++) BigList.Add(i.ToString()); #if CPP //NullableQuaternion = new Il2CppSystem.Nullable(); //NullableQuaternion.value = Quaternion.identity; boxedInt = new Il2CppSystem.Int32() { m_value = 5 }.BoxIl2CppObject(); boxedList = new List(); boxedList.Add((Il2CppSystem.String)"boxedString"); boxedList.Add(new Il2CppSystem.Int32 { m_value = 5 }.BoxIl2CppObject()); cppint = new Il2CppSystem.Int32 { m_value = 420 }; testHashset = new Il2CppSystem.Collections.Hashtable(); testHashset.Add("key1", "itemOne"); testHashset.Add("key2", "itemTwo"); testHashset.Add("key3", "itemThree"); testList = new Il2CppSystem.Collections.Generic.List(3); testList.Add("One"); testList.Add("Two"); testList.Add("Three"); #endif } } }