コード例 #1
0
ファイル: Init.cs プロジェクト: Hengle/JEngine
    unsafe void InitializeILRuntime()
    {
#if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE)
        //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler
        appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId;
        appdomain.DebugService.StartDebugService(56000);
#endif

        #region 这里添加ILRuntime的注册

        appdomain.RegisterCrossBindingAdaptor(new MonoBehaviourAdapter());
        appdomain.RegisterCrossBindingAdaptor(new CoroutineAdapter());
        appdomain.RegisterCrossBindingAdaptor(new IAsyncStateMachineClassInheritanceAdaptor());
        appdomain.DelegateManager.RegisterFunctionDelegate <System.Text.RegularExpressions.Match, System.String>();
        appdomain.DelegateManager.RegisterMethodDelegate <UnityEngine.GameObject>();
        appdomain.DelegateManager.RegisterFunctionDelegate <System.Boolean>();
        appdomain.DelegateManager.RegisterFunctionDelegate <bool>();
        appdomain.DelegateManager.RegisterMethodDelegate <UnityEngine.GameObject, System.Action>();
        appdomain.DelegateManager.RegisterDelegateConvertor <System.Text.RegularExpressions.MatchEvaluator>((act) =>
        {
            return(new System.Text.RegularExpressions.MatchEvaluator((match) => ((Func <System.Text.RegularExpressions.Match, System.String>)act)(match)));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <Action <JsonData> >((action) =>
        {
            return(new Action <JsonData>((a) =>
            {
                ((System.Action <JsonData>)action)(a);
            }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <UnityEngine.Events.UnityAction>((act) =>
        {
            return(new UnityEngine.Events.UnityAction(async() =>
            {
                ((Action)act)();
            }));
        });

        #endregion

        ILRuntime.Runtime.Generated.CLRBindings.Initialize(appdomain);

        var arr = typeof(GameObject).GetMethods();
        foreach (var i in arr)
        {
            if (i.Name == "AddComponent" && i.GetGenericArguments().Length == 1)
            {
                appdomain.RegisterCLRMethodRedirection(i, AddComponent);
            }
        }
        foreach (var i in arr)
        {
            if (i.Name == "GetComponent" && i.GetGenericArguments().Length == 1)
            {
                appdomain.RegisterCLRMethodRedirection(i, GetComponent);
            }
        }
        LitJson.JsonMapper.RegisterILRuntimeCLRRedirection(appdomain);
    }
コード例 #2
0
    unsafe void SetupCLRRedirection()
    {
        //这里面的通常应该写在InitializeILRuntime,这里为了演示写这里
        var arr = typeof(GameObject).GetMethods();

        foreach (var i in arr)
        {
            if (i.Name == "AddComponent" && i.GetGenericArguments().Length == 1)
            {
                appdomain.RegisterCLRMethodRedirection(i, AddComponent);
            }
        }
    }
コード例 #3
0
ファイル: InitILrt.cs プロジェクト: takalard/JEngine
    public static unsafe void InitializeILRuntime(AppDomain appdomain)
    {
#if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE)
        //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler
        appdomain.UnityMainThreadID = Thread.CurrentThread.ManagedThreadId;
        appdomain.DebugService.StartDebugService(56000);
#endif

        RegisterCrossBindingAdaptorHelper.HelperRegister(appdomain);
        RegisterMethodDelegateHelper.HelperRegister(appdomain);
        RegisterFunctionDelegateHelper.HelperRegister(appdomain);
        RegisterDelegateConvertorHelper.HelperRegister(appdomain);
        RegisterLitJsonHelper.HelperRegister(appdomain);
        RegisterValueTypeBinderHelper.HelperRegister(appdomain);

        //添加MonoBehaviour核心方法
        var arr = typeof(GameObject).GetMethods();
        foreach (var i in arr)
        {
            if (i.Name == "AddComponent" && i.GetGenericArguments().Length == 1)
            {
                appdomain.RegisterCLRMethodRedirection(i, AddComponent);
            }
        }

        foreach (var i in arr)
        {
            if (i.Name == "GetComponent" && i.GetGenericArguments().Length == 1)
            {
                appdomain.RegisterCLRMethodRedirection(i, GetComponent);
            }
        }

        //Protobuf适配
        ProtoBuf.PType.RegisterFunctionCreateInstance(PType_CreateInstance);
        ProtoBuf.PType.RegisterFunctionGetRealType(PType_GetRealType);

        //LitJson适配
        JsonMapper.RegisterILRuntimeCLRRedirection(appdomain);

        //CLR绑定
        CLRBindings.Initialize(appdomain);
    }
コード例 #4
0
 public unsafe static void RegisterILRuntimeCLRRedirection(ILRuntime.Runtime.Enviorment.AppDomain appdomain)
 {
     foreach (var i in typeof(ILSerial).GetMethods())
     {
         if (i.Name == "Read" && i.IsGenericMethodDefinition)
         {
             appdomain.RegisterCLRMethodRedirection(i, BinaryToObject);
         }
     }
 }
コード例 #5
0
ファイル: R_MEntity.cs プロジェクト: GodTaeja/CodePackage
 public static unsafe void Register(AppDomain appDomain)
 {
     foreach (var i in typeof(MEntity).GetMethods(BindingFlags.Public | BindingFlags.Instance))
     {
         if (i.Name == "Add" && i.IsGenericMethodDefinition)
         {
             appDomain.RegisterCLRMethodRedirection(i, Add);
             break;
         }
     }
 }
コード例 #6
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(UnityEngine.GameObject);
            Dictionary <string, List <MethodInfo> > genericMethods = new Dictionary <string, List <MethodInfo> >();
            List <MethodInfo> lst = null;

            foreach (var m in type.GetMethods())
            {
                if (m.IsGenericMethodDefinition)
                {
                    if (!genericMethods.TryGetValue(m.Name, out lst))
                    {
                        lst = new List <MethodInfo>();
                        genericMethods[m.Name] = lst;
                    }
                    lst.Add(m);
                }
            }
            args = new Type[] { typeof(UnityEngine.Animator) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.Animator)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_0);

                        break;
                    }
                }
            }
            args   = new Type[] {};
            method = type.GetMethod("get_transform", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_transform_1);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("SetActive", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetActive_2);
            args = new Type[] { typeof(UnityEngine.EventSystems.EventTrigger) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.EventSystems.EventTrigger)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_3);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.EventSystems.EventTrigger) };
            if (genericMethods.TryGetValue("AddComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.EventSystems.EventTrigger)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AddComponent_4);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(global::ReferenceCollector) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(global::ReferenceCollector)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_5);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.Text) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Text)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_6);

                        break;
                    }
                }
            }
            args   = new Type[] {};
            method = type.GetMethod("get_activeSelf", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_activeSelf_7);
            args = new Type[] { typeof(UnityEngine.UI.Image) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Image)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_8);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.Slider) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Slider)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_9);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.Button) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Button)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_10);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.CanvasConfig) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(ETModel.CanvasConfig)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_11);

                        break;
                    }
                }
            }
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_layer", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_layer_12);
            args = new Type[] { typeof(global::MonoBehaviourAdapter.Adaptor) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(global::MonoBehaviourAdapter.Adaptor)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_13);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.RectTransform) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.RectTransform)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_14);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.GridLayoutGroup) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.GridLayoutGroup)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_15);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.InputField) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.InputField)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_16);

                        break;
                    }
                }
            }
            args   = new Type[] {};
            method = type.GetMethod("get_activeInHierarchy", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_activeInHierarchy_17);
            args = new Type[] { typeof(UnityEngine.UI.HorizontalLayoutGroup) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.HorizontalLayoutGroup)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_18);

                        break;
                    }
                }
            }
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("Find", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Find_19);
            args = new Type[] { typeof(ETModel.ComponentView) };
            if (genericMethods.TryGetValue("AddComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(ETModel.ComponentView)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AddComponent_20);

                        break;
                    }
                }
            }

            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
