Ejemplo n.º 1
0
        public static void Init()
        {
            ReleaseAll();
#if USE_HOT
            foreach (var itor in hotMgr.appdomain.LoadedTypes)
            {
                AllTypesByFullName.Add(itor.Key, itor.Value.ReflectionType);
            }

            Reg <int>();
            Reg <uint>();
            Reg <sbyte>();
            Reg <byte>();
            Reg <short>();
            Reg <ushort>();
            Reg <long>();
            Reg <ulong>();
            Reg <string>();
            Reg <float>();
            Reg <double>();
#endif
            var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
            foreach (var assembly in assemblies)
            {
                if (assembly.FullName.StartsWith("Game"))
                {
                    var types = assembly.GetTypes();
                    foreach (var type in types)
                    {
                        if (type.FullName.StartsWith("<"))
                        {
                            continue;
                        }

                        System.Type t = null;
                        if (AllTypesByFullName.TryGetValue(type.FullName, out t))
                        {
#if USE_HOT
                            if (t != type)
                            {
                                if ((t is ILRuntimeWrapperType) && ((ILRuntimeWrapperType)t).RealType == type)
                                {
                                    continue;
                                }

                                wxb.L.LogErrorFormat("error:{0}", type.FullName);
                            }
#endif
                            continue;
                        }
                        AllTypesByFullName.Add(type.FullName, type);
                    }
                }
            }

            BaseTypes.Add(typeof(int));
            BaseTypes.Add(typeof(uint));
            BaseTypes.Add(typeof(sbyte));
            BaseTypes.Add(typeof(byte));
            BaseTypes.Add(typeof(short));
            BaseTypes.Add(typeof(ushort));
            BaseTypes.Add(typeof(long));
            BaseTypes.Add(typeof(ulong));
            BaseTypes.Add(typeof(string));
            BaseTypes.Add(typeof(float));
            BaseTypes.Add(typeof(double));

            AllTypesByFullName.Add("int", typeof(int));
            AllTypesByFullName.Add("uint", typeof(uint));
            AllTypesByFullName.Add("sbyte", typeof(sbyte));
            AllTypesByFullName.Add("byte", typeof(byte));
            AllTypesByFullName.Add("short", typeof(short));
            AllTypesByFullName.Add("ushort", typeof(ushort));
            AllTypesByFullName.Add("long", typeof(long));
            AllTypesByFullName.Add("ulong", typeof(ulong));
            AllTypesByFullName.Add("string", typeof(string));
            AllTypesByFullName.Add("float", typeof(float));
            AllTypesByFullName.Add("double", typeof(double));
        }
Ejemplo n.º 2
0
        public static void Init()
        {
            ReleaseAll();
#if USE_HOT
#if UNITY_EDITOR
            foreach (var itor in DllInitByEditor.appdomain.LoadedTypes)
#else
            foreach (var itor in hotMgr.appdomain.LoadedTypes)
#endif
            {
                string name = itor.Key;
                AllTypesByFullName.Add(name, itor.Value.ReflectionType);
#if USE_HOT
                if (name.IndexOf('/') != -1)
                {
                    AllTypesByFullName.Add(name.Replace('/', '+'), itor.Value.ReflectionType);
                }
#endif
            }

            Reg <int>();
            Reg <uint>();
            Reg <sbyte>();
            Reg <byte>();
            Reg <short>();
            Reg <ushort>();
            Reg <long>();
            Reg <ulong>();
            Reg <string>();
            Reg <float>();
            Reg <double>();
            Reg <char>();
#endif
            var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
            foreach (var assembly in assemblies)
            {
#if UNITY_EDITOR
                string fn = assembly.FullName;
                if (fn.StartsWith("Assembly-CSharp-Editor"))
                {
                    continue;
                }
                if (fn.EndsWith(".Editor.dll"))
                {
                    continue;
                }
#endif
                //if (assembly.FullName.StartsWith("Assembly-CSharp"))
                {
                    var types = assembly.GetTypes();
                    foreach (var type in types)
                    {
                        if (type.FullName.StartsWith("<"))
                        {
                            continue;
                        }

                        System.Type t = null;
                        if (AllTypesByFullName.TryGetValue(type.FullName, out t))
                        {
//#if USE_HOT
//                            if (t != type)
//                            {
//                                if ((t is ILRuntimeWrapperType) && ((ILRuntimeWrapperType)t).RealType == type)
//                                    continue;

//                                wxb.L.LogErrorFormat("error:{0}", type.FullName);
//                            }
//#endif
                            continue;
                        }
                        AllTypesByFullName.Add(type.FullName, type);
                    }
                }
            }

            BaseTypes.Add(typeof(int));
            BaseTypes.Add(typeof(uint));
            BaseTypes.Add(typeof(sbyte));
            BaseTypes.Add(typeof(byte));
            BaseTypes.Add(typeof(short));
            BaseTypes.Add(typeof(ushort));
            BaseTypes.Add(typeof(long));
            BaseTypes.Add(typeof(ulong));
            BaseTypes.Add(typeof(string));
            BaseTypes.Add(typeof(float));
            BaseTypes.Add(typeof(double));
            BaseTypes.Add(typeof(bool));
            BaseTypes.Add(typeof(char));

            AllTypesByFullName.Add("int", typeof(int));
            AllTypesByFullName.Add("uint", typeof(uint));
            AllTypesByFullName.Add("sbyte", typeof(sbyte));
            AllTypesByFullName.Add("byte", typeof(byte));
            AllTypesByFullName.Add("short", typeof(short));
            AllTypesByFullName.Add("ushort", typeof(ushort));
            AllTypesByFullName.Add("long", typeof(long));
            AllTypesByFullName.Add("ulong", typeof(ulong));
            AllTypesByFullName.Add("string", typeof(string));
            AllTypesByFullName.Add("float", typeof(float));
            AllTypesByFullName.Add("double", typeof(double));
            AllTypesByFullName.Add("bool", typeof(bool));
            AllTypesByFullName.Add("char", typeof(char));
        }