Esempio n. 1
0
        public static void Initialize(bool registerSystem, bool registerUnity, bool registerCustom)
        {
            DebugUtil.Log("Reset Domain");
            ccq2itype.Clear();
            type2itype.Clear();
            str2itype.Clear();

            DebugUtil.Log("Register Base Type");
            //注册基本类型
            RegisterType(new Type_String());
            RegisterType(new Type_Var());
            RegisterType(new Type_Bool());
            RegisterType(new Type_Lambda());
            RegisterType(new Type_Delegate());
            str2itype["null"] = new Type_NULL();

            RegisterType <double>("double");
            RegisterType <float>("float");
            RegisterType <long>("long");
            RegisterType <ulong>("ulong");
            RegisterType <int>("int");
            RegisterType <uint>("uint");
            RegisterType <short>("short");
            RegisterType <ushort>("ushort");
            RegisterType <byte>("byte");
            RegisterType <sbyte>("sbyte");
            RegisterType <char>("char");

            RegisterType <object>("object");
            RegisterType <IEnumerator>("IEnumerator");

            RegisterType(typeof(List <>), "System.Collections.Generic.List");                   //模板类要独立注册
            RegisterType(typeof(Dictionary <,>), "System.Collections.Generic.Dictionary");
            RegisterType(typeof(Stack <>), "System.Collections.Stack");
            RegisterType(typeof(Queue <>), "System.Collections.Queue");

            RegisterType <System.Action> ();


            if (registerSystem)
            {
                RegisterTypes.RegisterSystemTypes();
            }
            if (registerUnity)
            {
                RegisterTypes.RegisterUnityTypes();
            }
            if (registerCustom)
            {
                RegisterTypes.RegisterCustomTypes();
            }
        }
Esempio n. 2
0
        public static void RegisterDefaultType()
        {
            //最好能默认
            RegisterType(new Type_Int());
            RegisterType(new Type_UInt());
            RegisterType(new Type_Float());
            RegisterType(new Type_Double());
            RegisterType(new Type_Byte());
            RegisterType(new Type_Char());
            RegisterType(new Type_UShort());
            RegisterType(new Type_Sbyte());
            RegisterType(new Type_Short());
            RegisterType(new Type_Long());
            RegisterType(new Type_ULong());

            RegisterType(new Type_String());
            RegisterType(new Type_Var());
            RegisterType(new Type_Bool());
            RegisterType(new Type_Lambda());
            RegisterType(new Type_Delegate());
            RegisterType(typeof(IEnumerator), "IEnumerator");

            RegisterType(typeof(object), "object");

            RegisterType(typeof(List <>), "List");       //模板类要独立注册
            RegisterType(typeof(Dictionary <,>), "Dictionary");
            RegisterType(typeof(Stack <>), "Stack");
            RegisterType(typeof(Queue <>), "Queue");

            typess["null"] = new Type_NULL();
            //contentGloabl = CreateContent();
            //if (!useNamespace)//命名空间模式不能直接用函数
            {
                RegisterMethod(new MethodTrace());
            }

            //对于AOT环境,比如IOS,get set不能用RegHelper直接提供,就用AOTExt里面提供的对应类替换
            RegisterType(typeof(int[]), "int[]");       //数组要独立注册
            RegisterType(typeof(string[]), "string[]");
            RegisterType(typeof(float[]), "float[]");
            RegisterType(typeof(bool[]), "bool[]");
            RegisterType(typeof(byte[]), "byte[]");

            AppDomain.RegisterType(typeof(System.DateTime), "DateTime");
            AppDomain.RegisterType(typeof(System.DayOfWeek), "DayOfWeek");
            AppDomain.RegisterType(typeof(System.IO.Directory), "Directory");
            AppDomain.RegisterType(typeof(System.IO.File), "File");
        }