コード例 #1
0
        static TestClass()
        {
            for (int i = 0; i < BigList.Capacity; i++)
            {
                BigList.Add(i.ToString());
            }

#if CPP
            IL2CPP_Dict = new Il2CppSystem.Collections.Generic.Dictionary <string, string>();
            IL2CPP_Dict.Add("key1", "value1");
            IL2CPP_Dict.Add("key2", "value2");
            IL2CPP_Dict.Add("key3", "value3");

            IL2CPP_HashTable = new Il2CppSystem.Collections.Hashtable();
            IL2CPP_HashTable.Add("key1", "value1");
            IL2CPP_HashTable.Add("key2", "value2");
            IL2CPP_HashTable.Add("key3", "value3");

            var dict2 = new Il2CppSystem.Collections.Generic.Dictionary <string, string>();
            dict2.Add("key1", "value1");
            IL2CPP_IDict = dict2.TryCast <Il2CppSystem.Collections.IDictionary>();

            var list = new Il2CppSystem.Collections.Generic.List <Il2CppSystem.Object>(5);
            list.Add("one");
            list.Add("two");
            IL2CPP_IList = list.TryCast <Il2CppSystem.Collections.IList>();

            IL2CPP_ListString = new Il2CppSystem.Collections.Generic.List <string>();
            IL2CPP_ListString.Add("hello,");
            IL2CPP_ListString.Add("world!");

            IL2CPP_HashSet = new Il2CppSystem.Collections.Generic.HashSet <string>();
            IL2CPP_HashSet.Add("one");
            IL2CPP_HashSet.Add("two");

            CppBoxedDict = new Dictionary <Il2CppSystem.String, Il2CppSystem.Object>();
            CppBoxedDict.Add("1", new Il2CppSystem.Int32 {
                m_value = 1
            }.BoxIl2CppObject());
            CppBoxedDict.Add("2", new Il2CppSystem.Int32 {
                m_value = 2
            }.BoxIl2CppObject());
            CppBoxedDict.Add("3", new Il2CppSystem.Int32 {
                m_value = 3
            }.BoxIl2CppObject());
            CppBoxedDict.Add("4", new Il2CppSystem.Int32 {
                m_value = 4
            }.BoxIl2CppObject());

            cppDecimal      = new Il2CppSystem.Decimal(1f);
            cppDecimalBoxed = new Il2CppSystem.Decimal(1f).BoxIl2CppObject();
            cppVector3Boxed = Vector3.down.BoxIl2CppObject();


            IL2CPP_listOfBoxedObjects = new List <Il2CppSystem.Object>();
            IL2CPP_listOfBoxedObjects.Add((Il2CppSystem.String) "boxedString");
            IL2CPP_listOfBoxedObjects.Add(new Il2CppSystem.Int32 {
                m_value = 5
            }.BoxIl2CppObject());
            IL2CPP_listOfBoxedObjects.Add(Color.red.BoxIl2CppObject());

            try
            {
                var cppType = Il2CppType.Of <CameraClearFlags>();
                if (cppType != null)
                {
                    var boxedEnum = Il2CppSystem.Enum.Parse(cppType, "Color");
                    IL2CPP_listOfBoxedObjects.Add(boxedEnum);
                }

                var structBox = Vector3.one.BoxIl2CppObject();
                IL2CPP_listOfBoxedObjects.Add(structBox);
            }
            catch (Exception ex)
            {
                ExplorerCore.LogWarning($"Test fail: {ex}");
            }

            IL2CPP_structArray    = new UnhollowerBaseLib.Il2CppStructArray <int>(5);
            IL2CPP_structArray[0] = 0;
            IL2CPP_structArray[1] = 1;
            IL2CPP_structArray[2] = 2;
            IL2CPP_structArray[3] = 3;
            IL2CPP_structArray[4] = 4;

            IL2CPP_stringArray    = new UnhollowerBaseLib.Il2CppStringArray(2);
            IL2CPP_stringArray[0] = "hello, ";
            IL2CPP_stringArray[1] = "world!";

            IL2CPP_ReferenceArray    = new UnhollowerBaseLib.Il2CppReferenceArray <Il2CppSystem.Object>(3);
            IL2CPP_ReferenceArray[0] = new Il2CppSystem.Int32 {
                m_value = 5
            }.BoxIl2CppObject();
            IL2CPP_ReferenceArray[1] = null;
            IL2CPP_ReferenceArray[2] = (Il2CppSystem.String) "whats up";

            cppBoxedInt = new Il2CppSystem.Int32()
            {
                m_value = 5
            }.BoxIl2CppObject();
            cppInt = new Il2CppSystem.Int32 {
                m_value = 420
            };

            cppHashset = new Il2CppSystem.Collections.Hashtable();
            cppHashset.Add("key1", "itemOne");
            cppHashset.Add("key2", "itemTwo");
            cppHashset.Add("key3", "itemThree");
#endif
        }
コード例 #2
0
            public UserInfoExtensionsAPIUser(Il2CppSystem.Object jsonObject)
            {
                if (jsonObject == null)
                {
                    return;
                }

                Il2CppSystem.Collections.Generic.Dictionary <string, Il2CppSystem.Object> jsonDictionary = jsonObject.Cast <Il2CppSystem.Collections.Generic.Dictionary <string, Il2CppSystem.Object> >();
                if (jsonDictionary.ContainsKey("id"))
                {
                    Id = jsonDictionary.get_Item("id").ToString();
                }

                if (jsonDictionary.ContainsKey("date_joined"))
                {
                    DateJoined = jsonDictionary.get_Item("date_joined").ToString();
                }
            }