コード例 #7
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(System.String);

            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("Contains", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Contains_0);
            args   = new Type[] { typeof(System.String), typeof(System.String) };
            method = type.GetMethod("Replace", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Replace_1);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("IndexOf", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IndexOf_2);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("Substring", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Substring_3);
            args   = new Type[] { typeof(System.String), typeof(System.String) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_4);
            args   = new Type[] {};
            method = type.GetMethod("get_Length", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Length_5);
            args   = new Type[] { typeof(System.String[]) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_6);
            args   = new Type[] { typeof(System.String), typeof(System.String) };
            method = type.GetMethod("op_Equality", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Equality_7);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("IsNullOrEmpty", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsNullOrEmpty_8);
            args   = new Type[] { typeof(System.String), typeof(System.String), typeof(System.String) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_9);
            args   = new Type[] { typeof(System.String), typeof(System.Object) };
            method = type.GetMethod("Format", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Format_10);
            args   = new Type[] { typeof(System.String), typeof(System.String), typeof(System.String), typeof(System.String) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_11);

            app.RegisterCLRCreateArrayInstance(type, s => new System.String[s]);
        }
コード例 #8
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(ET.AsyncETVoidMethodBuilder);

            args   = new Type[] {};
            method = type.GetMethod("Create", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Create_0);
            Dictionary <string, List <MethodInfo> > genericMethods = new Dictionary <string, List <MethodInfo> >();
            List <MethodInfo> lst = null;

            foreach (var m in type.GetMethods())
            {
                if (m.IsGenericMethodDefinition)
                {
                    if (!genericMethods.TryGetValue(m.Name, out lst))
                    {
                        lst = new List <MethodInfo>();
                        genericMethods[m.Name] = lst;
                    }
                    lst.Add(m);
                }
            }
            args = new Type[] { typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor) };
            if (genericMethods.TryGetValue("Start", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(void), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, Start_1);

                        break;
                    }
                }
            }
            args   = new Type[] {};
            method = type.GetMethod("get_Task", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Task_2);
            args = new Type[] { typeof(ET.ETTask <System.Boolean>), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor) };
            if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask <System.Boolean>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_3);

                        break;
                    }
                }
            }
            args   = new Type[] { typeof(System.Exception) };
            method = type.GetMethod("SetException", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetException_4);
            args   = new Type[] {};
            method = type.GetMethod("SetResult", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetResult_5);
            args = new Type[] { typeof(ET.ETTask <System.Int32>), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor) };
            if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask <System.Int32>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ET.ETTaskCompleted), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor) };
            if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTaskCompleted).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ET.ETTask <ILRuntime.Runtime.Intepreter.ILTypeInstance>), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor) };
            if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask <ILRuntime.Runtime.Intepreter.ILTypeInstance>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_8);

                        break;
                    }
                }
            }

            app.RegisterCLRCreateDefaultInstance(type, () => new ET.AsyncETVoidMethodBuilder());
        }
コード例 #9
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(UnityEngine.GameObject);

            args   = new Type[] {};
            method = type.GetMethod("get_transform", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_transform_0);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("AddComponent", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AddComponent_1);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("GetComponent", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetComponent_2);
            Dictionary <string, List <MethodInfo> > genericMethods = new Dictionary <string, List <MethodInfo> >();
            List <MethodInfo> lst = null;

            foreach (var m in type.GetMethods())
            {
                if (m.IsGenericMethodDefinition)
                {
                    if (!genericMethods.TryGetValue(m.Name, out lst))
                    {
                        lst = new List <MethodInfo>();
                        genericMethods[m.Name] = lst;
                    }
                    lst.Add(m);
                }
            }
            args = new Type[] { typeof(global::MonoBehaviourAdapter.Adaptor) };
            if (genericMethods.TryGetValue("AddComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(global::MonoBehaviourAdapter.Adaptor)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AddComponent_3);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(global::MonoBehaviourAdapter.Adaptor) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(global::MonoBehaviourAdapter.Adaptor)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_4);

                        break;
                    }
                }
            }

            args   = new Type[] { typeof(System.String) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_1);
        }
コード例 #10
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            MethodBase method;

            Type[] args;
            Type   type = typeof(ETModel.Entity);
            Dictionary <string, List <MethodInfo> > genericMethods = new Dictionary <string, List <MethodInfo> >();
            List <MethodInfo> lst = null;

            foreach (var m in type.GetMethods())
            {
                if (m.IsGenericMethodDefinition)
                {
                    if (!genericMethods.TryGetValue(m.Name, out lst))
                    {
                        lst = new List <MethodInfo>();
                        genericMethods[m.Name] = lst;
                    }
                    lst.Add(m);
                }
            }
            args = new Type[] { typeof(ETModel.ResourcesComponent) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_0);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.SessionComponent) };
            if (genericMethods.TryGetValue("RemoveComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, RemoveComponent_1);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.ClientComponent) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_2);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.NetOuterComponent) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_3);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.SessionCallbackComponent) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_4);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.SessionComponent) };
            if (genericMethods.TryGetValue("AddComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AddComponent_5);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.UnitComponent) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_6);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.UnitPathComponent) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_7);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.MessageDispatherComponent) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_8);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.OpcodeTypeComponent) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_9);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.SessionCallbackComponent) };
            if (genericMethods.TryGetValue("AddComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AddComponent_10);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.SceneChangeComponent) };
            if (genericMethods.TryGetValue("AddComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AddComponent_11);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(ETModel.PlayerComponent) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 0)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_12);

                        break;
                    }
                }
            }
        }
コード例 #11
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(UnityEngine.Transform);

            args   = new Type[] { typeof(UnityEngine.Vector3) };
            method = type.GetMethod("set_position", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_position_0);
            args   = new Type[] { typeof(UnityEngine.Quaternion) };
            method = type.GetMethod("set_rotation", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_rotation_1);
            args   = new Type[] {};
            method = type.GetMethod("get_position", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_position_2);
            args   = new Type[] {};
            method = type.GetMethod("get_forward", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_forward_3);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Space) };
            method = type.GetMethod("Translate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Translate_4);
            args   = new Type[] {};
            method = type.GetMethod("get_rotation", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_rotation_5);
            args   = new Type[] { typeof(UnityEngine.Vector3) };
            method = type.GetMethod("set_localPosition", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_localPosition_6);
            args   = new Type[] { typeof(UnityEngine.Quaternion) };
            method = type.GetMethod("set_localRotation", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_localRotation_7);
            args   = new Type[] {};
            method = type.GetMethod("get_parent", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_parent_8);
            args   = new Type[] { typeof(UnityEngine.Transform) };
            method = type.GetMethod("set_parent", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_parent_9);
            args   = new Type[] { typeof(UnityEngine.Transform), typeof(System.Boolean) };
            method = type.GetMethod("SetParent", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetParent_10);
            args   = new Type[] { typeof(UnityEngine.Vector3) };
            method = type.GetMethod("set_localScale", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_localScale_11);
            args   = new Type[] {};
            method = type.GetMethod("get_localScale", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_localScale_12);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("GetChild", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetChild_13);
            args   = new Type[] {};
            method = type.GetMethod("get_childCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_childCount_14);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(System.Single) };
            method = type.GetMethod("Rotate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Rotate_15);
        }
コード例 #12
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(System.Type);

            args   = new Type[] { typeof(System.RuntimeTypeHandle) };
            method = type.GetMethod("GetTypeFromHandle", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetTypeFromHandle_0);
            args   = new Type[] {};
            method = type.GetMethod("get_Assembly", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Assembly_1);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("IsSubclassOf", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsSubclassOf_2);
            args   = new Type[] {};
            method = type.GetMethod("get_FullName", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_FullName_3);
            args   = new Type[] { typeof(System.Type), typeof(System.Type) };
            method = type.GetMethod("op_Inequality", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Inequality_4);
            args   = new Type[] {};
            method = type.GetMethod("get_BaseType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_BaseType_5);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("GetProperty", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetProperty_6);
            args   = new Type[] {};
            method = type.GetMethod("get_IsClass", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_IsClass_7);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("GetInterface", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetInterface_8);
            args   = new Type[] {};
            method = type.GetMethod("GetFields", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetFields_9);
            args   = new Type[] { typeof(System.Type), typeof(System.Type) };
            method = type.GetMethod("op_Equality", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Equality_10);
            args   = new Type[] { typeof(System.Reflection.BindingFlags) };
            method = type.GetMethod("GetFields", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetFields_11);
            args   = new Type[] { typeof(System.Reflection.BindingFlags) };
            method = type.GetMethod("GetProperties", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetProperties_12);
            args   = new Type[] {};
            method = type.GetMethod("get_IsValueType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_IsValueType_13);
            args   = new Type[] {};
            method = type.GetMethod("get_Namespace", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Namespace_14);
            args   = new Type[] { typeof(System.Reflection.BindingFlags) };
            method = type.GetMethod("GetMethods", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetMethods_15);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("GetMethod", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetMethod_16);
        }
コード例 #13
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

            Type[] args;
            Type   type = typeof(System.Int32);

            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("CompareTo", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CompareTo_0);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("CompareTo", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CompareTo_1);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("Equals", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Equals_2);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("Equals", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Equals_3);
            args   = new Type[] {};
            method = type.GetMethod("GetHashCode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetHashCode_4);
            args   = new Type[] {};
            method = type.GetMethod("ToString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToString_5);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("ToString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToString_6);
            args   = new Type[] { typeof(System.IFormatProvider) };
            method = type.GetMethod("ToString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToString_7);
            args   = new Type[] { typeof(System.String), typeof(System.IFormatProvider) };
            method = type.GetMethod("ToString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToString_8);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("Parse", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Parse_9);
            args   = new Type[] { typeof(System.String), typeof(System.Globalization.NumberStyles) };
            method = type.GetMethod("Parse", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Parse_10);
            args   = new Type[] { typeof(System.String), typeof(System.IFormatProvider) };
            method = type.GetMethod("Parse", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Parse_11);
            args   = new Type[] { typeof(System.String), typeof(System.Globalization.NumberStyles), typeof(System.IFormatProvider) };
            method = type.GetMethod("Parse", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Parse_12);
            args   = new Type[] { typeof(System.String), typeof(System.Int32).MakeByRefType() };
            method = type.GetMethod("TryParse", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, TryParse_13);
            args   = new Type[] { typeof(System.String), typeof(System.Globalization.NumberStyles), typeof(System.IFormatProvider), typeof(System.Int32).MakeByRefType() };
            method = type.GetMethod("TryParse", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, TryParse_14);
            args   = new Type[] {};
            method = type.GetMethod("GetTypeCode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetTypeCode_15);

            field = type.GetField("MaxValue", flag);
            app.RegisterCLRFieldGetter(field, get_MaxValue_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_MaxValue_0, null);
            field = type.GetField("MinValue", flag);
            app.RegisterCLRFieldGetter(field, get_MinValue_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_MinValue_1, null);


            app.RegisterCLRCreateArrayInstance(type, s => new System.Int32[s]);
        }
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(ILRuntimeTest.TestBase.StaticGenericMethods);

            args   = new Type[] { typeof(System.Action) };
            method = type.GetMethod("StaticMethod", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StaticMethod_0);
            args   = new Type[] { typeof(System.Action <ILRuntimeTest.TestBase.ExtensionClass>) };
            method = type.GetMethod("StaticMethod", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StaticMethod_1);
            Dictionary <string, List <MethodInfo> > genericMethods = new Dictionary <string, List <MethodInfo> >();
            List <MethodInfo> lst = null;

            foreach (var m in type.GetMethods())
            {
                if (m.IsGenericMethodDefinition)
                {
                    if (!genericMethods.TryGetValue(m.Name, out lst))
                    {
                        lst = new List <MethodInfo>();
                        genericMethods[m.Name] = lst;
                    }
                    lst.Add(m);
                }
            }
            args = new Type[] { typeof(System.Int32) };
            if (genericMethods.TryGetValue("StaticMethod", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(void), typeof(System.Func <System.Int32>)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, StaticMethod_2);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(System.Int32) };
            if (genericMethods.TryGetValue("StaticMethod", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(void), typeof(System.Func <ILRuntimeTest.TestBase.ExtensionClass, System.Int32>)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, StaticMethod_3);

                        break;
                    }
                }
            }
            args   = new Type[] { typeof(System.Func <System.Threading.Tasks.Task>) };
            method = type.GetMethod("StaticMethod", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StaticMethod_4);
            args   = new Type[] { typeof(System.Func <ILRuntimeTest.TestBase.ExtensionClass, System.Threading.Tasks.Task>) };
            method = type.GetMethod("StaticMethod", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StaticMethod_5);
            args = new Type[] { typeof(System.Int32) };
            if (genericMethods.TryGetValue("StaticMethod", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(void), typeof(System.Func <System.Threading.Tasks.Task <System.Int32> >)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, StaticMethod_6);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(System.Int32) };
            if (genericMethods.TryGetValue("StaticMethod", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(void), typeof(System.Func <ILRuntimeTest.TestBase.ExtensionClass, System.Threading.Tasks.Task <System.Int32> >)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, StaticMethod_7);

                        break;
                    }
                }
            }
            args   = new Type[] { typeof(System.String), typeof(System.Collections.Generic.KeyValuePair <System.String, System.String[]>[]) };
            method = type.GetMethod("Method", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Method_8);
        }
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(System.Collections.Generic.Dictionary <System.Int32, ILRuntime.Runtime.Intepreter.ILTypeInstance>);

            args   = new Type[] {};
            method = type.GetMethod("Clear", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Clear_0);
            args   = new Type[] { typeof(System.Int32), typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance) };
            method = type.GetMethod("Add", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Add_1);
            args   = new Type[] { typeof(System.Int32), typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance).MakeByRefType() };
            method = type.GetMethod("TryGetValue", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, TryGetValue_2);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("Remove", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Remove_3);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("ContainsKey", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ContainsKey_4);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("get_Item", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Item_5);
            args   = new Type[] { typeof(System.Int32), typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance) };
            method = type.GetMethod("set_Item", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_Item_6);
            args   = new Type[] {};
            method = type.GetMethod("GetEnumerator", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetEnumerator_7);
            args   = new Type[] {};
            method = type.GetMethod("get_Count", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Count_8);
            args   = new Type[] {};
            method = type.GetMethod("get_Keys", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Keys_9);
            args   = new Type[] {};
            method = type.GetMethod("get_Values", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Values_10);

            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodInfo   method;

            Type[] args;
            Type   type = typeof(System.Collections.Generic.Dictionary <ILRuntime.Runtime.Intepreter.ILTypeInstance, System.Int32>);

            args   = new Type[] {};
            method = type.GetMethod("get_Comparer", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Comparer_0);
            args   = new Type[] {};
            method = type.GetMethod("get_Count", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Count_1);
            args   = new Type[] {};
            method = type.GetMethod("get_Keys", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Keys_2);
            args   = new Type[] {};
            method = type.GetMethod("get_Values", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Values_3);
            args   = new Type[] { typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance) };
            method = type.GetMethod("get_Item", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Item_4);
            args   = new Type[] { typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance), typeof(System.Int32) };
            method = type.GetMethod("set_Item", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_Item_5);
            args   = new Type[] { typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance), typeof(System.Int32) };
            method = type.GetMethod("Add", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Add_6);
            args   = new Type[] {};
            method = type.GetMethod("Clear", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Clear_7);
            args   = new Type[] { typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance) };
            method = type.GetMethod("ContainsKey", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ContainsKey_8);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("ContainsValue", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ContainsValue_9);
            args   = new Type[] {};
            method = type.GetMethod("GetEnumerator", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetEnumerator_10);
            args   = new Type[] { typeof(System.Runtime.Serialization.SerializationInfo), typeof(System.Runtime.Serialization.StreamingContext) };
            method = type.GetMethod("GetObjectData", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetObjectData_11);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("OnDeserialization", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, OnDeserialization_12);
            args   = new Type[] { typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance) };
            method = type.GetMethod("Remove", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Remove_13);
            args   = new Type[] { typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance), typeof(System.Int32).MakeByRefType() };
            method = type.GetMethod("TryGetValue", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, TryGetValue_14);
        }
コード例 #17
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

            Type[] args;
            Type   type = typeof(FairyGUI.NTexture);

            args   = new Type[] {};
            method = type.GetMethod("get_Empty", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Empty_0);
            args   = new Type[] {};
            method = type.GetMethod("DisposeEmpty", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DisposeEmpty_1);
            args   = new Type[] {};
            method = type.GetMethod("get_width", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_width_2);
            args   = new Type[] {};
            method = type.GetMethod("get_height", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_height_3);
            args   = new Type[] {};
            method = type.GetMethod("get_offset", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_offset_4);
            args   = new Type[] {};
            method = type.GetMethod("get_originalSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_originalSize_5);
            args   = new Type[] { typeof(UnityEngine.Rect) };
            method = type.GetMethod("GetDrawRect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetDrawRect_6);
            args   = new Type[] { typeof(UnityEngine.Vector2[]) };
            method = type.GetMethod("GetUV", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetUV_7);
            args   = new Type[] {};
            method = type.GetMethod("get_root", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_root_8);
            args   = new Type[] {};
            method = type.GetMethod("get_disposed", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_disposed_9);
            args   = new Type[] {};
            method = type.GetMethod("get_nativeTexture", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_nativeTexture_10);
            args   = new Type[] {};
            method = type.GetMethod("get_alphaTexture", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_alphaTexture_11);
            args   = new Type[] { typeof(System.String), typeof(System.String[]) };
            method = type.GetMethod("GetMaterialManager", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetMaterialManager_12);
            args   = new Type[] { typeof(FairyGUI.MaterialManager) };
            method = type.GetMethod("DestroyMaterialManager", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DestroyMaterialManager_13);
            args   = new Type[] {};
            method = type.GetMethod("Unload", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Unload_14);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("Unload", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Unload_15);
            args   = new Type[] { typeof(UnityEngine.Texture), typeof(UnityEngine.Texture) };
            method = type.GetMethod("Reload", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Reload_16);
            args   = new Type[] {};
            method = type.GetMethod("Dispose", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Dispose_17);

            field = type.GetField("uvRect", flag);
            app.RegisterCLRFieldGetter(field, get_uvRect_0);
            app.RegisterCLRFieldSetter(field, set_uvRect_0);
            field = type.GetField("rotated", flag);
            app.RegisterCLRFieldGetter(field, get_rotated_1);
            app.RegisterCLRFieldSetter(field, set_rotated_1);
            field = type.GetField("refCount", flag);
            app.RegisterCLRFieldGetter(field, get_refCount_2);
            app.RegisterCLRFieldSetter(field, set_refCount_2);
            field = type.GetField("lastActive", flag);
            app.RegisterCLRFieldGetter(field, get_lastActive_3);
            app.RegisterCLRFieldSetter(field, set_lastActive_3);
            field = type.GetField("destroyMethod", flag);
            app.RegisterCLRFieldGetter(field, get_destroyMethod_4);
            app.RegisterCLRFieldSetter(field, set_destroyMethod_4);


            app.RegisterCLRCreateArrayInstance(type, s => new FairyGUI.NTexture[s]);

            args   = new Type[] { typeof(UnityEngine.Texture) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
            args   = new Type[] { typeof(UnityEngine.Texture), typeof(UnityEngine.Texture), typeof(System.Single), typeof(System.Single) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_1);
            args   = new Type[] { typeof(UnityEngine.Texture), typeof(UnityEngine.Rect) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_2);
            args   = new Type[] { typeof(FairyGUI.NTexture), typeof(UnityEngine.Rect), typeof(System.Boolean) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_3);
            args   = new Type[] { typeof(FairyGUI.NTexture), typeof(UnityEngine.Rect), typeof(System.Boolean), typeof(UnityEngine.Vector2), typeof(UnityEngine.Vector2) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_4);
            args   = new Type[] { typeof(UnityEngine.Sprite) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_5);
        }
コード例 #18
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(System.Enum);

            args   = new Type[] {};
            method = type.GetMethod("GetTypeCode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetTypeCode_0);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("GetValues", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetValues_1);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("GetNames", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetNames_2);
            args   = new Type[] { typeof(System.Type), typeof(System.Object) };
            method = type.GetMethod("GetName", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetName_3);
            args   = new Type[] { typeof(System.Type), typeof(System.Object) };
            method = type.GetMethod("IsDefined", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsDefined_4);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("GetUnderlyingType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetUnderlyingType_5);
            args   = new Type[] { typeof(System.Type), typeof(System.String) };
            method = type.GetMethod("Parse", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Parse_6);
            args   = new Type[] { typeof(System.Type), typeof(System.String), typeof(System.Boolean) };
            method = type.GetMethod("Parse", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Parse_7);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("CompareTo", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CompareTo_8);
            args   = new Type[] {};
            method = type.GetMethod("ToString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToString_9);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("ToString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToString_10);
            args   = new Type[] { typeof(System.Type), typeof(System.Byte) };
            method = type.GetMethod("ToObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToObject_11);
            args   = new Type[] { typeof(System.Type), typeof(System.Int16) };
            method = type.GetMethod("ToObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToObject_12);
            args   = new Type[] { typeof(System.Type), typeof(System.Int32) };
            method = type.GetMethod("ToObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToObject_13);
            args   = new Type[] { typeof(System.Type), typeof(System.Int64) };
            method = type.GetMethod("ToObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToObject_14);
            args   = new Type[] { typeof(System.Type), typeof(System.Object) };
            method = type.GetMethod("ToObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToObject_15);
            args   = new Type[] { typeof(System.Type), typeof(System.SByte) };
            method = type.GetMethod("ToObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToObject_16);
            args   = new Type[] { typeof(System.Type), typeof(System.UInt16) };
            method = type.GetMethod("ToObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToObject_17);
            args   = new Type[] { typeof(System.Type), typeof(System.UInt32) };
            method = type.GetMethod("ToObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToObject_18);
            args   = new Type[] { typeof(System.Type), typeof(System.UInt64) };
            method = type.GetMethod("ToObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToObject_19);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("Equals", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Equals_20);
            args   = new Type[] {};
            method = type.GetMethod("GetHashCode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetHashCode_21);
            args   = new Type[] { typeof(System.Type), typeof(System.Object), typeof(System.String) };
            method = type.GetMethod("Format", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Format_22);



            app.RegisterCLRCreateArrayInstance(type, s => new System.Enum[s]);
        }
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

            Type[] args;
            Type   type = typeof(System.Runtime.CompilerServices.AsyncVoidMethodBuilder);

            args   = new Type[] {};
            method = type.GetMethod("Create", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Create_0);
            Dictionary <string, List <MethodInfo> > genericMethods = new Dictionary <string, List <MethodInfo> >();
            List <MethodInfo> lst = null;

            foreach (var m in type.GetMethods())
            {
                if (m.IsGenericMethodDefinition)
                {
                    if (!genericMethods.TryGetValue(m.Name, out lst))
                    {
                        lst = new List <MethodInfo>();
                        genericMethods[m.Name] = lst;
                    }
                    lst.Add(m);
                }
            }
            args = new Type[] { typeof(Model.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor) };
            if (genericMethods.TryGetValue("Start", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 1)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, Start_1);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(System.Runtime.CompilerServices.TaskAwaiter <ILRuntime.Runtime.Intepreter.ILTypeInstance>), typeof(Model.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor) };
            if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 2)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_2);

                        break;
                    }
                }
            }
            args   = new Type[] { typeof(System.Exception) };
            method = type.GetMethod("SetException", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetException_3);
            args   = new Type[] {};
            method = type.GetMethod("SetResult", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetResult_4);
            args   = new Type[] { typeof(System.Runtime.CompilerServices.IAsyncStateMachine) };
            method = type.GetMethod("SetStateMachine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetStateMachine_5);
            args = new Type[] { typeof(System.Runtime.CompilerServices.TaskAwaiter <Model.IResponse>), typeof(Model.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor) };
            if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.GetParameters().Length == 2)
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6);

                        break;
                    }
                }
            }

            app.RegisterCLRCreateDefaultInstance(type, () => new System.Runtime.CompilerServices.AsyncVoidMethodBuilder());
        }
コード例 #20
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(UnityEngine.GameObject);
            Dictionary <string, List <MethodInfo> > genericMethods = new Dictionary <string, List <MethodInfo> >();
            List <MethodInfo> lst = null;

            foreach (var m in type.GetMethods())
            {
                if (m.IsGenericMethodDefinition)
                {
                    if (!genericMethods.TryGetValue(m.Name, out lst))
                    {
                        lst = new List <MethodInfo>();
                        genericMethods[m.Name] = lst;
                    }
                    lst.Add(m);
                }
            }
            args = new Type[] { typeof(UnityEngine.Animator) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.Animator)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_0);

                        break;
                    }
                }
            }
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("SetActive", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetActive_1);
            args = new Type[] { typeof(UnityEngine.UI.Button) };
            if (genericMethods.TryGetValue("AddComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Button)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AddComponent_2);

                        break;
                    }
                }
            }
            args   = new Type[] {};
            method = type.GetMethod("get_activeInHierarchy", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_activeInHierarchy_3);
            args = new Type[] { typeof(global::MonoBehaviourAdapter.Adaptor) };
            if (genericMethods.TryGetValue("AddComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(global::MonoBehaviourAdapter.Adaptor)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AddComponent_4);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.Text) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Text)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_5);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.AudioSource) };
            if (genericMethods.TryGetValue("GetComponentsInChildren", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.AudioSource[]), typeof(System.Boolean)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponentsInChildren_6);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.Graphic) };
            if (genericMethods.TryGetValue("GetComponentsInChildren", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Graphic[]), typeof(System.Boolean)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponentsInChildren_7);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(global::MonoBehaviourAdapter.Adaptor) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(global::MonoBehaviourAdapter.Adaptor)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_8);

                        break;
                    }
                }
            }
            args   = new Type[] {};
            method = type.GetMethod("get_transform", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_transform_9);
            args   = new Type[] { typeof(System.String), typeof(System.Object) };
            method = type.GetMethod("SendMessage", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SendMessage_10);
            args = new Type[] { typeof(UnityEngine.AudioSource) };
            if (genericMethods.TryGetValue("AddComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.AudioSource)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, AddComponent_11);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.Graphic) };
            if (genericMethods.TryGetValue("GetComponentsInChildren", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Graphic[])))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponentsInChildren_12);

                        break;
                    }
                }
            }

            args   = new Type[] { typeof(System.String) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
コード例 #21
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(UnityEngine.Object);

            args   = new Type[] { typeof(UnityEngine.Object), typeof(System.Single) };
            method = type.GetMethod("Destroy", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Destroy_0);
            args   = new Type[] { typeof(UnityEngine.Object) };
            method = type.GetMethod("Destroy", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Destroy_1);
            args   = new Type[] { typeof(UnityEngine.Object), typeof(System.Boolean) };
            method = type.GetMethod("DestroyImmediate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DestroyImmediate_2);
            args   = new Type[] { typeof(UnityEngine.Object) };
            method = type.GetMethod("DestroyImmediate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DestroyImmediate_3);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("FindObjectsOfType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, FindObjectsOfType_4);
            args   = new Type[] {};
            method = type.GetMethod("get_name", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_name_5);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("set_name", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_name_6);
            args   = new Type[] { typeof(UnityEngine.Object) };
            method = type.GetMethod("DontDestroyOnLoad", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DontDestroyOnLoad_7);
            args   = new Type[] {};
            method = type.GetMethod("get_hideFlags", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_hideFlags_8);
            args   = new Type[] { typeof(UnityEngine.HideFlags) };
            method = type.GetMethod("set_hideFlags", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_hideFlags_9);
            args   = new Type[] { typeof(UnityEngine.Object), typeof(System.Single) };
            method = type.GetMethod("DestroyObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DestroyObject_10);
            args   = new Type[] { typeof(UnityEngine.Object) };
            method = type.GetMethod("DestroyObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DestroyObject_11);
            args   = new Type[] {};
            method = type.GetMethod("ToString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToString_12);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("Equals", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Equals_13);
            args   = new Type[] {};
            method = type.GetMethod("GetHashCode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetHashCode_14);
            args   = new Type[] {};
            method = type.GetMethod("GetInstanceID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetInstanceID_15);
            args   = new Type[] { typeof(UnityEngine.Object), typeof(UnityEngine.Vector3), typeof(UnityEngine.Quaternion) };
            method = type.GetMethod("Instantiate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Instantiate_16);
            args   = new Type[] { typeof(UnityEngine.Object) };
            method = type.GetMethod("Instantiate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Instantiate_17);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("FindObjectOfType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, FindObjectOfType_18);
            args   = new Type[] { typeof(UnityEngine.Object) };
            method = type.GetMethod("op_Implicit", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Implicit_19);
            args   = new Type[] { typeof(UnityEngine.Object), typeof(UnityEngine.Object) };
            method = type.GetMethod("op_Equality", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Equality_20);
            args   = new Type[] { typeof(UnityEngine.Object), typeof(UnityEngine.Object) };
            method = type.GetMethod("op_Inequality", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Inequality_21);

            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
コード例 #22
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

            Type[] args;
            Type   type = typeof(wxb.IL.Help);

            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("GetOrCreate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetOrCreate_0);
            args   = new Type[] { typeof(System.Type), typeof(System.String) };
            method = type.GetMethod("GetField", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetField_1);
            args   = new Type[] { typeof(System.Type), typeof(System.String) };
            method = type.GetMethod("GetMethod", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetMethod_2);
            args   = new Type[] { typeof(System.Type), typeof(System.String) };
            method = type.GetMethod("GetProperty", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetProperty_3);
            args   = new Type[] { typeof(System.Type), typeof(System.Object) };
            method = type.GetMethod("CreateInstaince", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CreateInstaince_4);
            args   = new Type[] {};
            method = type.GetMethod("Init", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Init_5);
            args   = new Type[] {};
            method = type.GetMethod("ReleaseAll", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ReleaseAll_6);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("IsBaseType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsBaseType_7);
            args   = new Type[] { typeof(System.Action <System.Type>) };
            method = type.GetMethod("ForEach", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ForEach_8);
            args   = new Type[] { typeof(System.String), typeof(System.Type).MakeByRefType() };
            method = type.GetMethod("TryGetTypeByFullName", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, TryGetTypeByFullName_9);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("GetTypeByFullName", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetTypeByFullName_10);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("GetType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetType_11);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("GetCustomAttributesType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetCustomAttributesType_12);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("GetBaseType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetBaseType_13);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("GetSerializeField", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetSerializeField_14);
            args   = new Type[] { typeof(System.Type), typeof(System.Collections.Generic.List <System.Reflection.FieldInfo>) };
            method = type.GetMethod("GetSerializeField", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetSerializeField_15);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("isListType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, isListType_16);
            args   = new Type[] { typeof(System.Reflection.FieldInfo) };
            method = type.GetMethod("GetElementByList", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetElementByList_17);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("GetElementByList", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetElementByList_18);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("GetSerializeField", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetSerializeField_19);
            args   = new Type[] { typeof(System.Type), typeof(System.Type) };
            method = type.GetMethod("isType", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, isType_20);
            args   = new Type[] { typeof(System.Type) };
            method = type.GetMethod("Create", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Create_21);

            field = type.GetField("EmptyObj", flag);
            app.RegisterCLRFieldGetter(field, get_EmptyObj_0);
            field = type.GetField("OneObj", flag);
            app.RegisterCLRFieldGetter(field, get_OneObj_1);
            field = type.GetField("OneType", flag);
            app.RegisterCLRFieldGetter(field, get_OneType_2);
            field = type.GetField("EmptyType", flag);
            app.RegisterCLRFieldGetter(field, get_EmptyType_3);
            field = type.GetField("on_release_all", flag);
            app.RegisterCLRFieldGetter(field, get_on_release_all_4);
            app.RegisterCLRFieldSetter(field, set_on_release_all_4);
        }
コード例 #23
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(System.String);

            args   = new Type[] { typeof(System.String), typeof(System.Object) };
            method = type.GetMethod("Format", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Format_0);
            args   = new Type[] { typeof(System.String), typeof(System.String) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_1);
            args   = new Type[] { typeof(System.Object), typeof(System.Object) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_2);
            args   = new Type[] { typeof(System.String), typeof(System.Object), typeof(System.Object) };
            method = type.GetMethod("Format", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Format_3);
            args   = new Type[] { typeof(System.String), typeof(System.Object), typeof(System.Object), typeof(System.Object) };
            method = type.GetMethod("Format", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Format_4);
            args   = new Type[] { typeof(System.String), typeof(System.String), typeof(System.String) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_5);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_6);
            args   = new Type[] { typeof(System.Object[]) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_7);
            args   = new Type[] { typeof(System.Object), typeof(System.Object), typeof(System.Object) };
            method = type.GetMethod("Concat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Concat_8);
            args   = new Type[] { typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("Format", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Format_9);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("IsNullOrEmpty", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsNullOrEmpty_10);
            args   = new Type[] { typeof(System.String), typeof(System.String) };
            method = type.GetMethod("op_Equality", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Equality_11);
        }
コード例 #24
0
    public static unsafe void InitializeILRuntime(AppDomain appdomain)
    {
        appDomain = appdomain;

#if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE)
        //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler
        appdomain.UnityMainThreadID = Thread.CurrentThread.ManagedThreadId;
        appdomain.DebugService.StartDebugService(56000);
#endif

        #region 这里添加ILRuntime的注册 HERE TO ADD ILRuntime Registerations

        appdomain.RegisterCrossBindingAdaptor(new MonoBehaviourAdapter());
        appdomain.RegisterCrossBindingAdaptor(new CoroutineAdapter());
        appdomain.RegisterCrossBindingAdaptor(new IAsyncStateMachineClassInheritanceAdaptor());
        appdomain.RegisterCrossBindingAdaptor(new ExceptionAdapter());
        appdomain.RegisterCrossBindingAdaptor(new IExtensibleAdapter());

        appdomain.DelegateManager.RegisterMethodDelegate <libx.AssetRequest>();
        appdomain.DelegateManager.RegisterFunctionDelegate <System.Threading.Tasks.Task <ILRuntime.Runtime.Intepreter.ILTypeInstance> >();
        appdomain.DelegateManager.RegisterMethodDelegate <Object>();
        appdomain.DelegateManager.RegisterMethodDelegate <System.Object>();
        appdomain.DelegateManager
        .RegisterFunctionDelegate <ILTypeInstance, Boolean>();
        appdomain.DelegateManager.RegisterMethodDelegate <List <Object> >();
        appdomain.DelegateManager
        .RegisterMethodDelegate <IDictionary <String, UnityEngine.Object> >();
        appdomain.DelegateManager.RegisterMethodDelegate <Boolean>();
        appdomain.DelegateManager.RegisterMethodDelegate <Single>();
        appdomain.DelegateManager.RegisterMethodDelegate <System.Object, System.UnhandledExceptionEventArgs>();
        appdomain.DelegateManager.RegisterMethodDelegate <System.Boolean>();
        appdomain.DelegateManager.RegisterMethodDelegate <Boolean, GameObject>();
        appdomain.DelegateManager.RegisterMethodDelegate <Int32, Int32>();
        appdomain.DelegateManager.RegisterMethodDelegate <String>();
        appdomain.DelegateManager.RegisterMethodDelegate <ILTypeInstance>();
        appdomain.DelegateManager.RegisterMethodDelegate <GameObject>();
        appdomain.DelegateManager.RegisterMethodDelegate <UIBehaviour, Object>();
        appdomain.DelegateManager.RegisterMethodDelegate <Transform, Object>();
        appdomain.DelegateManager.RegisterMethodDelegate <GameObject>();
        appdomain.DelegateManager.RegisterMethodDelegate <Int32>();
        appdomain.DelegateManager.RegisterMethodDelegate <GameObject, Action>();
        appdomain.DelegateManager.RegisterFunctionDelegate <Object, Boolean>();
        appdomain.DelegateManager.RegisterFunctionDelegate <Boolean>();
        appdomain.DelegateManager.RegisterFunctionDelegate <float>();
        appdomain.DelegateManager.RegisterFunctionDelegate <System.Threading.Tasks.Task>();

        appdomain.DelegateManager.RegisterDelegateConvertor <UnityEngine.Events.UnityAction <System.String> >((act) =>
        {
            return(new UnityEngine.Events.UnityAction <System.String>((arg0) =>
            {
                ((Action <System.String>)act)(arg0);
            }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <UnityEngine.Events.UnityAction <System.Boolean> >((act) =>
        {
            return(new UnityEngine.Events.UnityAction <System.Boolean>((arg0) =>
            {
                ((Action <System.Boolean>)act)(arg0);
            }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <System.Threading.WaitCallback>((act) =>
        {
            return(new System.Threading.WaitCallback((state) =>
            {
                ((Action <System.Object>)act)(state);
            }));
        });

        appdomain.DelegateManager.RegisterDelegateConvertor <UnityAction>(act =>
        {
            return(new UnityAction(() => { ((Action)act)(); }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <UnityAction <Single> >(act =>
        {
            return(new UnityAction <Single>(arg0 =>
            {
                ((Action <Single>)act)(arg0);
            }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <System.UnhandledExceptionEventHandler>((act) =>
        {
            return(new System.UnhandledExceptionEventHandler((sender, e) =>
            {
                ((Action <System.Object, System.UnhandledExceptionEventArgs>)act)(sender, e);
            }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <Predicate <Object> >(act =>
        {
            return(new Predicate <Object>(obj =>
            {
                return ((Func <Object, Boolean>)act)(obj);
            }));
        });
        appdomain.DelegateManager
        .RegisterDelegateConvertor <Predicate <ILTypeInstance> >(act =>
        {
            return(new Predicate <ILTypeInstance>(obj =>
            {
                return ((Func <ILTypeInstance, Boolean>)act)(obj);
            }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <UnityAction <Int32> >(act =>
        {
            return(new UnityAction <Int32>(arg0 =>
            {
                ((Action <Int32>)act)(arg0);
            }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <Action <JsonData> >(action =>
        {
            return(new Action <JsonData>(a => { ((Action <JsonData>)action)(a); }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <UnityAction>(act =>
        {
            return(new UnityAction(async() => { ((Action)act)(); }));
        });
        appdomain.DelegateManager.RegisterDelegateConvertor <ThreadStart>(act =>
        {
            return(new ThreadStart(() => { ((Action)act)(); }));
        });


        //添加MonoBehaviour核心方法
        var arr = typeof(GameObject).GetMethods();
        foreach (var i in arr)
        {
            if (i.Name == "AddComponent" && i.GetGenericArguments().Length == 1)
            {
                appdomain.RegisterCLRMethodRedirection(i, AddComponent);
            }
        }

        foreach (var i in arr)
        {
            if (i.Name == "GetComponent" && i.GetGenericArguments().Length == 1)
            {
                appdomain.RegisterCLRMethodRedirection(i, GetComponent);
            }
        }
        ProtoBuf.PType.RegisterFunctionCreateInstance(PType_CreateInstance);
        ProtoBuf.PType.RegisterFunctionGetRealType(PType_GetRealType);
        JsonMapper.RegisterILRuntimeCLRRedirection(appdomain); //绑定LitJson
        CLRBindings.Initialize(appdomain);                     //CLR绑定

        #endregion
    }
コード例 #25
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(UnityEngine.Component);
            Dictionary <string, List <MethodInfo> > genericMethods = new Dictionary <string, List <MethodInfo> >();
            List <MethodInfo> lst = null;

            foreach (var m in type.GetMethods())
            {
                if (m.IsGenericMethodDefinition)
                {
                    if (!genericMethods.TryGetValue(m.Name, out lst))
                    {
                        lst = new List <MethodInfo>();
                        genericMethods[m.Name] = lst;
                    }
                    lst.Add(m);
                }
            }
            args = new Type[] { typeof(QFramework.ILComponentBehaviour) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(QFramework.ILComponentBehaviour)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_0);

                        break;
                    }
                }
            }
            args   = new Type[] {};
            method = type.GetMethod("get_transform", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_transform_1);
            args   = new Type[] {};
            method = type.GetMethod("get_gameObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_gameObject_2);
            args   = new Type[] {};
            method = type.GetMethod("get_tag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_tag_3);
            args = new Type[] { typeof(UnityEngine.SpriteRenderer) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.SpriteRenderer)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_4);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.Camera) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.Camera)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_5);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.RectTransform) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.RectTransform)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_6);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.Button) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Button)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_7);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.Text) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Text)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_8);

                        break;
                    }
                }
            }
            args = new Type[] { typeof(UnityEngine.UI.Image) };
            if (genericMethods.TryGetValue("GetComponent", out lst))
            {
                foreach (var m in lst)
                {
                    if (m.MatchGenericParameters(args, typeof(UnityEngine.UI.Image)))
                    {
                        method = m.MakeGenericMethod(args);
                        app.RegisterCLRMethodRedirection(method, GetComponent_9);

                        break;
                    }
                }
            }
        }
コード例 #26
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(UnityEngine.Quaternion);

            args   = new Type[] {};
            method = type.GetMethod("get_identity", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_identity_0);
            args   = new Type[] { typeof(UnityEngine.Quaternion), typeof(UnityEngine.Quaternion) };
            method = type.GetMethod("op_Multiply", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Multiply_1);
            args   = new Type[] { typeof(UnityEngine.Quaternion), typeof(UnityEngine.Vector3) };
            method = type.GetMethod("op_Multiply", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Multiply_2);
            args   = new Type[] { typeof(UnityEngine.Quaternion), typeof(UnityEngine.Quaternion) };
            method = type.GetMethod("op_Equality", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Equality_3);
            args   = new Type[] { typeof(UnityEngine.Quaternion), typeof(UnityEngine.Quaternion) };
            method = type.GetMethod("op_Inequality", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, op_Inequality_4);
            args   = new Type[] { typeof(UnityEngine.Quaternion), typeof(UnityEngine.Quaternion) };
            method = type.GetMethod("Dot", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Dot_5);
            args   = new Type[] { typeof(UnityEngine.Quaternion), typeof(UnityEngine.Quaternion) };
            method = type.GetMethod("Angle", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Angle_6);
            args   = new Type[] {};
            method = type.GetMethod("get_eulerAngles", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_eulerAngles_7);
            args   = new Type[] { typeof(UnityEngine.Vector3) };
            method = type.GetMethod("Euler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Euler_8);
            args   = new Type[] { typeof(System.Single), typeof(System.Single), typeof(System.Single) };
            method = type.GetMethod("Euler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Euler_9);

            app.RegisterCLRCreateDefaultInstance(type, () => new UnityEngine.Quaternion());

            args   = new Type[] { typeof(System.Single), typeof(System.Single), typeof(System.Single), typeof(System.Single) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
コード例 #27
0
ファイル: XILRT.cs プロジェクト: yomunsam/TinaX.ILRuntime
 /// <summary>
 /// 注册 CLR重定向
 /// </summary>
 /// <param name="method"></param>
 /// <param name="func"></param>
 /// <returns></returns>
 public IXILRuntime RegisterCLRMethodRedirection(MethodBase method, CLRRedirectionDelegate func)
 {
     m_AppDomain?.RegisterCLRMethodRedirection(method, func);
     return(this);
 }
コード例 #28
0
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

            Type[] args;
            Type   type = typeof(UnityEngine.Time);

            args   = new Type[] {};
            method = type.GetMethod("get_time", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_time_0);
            args   = new Type[] {};
            method = type.GetMethod("get_timeSinceLevelLoad", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_timeSinceLevelLoad_1);
            args   = new Type[] {};
            method = type.GetMethod("get_deltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_deltaTime_2);
            args   = new Type[] {};
            method = type.GetMethod("get_fixedTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_fixedTime_3);
            args   = new Type[] {};
            method = type.GetMethod("get_unscaledTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_unscaledTime_4);
            args   = new Type[] {};
            method = type.GetMethod("get_fixedUnscaledTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_fixedUnscaledTime_5);
            args   = new Type[] {};
            method = type.GetMethod("get_unscaledDeltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_unscaledDeltaTime_6);
            args   = new Type[] {};
            method = type.GetMethod("get_fixedUnscaledDeltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_fixedUnscaledDeltaTime_7);
            args   = new Type[] {};
            method = type.GetMethod("get_fixedDeltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_fixedDeltaTime_8);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_fixedDeltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_fixedDeltaTime_9);
            args   = new Type[] {};
            method = type.GetMethod("get_maximumDeltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_maximumDeltaTime_10);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_maximumDeltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_maximumDeltaTime_11);
            args   = new Type[] {};
            method = type.GetMethod("get_smoothDeltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_smoothDeltaTime_12);
            args   = new Type[] {};
            method = type.GetMethod("get_maximumParticleDeltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_maximumParticleDeltaTime_13);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_maximumParticleDeltaTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_maximumParticleDeltaTime_14);
            args   = new Type[] {};
            method = type.GetMethod("get_timeScale", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_timeScale_15);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_timeScale", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_timeScale_16);
            args   = new Type[] {};
            method = type.GetMethod("get_frameCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_frameCount_17);
            args   = new Type[] {};
            method = type.GetMethod("get_renderedFrameCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_renderedFrameCount_18);
            args   = new Type[] {};
            method = type.GetMethod("get_realtimeSinceStartup", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_realtimeSinceStartup_19);
            args   = new Type[] {};
            method = type.GetMethod("get_captureFramerate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_captureFramerate_20);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_captureFramerate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_captureFramerate_21);
            args   = new Type[] {};
            method = type.GetMethod("get_inFixedTimeStep", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_inFixedTimeStep_22);



            app.RegisterCLRCreateDefaultInstance(type, () => new UnityEngine.Time());
            app.RegisterCLRCreateArrayInstance(type, s => new UnityEngine.Time[s]);

            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

            Type[] args;
            Type   type = typeof(Google.Protobuf.CodedOutputStream);

            args   = new Type[] { typeof(System.Byte) };
            method = type.GetMethod("WriteRawTag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, WriteRawTag_0);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("WriteString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, WriteString_1);
            args   = new Type[] { typeof(System.Byte), typeof(System.Byte) };
            method = type.GetMethod("WriteRawTag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, WriteRawTag_2);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("WriteInt32", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, WriteInt32_3);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("ComputeInt32Size", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ComputeInt32Size_4);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("ComputeStringSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ComputeStringSize_5);
            args   = new Type[] { typeof(System.Int64) };
            method = type.GetMethod("WriteInt64", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, WriteInt64_6);
            args   = new Type[] { typeof(System.Int64) };
            method = type.GetMethod("ComputeInt64Size", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ComputeInt64Size_7);
            args   = new Type[] { typeof(Google.Protobuf.IMessage) };
            method = type.GetMethod("WriteMessage", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, WriteMessage_8);
            args   = new Type[] { typeof(Google.Protobuf.IMessage) };
            method = type.GetMethod("ComputeMessageSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ComputeMessageSize_9);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("WriteBool", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, WriteBool_10);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("WriteEnum", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, WriteEnum_11);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("ComputeEnumSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ComputeEnumSize_12);
        }
コード例 #30
0
    public override void RegisterCLRRedirection(ILRuntime.Runtime.Enviorment.AppDomain appdomain)
    {
        BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
        MethodBase   method;

        Type[] args;
        Type   type = typeof(Vector3);

        args   = new Type[] { typeof(float), typeof(float), typeof(float) };
        method = type.GetConstructor(flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, NewVector3);

        args   = new Type[] { typeof(float), typeof(float) };
        method = type.GetConstructor(flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, NewVector3_2);

        args   = new Type[] { typeof(Vector3), typeof(Vector3) };
        method = type.GetMethod("op_Addition", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Add);

        args   = new Type[] { typeof(Vector3), typeof(Vector3) };
        method = type.GetMethod("op_Subtraction", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Subtraction);

        args   = new Type[] { typeof(Vector3), typeof(float) };
        method = type.GetMethod("op_Multiply", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Multiply);

        args   = new Type[] { typeof(float), typeof(Vector3) };
        method = type.GetMethod("op_Multiply", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Multiply2);

        args   = new Type[] { typeof(Vector3), typeof(float) };
        method = type.GetMethod("op_Division", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Division);

        args   = new Type[] { typeof(Vector3) };
        method = type.GetMethod("op_UnaryNegation", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Negate);

        args   = new Type[] { typeof(Vector3), typeof(Vector3) };
        method = type.GetMethod("op_Equality", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Equality);

        args   = new Type[] { typeof(Vector3), typeof(Vector3) };
        method = type.GetMethod("op_Inequality", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Inequality);

        args   = new Type[] { typeof(Vector3), typeof(Vector3) };
        method = type.GetMethod("Dot", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Dot);

        args   = new Type[] { typeof(Vector3), typeof(Vector3) };
        method = type.GetMethod("Cross", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Cross);

        args   = new Type[] { typeof(Vector3), typeof(Vector3) };
        method = type.GetMethod("Distance", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector3_Distance);

        args   = new Type[] { };
        method = type.GetMethod("get_magnitude", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_Magnitude);

        args   = new Type[] { };
        method = type.GetMethod("get_sqrMagnitude", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_SqrMagnitude);

        args   = new Type[] { };
        method = type.GetMethod("get_normalized", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_Normalized);

        args   = new Type[] { };
        method = type.GetMethod("get_one", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_One);

        args   = new Type[] { };
        method = type.GetMethod("get_zero", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_Zero);

        args   = new Type[] { };
        method = type.GetMethod("get_up", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_Up);

        args   = new Type[] { };
        method = type.GetMethod("get_down", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_Down);

        args   = new Type[] { };
        method = type.GetMethod("get_right", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_Right);

        args   = new Type[] { };
        method = type.GetMethod("get_left", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_Left);

        args   = new Type[] { };
        method = type.GetMethod("get_forward", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Get_Forward);
    }