public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

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

            args   = new Type[] { typeof(System.String), typeof(System.Single) };
            method = type.GetMethod("Invoke", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Invoke_0);
            args   = new Type[] { typeof(System.String), typeof(System.Single), typeof(System.Single) };
            method = type.GetMethod("InvokeRepeating", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, InvokeRepeating_1);
            args   = new Type[] {};
            method = type.GetMethod("CancelInvoke", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CancelInvoke_2);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("CancelInvoke", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CancelInvoke_3);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("IsInvoking", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsInvoking_4);
            args   = new Type[] {};
            method = type.GetMethod("IsInvoking", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsInvoking_5);
            args   = new Type[] { typeof(System.Collections.IEnumerator) };
            method = type.GetMethod("StartCoroutine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StartCoroutine_6);
            args   = new Type[] { typeof(System.String), typeof(System.Object) };
            method = type.GetMethod("StartCoroutine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StartCoroutine_7);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("StartCoroutine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StartCoroutine_8);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("StopCoroutine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StopCoroutine_9);
            args   = new Type[] { typeof(System.Collections.IEnumerator) };
            method = type.GetMethod("StopCoroutine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StopCoroutine_10);
            args   = new Type[] { typeof(UnityEngine.Coroutine) };
            method = type.GetMethod("StopCoroutine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StopCoroutine_11);
            args   = new Type[] {};
            method = type.GetMethod("StopAllCoroutines", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, StopAllCoroutines_12);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("print", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, print_13);
            args   = new Type[] {};
            method = type.GetMethod("get_useGUILayout", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_useGUILayout_14);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_useGUILayout", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_useGUILayout_15);



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

            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
        static void CrawlAppdomain(CSHotFix.Runtime.Enviorment.AppDomain domain, Dictionary <Type, CLRBindingGenerateInfo> infos)
        {
            var arr = domain.LoadedTypes.Values.ToArray();

            //Prewarm
            foreach (var type in arr)
            {
                if (type is CLR.TypeSystem.ILType)
                {
                    if (type.HasGenericParameter)
                    {
                        continue;
                    }
                    var methods = type.GetMethods().ToList();
                    foreach (var i in ((CLR.TypeSystem.ILType)type).GetConstructors())
                    {
                        methods.Add(i);
                    }
                    if (((CLR.TypeSystem.ILType)type).GetStaticConstroctor() != null)
                    {
                        methods.Add(((CLR.TypeSystem.ILType)type).GetStaticConstroctor());
                    }
                    foreach (var j in methods)
                    {
                        CLR.Method.ILMethod method = j as CLR.Method.ILMethod;
                        if (method != null)
                        {
                            if (method.GenericParameterCount > 0 && !method.IsGenericInstance)
                            {
                                continue;
                            }
                            var body = method.Body;
                        }
                    }
                }
            }
            arr = domain.LoadedTypes.Values.ToArray();
            foreach (var type in arr)
            {
                if (type is CLR.TypeSystem.ILType)
                {
                    if (type.TypeForCLR.IsByRef || type.HasGenericParameter)
                    {
                        continue;
                    }
                    var methods = type.GetMethods().ToList();
                    foreach (var i in ((CLR.TypeSystem.ILType)type).GetConstructors())
                    {
                        methods.Add(i);
                    }
                    if (((CLR.TypeSystem.ILType)type).GetStaticConstroctor() != null)
                    {
                        methods.Add(((CLR.TypeSystem.ILType)type).GetStaticConstroctor());
                    }
                    foreach (var j in methods)
                    {
                        CLR.Method.ILMethod method = j as CLR.Method.ILMethod;
                        if (method != null)
                        {
                            if (method.GenericParameterCount > 0 && !method.IsGenericInstance)
                            {
                                continue;
                            }
                            var body = method.Body;
                            foreach (var ins in body)
                            {
                                switch (ins.Code)
                                {
                                case Intepreter.OpCodes.OpCodeEnum.Newobj:
                                {
                                    CLR.Method.CLRMethod m = domain.GetMethod(ins.TokenInteger) as CLR.Method.CLRMethod;
                                    if (m != null)
                                    {
                                        if (m.DeclearingType.IsDelegate)
                                        {
                                            continue;
                                        }
                                        Type t = m.DeclearingType.TypeForCLR;
                                        CLRBindingGenerateInfo info;
                                        if (!infos.TryGetValue(t, out info))
                                        {
                                            info     = CreateNewBindingInfo(t);
                                            infos[t] = info;
                                        }
                                        if (m.IsConstructor)
                                        {
                                            info.Constructors.Add(m.ConstructorInfo);
                                        }
                                        else
                                        {
                                            info.Methods.Add(m.MethodInfo);
                                        }
                                    }
                                }
                                break;

                                case Intepreter.OpCodes.OpCodeEnum.Ldfld:
                                case Intepreter.OpCodes.OpCodeEnum.Stfld:
                                case Intepreter.OpCodes.OpCodeEnum.Ldflda:
                                case Intepreter.OpCodes.OpCodeEnum.Ldsfld:
                                case Intepreter.OpCodes.OpCodeEnum.Ldsflda:
                                case Intepreter.OpCodes.OpCodeEnum.Stsfld:
                                {
                                    var t = domain.GetType((int)(ins.TokenLong >> 32)) as CLR.TypeSystem.CLRType;
                                    if (t != null)
                                    {
                                        var fi = t.GetField((int)ins.TokenLong);
                                        if (fi != null && fi.IsPublic)
                                        {
                                            CLRBindingGenerateInfo info;
                                            if (!infos.TryGetValue(t.TypeForCLR, out info))
                                            {
                                                info = CreateNewBindingInfo(t.TypeForCLR);
                                                infos[t.TypeForCLR] = info;
                                            }
                                            if (ins.Code == Intepreter.OpCodes.OpCodeEnum.Stfld || ins.Code == Intepreter.OpCodes.OpCodeEnum.Stsfld)
                                            {
                                                if (t.IsValueType)
                                                {
                                                    info.ValueTypeNeeded       = true;
                                                    info.DefaultInstanceNeeded = true;
                                                }
                                            }
                                            if (t.TypeForCLR.CheckCanPinn() || !t.IsValueType)
                                            {
                                                info.Fields.Add(fi);
                                            }
                                        }
                                    }
                                }
                                break;

                                case Intepreter.OpCodes.OpCodeEnum.Ldtoken:
                                {
                                    if (ins.TokenInteger == 0)
                                    {
                                        var t = domain.GetType((int)(ins.TokenLong >> 32)) as CLR.TypeSystem.CLRType;
                                        if (t != null)
                                        {
                                            var fi = t.GetField((int)ins.TokenLong);
                                            if (fi != null)
                                            {
                                                CLRBindingGenerateInfo info;
                                                if (!infos.TryGetValue(t.TypeForCLR, out info))
                                                {
                                                    info = CreateNewBindingInfo(t.TypeForCLR);
                                                    infos[t.TypeForCLR] = info;
                                                }
                                                info.Fields.Add(fi);
                                            }
                                        }
                                    }
                                }
                                break;

                                case Intepreter.OpCodes.OpCodeEnum.Newarr:
                                {
                                    var t = domain.GetType(ins.TokenInteger) as CLR.TypeSystem.CLRType;
                                    if (t != null)
                                    {
                                        CLRBindingGenerateInfo info;
                                        if (!infos.TryGetValue(t.TypeForCLR, out info))
                                        {
                                            info = CreateNewBindingInfo(t.TypeForCLR);
                                            infos[t.TypeForCLR] = info;
                                        }
                                        info.ArrayNeeded = true;
                                    }
                                }
                                break;

                                case Intepreter.OpCodes.OpCodeEnum.Call:
                                case Intepreter.OpCodes.OpCodeEnum.Callvirt:
                                {
                                    CLR.Method.CLRMethod m = domain.GetMethod(ins.TokenInteger) as CLR.Method.CLRMethod;
                                    if (m != null)
                                    {
                                        //Cannot explicit call base class's constructor directly
                                        if (m.IsConstructor && m.DeclearingType.CanAssignTo(((CLR.TypeSystem.ILType)type).FirstCLRBaseType))
                                        {
                                            continue;
                                        }
                                        if (m.IsConstructor)
                                        {
                                            if (!m.ConstructorInfo.IsPublic)
                                            {
                                                continue;
                                            }
                                            Type t = m.DeclearingType.TypeForCLR;
                                            CLRBindingGenerateInfo info;
                                            if (!infos.TryGetValue(t, out info))
                                            {
                                                info     = CreateNewBindingInfo(t);
                                                infos[t] = info;
                                            }

                                            info.Constructors.Add(m.ConstructorInfo);
                                        }
                                        else
                                        {
                                            if (!m.MethodInfo.IsPublic)
                                            {
                                                continue;
                                            }
                                            Type t = m.DeclearingType.TypeForCLR;
                                            CLRBindingGenerateInfo info;
                                            if (!infos.TryGetValue(t, out info))
                                            {
                                                info     = CreateNewBindingInfo(t);
                                                infos[t] = info;
                                            }

                                            info.Methods.Add(m.MethodInfo);
                                        }
                                    }
                                }
                                break;
                                }
                            }
                        }
                    }
                }
            }
        }
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

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

            args   = new Type[] {};
            method = type.GetMethod("get_unityLogger", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_unityLogger_0);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(UnityEngine.Color), typeof(System.Single), typeof(System.Boolean) };
            method = type.GetMethod("DrawLine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DrawLine_1);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(UnityEngine.Color), typeof(System.Single) };
            method = type.GetMethod("DrawLine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DrawLine_2);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(UnityEngine.Color) };
            method = type.GetMethod("DrawLine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DrawLine_3);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3) };
            method = type.GetMethod("DrawLine", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DrawLine_4);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(UnityEngine.Color), typeof(System.Single) };
            method = type.GetMethod("DrawRay", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DrawRay_5);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(UnityEngine.Color) };
            method = type.GetMethod("DrawRay", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DrawRay_6);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3) };
            method = type.GetMethod("DrawRay", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DrawRay_7);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(UnityEngine.Color), typeof(System.Single), typeof(System.Boolean) };
            method = type.GetMethod("DrawRay", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DrawRay_8);
            args   = new Type[] {};
            method = type.GetMethod("Break", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Break_9);
            args   = new Type[] {};
            method = type.GetMethod("DebugBreak", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DebugBreak_10);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("Log", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Log_11);
            args   = new Type[] { typeof(System.Object), typeof(UnityEngine.Object) };
            method = type.GetMethod("Log", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Log_12);
            args   = new Type[] { typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("LogFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogFormat_13);
            args   = new Type[] { typeof(UnityEngine.Object), typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("LogFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogFormat_14);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("LogError", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogError_15);
            args   = new Type[] { typeof(System.Object), typeof(UnityEngine.Object) };
            method = type.GetMethod("LogError", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogError_16);
            args   = new Type[] { typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("LogErrorFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogErrorFormat_17);
            args   = new Type[] { typeof(UnityEngine.Object), typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("LogErrorFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogErrorFormat_18);
            args   = new Type[] {};
            method = type.GetMethod("ClearDeveloperConsole", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ClearDeveloperConsole_19);
            args   = new Type[] {};
            method = type.GetMethod("get_developerConsoleVisible", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_developerConsoleVisible_20);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_developerConsoleVisible", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_developerConsoleVisible_21);
            args   = new Type[] { typeof(System.Exception) };
            method = type.GetMethod("LogException", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogException_22);
            args   = new Type[] { typeof(System.Exception), typeof(UnityEngine.Object) };
            method = type.GetMethod("LogException", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogException_23);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("LogWarning", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogWarning_24);
            args   = new Type[] { typeof(System.Object), typeof(UnityEngine.Object) };
            method = type.GetMethod("LogWarning", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogWarning_25);
            args   = new Type[] { typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("LogWarningFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogWarningFormat_26);
            args   = new Type[] { typeof(UnityEngine.Object), typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("LogWarningFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogWarningFormat_27);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("Assert", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Assert_28);
            args   = new Type[] { typeof(System.Boolean), typeof(UnityEngine.Object) };
            method = type.GetMethod("Assert", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Assert_29);
            args   = new Type[] { typeof(System.Boolean), typeof(System.Object) };
            method = type.GetMethod("Assert", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Assert_30);
            args   = new Type[] { typeof(System.Boolean), typeof(System.String) };
            method = type.GetMethod("Assert", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Assert_31);
            args   = new Type[] { typeof(System.Boolean), typeof(System.Object), typeof(UnityEngine.Object) };
            method = type.GetMethod("Assert", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Assert_32);
            args   = new Type[] { typeof(System.Boolean), typeof(System.String), typeof(UnityEngine.Object) };
            method = type.GetMethod("Assert", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Assert_33);
            args   = new Type[] { typeof(System.Boolean), typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("AssertFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AssertFormat_34);
            args   = new Type[] { typeof(System.Boolean), typeof(UnityEngine.Object), typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("AssertFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AssertFormat_35);
            args   = new Type[] { typeof(System.Object) };
            method = type.GetMethod("LogAssertion", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogAssertion_36);
            args   = new Type[] { typeof(System.Object), typeof(UnityEngine.Object) };
            method = type.GetMethod("LogAssertion", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogAssertion_37);
            args   = new Type[] { typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("LogAssertionFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogAssertionFormat_38);
            args   = new Type[] { typeof(UnityEngine.Object), typeof(System.String), typeof(System.Object[]) };
            method = type.GetMethod("LogAssertionFormat", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LogAssertionFormat_39);
            args   = new Type[] {};
            method = type.GetMethod("get_isDebugBuild", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_isDebugBuild_40);



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

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

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

            args   = new Type[] {};
            method = type.GetMethod("get_sceneCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_sceneCount_0);
            args   = new Type[] {};
            method = type.GetMethod("get_sceneCountInBuildSettings", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_sceneCountInBuildSettings_1);
            args   = new Type[] {};
            method = type.GetMethod("GetActiveScene", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetActiveScene_2);
            args   = new Type[] { typeof(UnityEngine.SceneManagement.Scene) };
            method = type.GetMethod("SetActiveScene", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetActiveScene_3);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("GetSceneByPath", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetSceneByPath_4);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("GetSceneByName", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetSceneByName_5);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("GetSceneByBuildIndex", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetSceneByBuildIndex_6);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("GetSceneAt", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetSceneAt_7);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("LoadScene", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadScene_8);
            args   = new Type[] { typeof(System.String), typeof(UnityEngine.SceneManagement.LoadSceneMode) };
            method = type.GetMethod("LoadScene", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadScene_9);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("LoadScene", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadScene_10);
            args   = new Type[] { typeof(System.Int32), typeof(UnityEngine.SceneManagement.LoadSceneMode) };
            method = type.GetMethod("LoadScene", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadScene_11);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("LoadSceneAsync", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadSceneAsync_12);
            args   = new Type[] { typeof(System.String), typeof(UnityEngine.SceneManagement.LoadSceneMode) };
            method = type.GetMethod("LoadSceneAsync", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadSceneAsync_13);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("LoadSceneAsync", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadSceneAsync_14);
            args   = new Type[] { typeof(System.Int32), typeof(UnityEngine.SceneManagement.LoadSceneMode) };
            method = type.GetMethod("LoadSceneAsync", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadSceneAsync_15);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("CreateScene", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CreateScene_16);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("UnloadSceneAsync", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, UnloadSceneAsync_17);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("UnloadSceneAsync", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, UnloadSceneAsync_18);
            args   = new Type[] { typeof(UnityEngine.SceneManagement.Scene) };
            method = type.GetMethod("UnloadSceneAsync", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, UnloadSceneAsync_19);
            args   = new Type[] { typeof(UnityEngine.SceneManagement.Scene), typeof(UnityEngine.SceneManagement.Scene) };
            method = type.GetMethod("MergeScenes", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, MergeScenes_20);
            args   = new Type[] { typeof(UnityEngine.GameObject), typeof(UnityEngine.SceneManagement.Scene) };
            method = type.GetMethod("MoveGameObjectToScene", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, MoveGameObjectToScene_21);



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

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

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

            args   = new Type[] {};
            method = type.GetMethod("get_agentTypeID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_agentTypeID_0);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_agentTypeID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_agentTypeID_1);
            args   = new Type[] {};
            method = type.GetMethod("get_agentRadius", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_agentRadius_2);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_agentRadius", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_agentRadius_3);
            args   = new Type[] {};
            method = type.GetMethod("get_agentHeight", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_agentHeight_4);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_agentHeight", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_agentHeight_5);
            args   = new Type[] {};
            method = type.GetMethod("get_agentSlope", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_agentSlope_6);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_agentSlope", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_agentSlope_7);
            args   = new Type[] {};
            method = type.GetMethod("get_agentClimb", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_agentClimb_8);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_agentClimb", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_agentClimb_9);
            args   = new Type[] {};
            method = type.GetMethod("get_minRegionArea", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_minRegionArea_10);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_minRegionArea", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_minRegionArea_11);
            args   = new Type[] {};
            method = type.GetMethod("get_overrideVoxelSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_overrideVoxelSize_12);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_overrideVoxelSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_overrideVoxelSize_13);
            args   = new Type[] {};
            method = type.GetMethod("get_voxelSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_voxelSize_14);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_voxelSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_voxelSize_15);
            args   = new Type[] {};
            method = type.GetMethod("get_overrideTileSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_overrideTileSize_16);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_overrideTileSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_overrideTileSize_17);
            args   = new Type[] {};
            method = type.GetMethod("get_tileSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_tileSize_18);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_tileSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_tileSize_19);
            args   = new Type[] { typeof(UnityEngine.Bounds) };
            method = type.GetMethod("ValidationReport", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ValidationReport_20);


            app.RegisterCLRMemberwiseClone(type, PerformMemberwiseClone);

            app.RegisterCLRCreateDefaultInstance(type, () => new UnityEngine.AI.NavMeshBuildSettings());
            app.RegisterCLRCreateArrayInstance(type, s => new UnityEngine.AI.NavMeshBuildSettings[s]);
        }
示例#6
0
        static StackObject *GetDeviceCaps_5(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Int32 maxFreq = ptr_of_this_method->Value;
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Int32 minFreq = ptr_of_this_method->Value;
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.String deviceName = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            UnityEngine.Microphone.GetDeviceCaps(deviceName, out minFreq, out maxFreq);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var ___dst = *(StackObject **)&ptr_of_this_method->Value;
                ___dst->ObjectType = ObjectTypes.Integer;
                ___dst->Value      = maxFreq;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = maxFreq;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, maxFreq);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = maxFreq;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, maxFreq);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Int32[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = maxFreq;
            }
            break;
            }

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var ___dst = *(StackObject **)&ptr_of_this_method->Value;
                ___dst->ObjectType = ObjectTypes.Integer;
                ___dst->Value      = minFreq;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = minFreq;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, minFreq);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = minFreq;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, minFreq);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Int32[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = minFreq;
            }
            break;
            }

            return(__ret);
        }
        static StackObject *CompleteAll_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            Unity.Jobs.JobHandle @job2 = (Unity.Jobs.JobHandle) typeof(Unity.Jobs.JobHandle).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            Unity.Jobs.JobHandle @job1 = (Unity.Jobs.JobHandle) typeof(Unity.Jobs.JobHandle).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            Unity.Jobs.JobHandle @job0 = (Unity.Jobs.JobHandle) typeof(Unity.Jobs.JobHandle).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));


            Unity.Jobs.JobHandle.CompleteAll(ref @job0, ref @job1, ref @job2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var    ___dst = *(StackObject **)&ptr_of_this_method->Value;
                object ___obj = @job2;
                if (___dst->ObjectType >= ObjectTypes.Object)
                {
                    if (___obj is CrossBindingAdaptorType)
                    {
                        ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
                    }
                    __mStack[___dst->Value] = ___obj;
                }
                else
                {
                    ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
                }
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @job2;
                }
                else
                {
                    var ___type = __domain.GetType(___obj.GetType()) as CLRType;
                    ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @job2);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var ___type = __domain.GetType(ptr_of_this_method->Value);
                if (___type is ILType)
                {
                    ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @job2;
                }
                else
                {
                    ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @job2);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as Unity.Jobs.JobHandle[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = @job2;
            }
            break;
            }

            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var    ___dst = *(StackObject **)&ptr_of_this_method->Value;
                object ___obj = @job1;
                if (___dst->ObjectType >= ObjectTypes.Object)
                {
                    if (___obj is CrossBindingAdaptorType)
                    {
                        ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
                    }
                    __mStack[___dst->Value] = ___obj;
                }
                else
                {
                    ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
                }
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @job1;
                }
                else
                {
                    var ___type = __domain.GetType(___obj.GetType()) as CLRType;
                    ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @job1);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var ___type = __domain.GetType(ptr_of_this_method->Value);
                if (___type is ILType)
                {
                    ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @job1;
                }
                else
                {
                    ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @job1);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as Unity.Jobs.JobHandle[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = @job1;
            }
            break;
            }

            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var    ___dst = *(StackObject **)&ptr_of_this_method->Value;
                object ___obj = @job0;
                if (___dst->ObjectType >= ObjectTypes.Object)
                {
                    if (___obj is CrossBindingAdaptorType)
                    {
                        ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
                    }
                    __mStack[___dst->Value] = ___obj;
                }
                else
                {
                    ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
                }
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @job0;
                }
                else
                {
                    var ___type = __domain.GetType(___obj.GetType()) as CLRType;
                    ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @job0);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var ___type = __domain.GetType(ptr_of_this_method->Value);
                if (___type is ILType)
                {
                    ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @job0;
                }
                else
                {
                    ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @job0);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as Unity.Jobs.JobHandle[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = @job0;
            }
            break;
            }

            __intp.Free(ptr_of_this_method);
            return(__ret);
        }
示例#8
0
        public static void GenerateBindingCode(CSHotFix.Runtime.Enviorment.AppDomain domain, string outputPath, bool deleteOld = true)
        {
            if (domain == null)
            {
                return;
            }
            if (!System.IO.Directory.Exists(outputPath))
            {
                System.IO.Directory.CreateDirectory(outputPath);
            }
            Dictionary <Type, CLRBindingGenerateInfo> infos = new Dictionary <Type, CLRBindingGenerateInfo>(new ByReferenceKeyComparer <Type>());

            CrawlAppdomain(domain, infos);
            if (deleteOld)
            {
                string[] oldFiles = System.IO.Directory.GetFiles(outputPath, "*.cs");
                foreach (var i in oldFiles)
                {
                    System.IO.File.Delete(i);
                }
            }

            HashSet <MethodBase> excludeMethods = null;
            HashSet <FieldInfo>  excludeFields  = null;
            List <string>        clsNames       = new List <string>();

            foreach (var info in infos)
            {
                if (!info.Value.NeedGenerate)
                {
                    continue;
                }
                Type   i = info.Value.Type;
                string clsName, realClsName;
                bool   isByRef;
                if (i.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0)
                {
                    continue;
                }
                i.GetClassName(out clsName, out realClsName, out isByRef);
                clsNames.Add(clsName);
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outputPath + "/" + clsName + ".cs", false, Encoding.UTF8))
                {
                    sw.Write(@"using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using CSHotFix.CLR.TypeSystem;
using CSHotFix.CLR.Method;
using CSHotFix.Runtime.Enviorment;
using CSHotFix.Runtime.Intepreter;
using CSHotFix.Runtime.Stack;
using CSHotFix.Reflection;
using CSHotFix.CLR.Utils;

namespace CSHotFix.Runtime.Generated
{
    unsafe class ");
                    sw.WriteLine(clsName);
                    sw.Write(@"    {
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(");
                    sw.Write(realClsName);
                    sw.WriteLine(");");
                    MethodInfo[]      methods               = info.Value.Methods.ToArray();
                    FieldInfo[]       fields                = info.Value.Fields.ToArray();
                    string            registerMethodCode    = i.GenerateMethodRegisterCode(methods, excludeMethods);
                    string            registerFieldCode     = fields.Length > 0 ? i.GenerateFieldRegisterCode(fields, excludeFields) : null;
                    string            registerValueTypeCode = info.Value.ValueTypeNeeded ? i.GenerateValueTypeRegisterCode(realClsName) : null;
                    string            registerMiscCode      = i.GenerateMiscRegisterCode(realClsName, info.Value.DefaultInstanceNeeded, info.Value.ArrayNeeded);
                    string            commonCode            = i.GenerateCommonCode(realClsName);
                    ConstructorInfo[] ctors            = info.Value.Constructors.ToArray();
                    string            ctorRegisterCode = i.GenerateConstructorRegisterCode(ctors, excludeMethods);
                    string            methodWraperCode = i.GenerateMethodWraperCode(methods, realClsName, excludeMethods);
                    string            fieldWraperCode  = fields.Length > 0 ? i.GenerateFieldWraperCode(fields, realClsName, excludeFields) : null;
                    string            cloneWraperCode  = null;
                    if (info.Value.ValueTypeNeeded)
                    {
                        //Memberwise clone should copy all fields
                        var fs = i.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly);
                        cloneWraperCode = i.GenerateCloneWraperCode(fs, realClsName);
                    }
                    string ctorWraperCode = i.GenerateConstructorWraperCode(ctors, realClsName, excludeMethods);
                    sw.WriteLine(registerMethodCode);
                    if (fields.Length > 0)
                    {
                        sw.WriteLine(registerFieldCode);
                    }
                    if (info.Value.ValueTypeNeeded)
                    {
                        sw.WriteLine(registerValueTypeCode);
                    }
                    if (!string.IsNullOrEmpty(registerMiscCode))
                    {
                        sw.WriteLine(registerMiscCode);
                    }
                    sw.WriteLine(ctorRegisterCode);
                    sw.WriteLine("        }");
                    sw.WriteLine();
                    sw.WriteLine(commonCode);
                    sw.WriteLine(methodWraperCode);
                    if (fields.Length > 0)
                    {
                        sw.WriteLine(fieldWraperCode);
                    }
                    if (info.Value.ValueTypeNeeded)
                    {
                        sw.WriteLine(cloneWraperCode);
                    }
                    sw.WriteLine(ctorWraperCode);
                    sw.WriteLine("    }");
                    sw.WriteLine("}");
                    sw.Flush();
                }
            }

            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outputPath + "/CLRBindings.cs", false, Encoding.UTF8))
            {
                sw.WriteLine(@"using System;
using System.Collections.Generic;
using System.Reflection;

namespace CSHotFix.Runtime.Generated
{
    class CLRBindings
    {
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(CSHotFix.Runtime.Enviorment.AppDomain app)
        {");
                foreach (var i in clsNames)
                {
                    sw.Write("            ");
                    sw.Write(i);
                    sw.WriteLine(".Register(app);");
                }

                sw.WriteLine(@"        }
    }
}");
            }
        }
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

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

            args   = new Type[] {};
            method = type.GetMethod("get_pointerEnter", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerEnter_0);
            args   = new Type[] { typeof(UnityEngine.GameObject) };
            method = type.GetMethod("set_pointerEnter", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pointerEnter_1);
            args   = new Type[] {};
            method = type.GetMethod("get_lastPress", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_lastPress_2);
            args   = new Type[] {};
            method = type.GetMethod("get_rawPointerPress", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_rawPointerPress_3);
            args   = new Type[] { typeof(UnityEngine.GameObject) };
            method = type.GetMethod("set_rawPointerPress", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_rawPointerPress_4);
            args   = new Type[] {};
            method = type.GetMethod("get_pointerDrag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerDrag_5);
            args   = new Type[] { typeof(UnityEngine.GameObject) };
            method = type.GetMethod("set_pointerDrag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pointerDrag_6);
            args   = new Type[] {};
            method = type.GetMethod("get_pointerCurrentRaycast", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerCurrentRaycast_7);
            args   = new Type[] { typeof(UnityEngine.EventSystems.RaycastResult) };
            method = type.GetMethod("set_pointerCurrentRaycast", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pointerCurrentRaycast_8);
            args   = new Type[] {};
            method = type.GetMethod("get_pointerPressRaycast", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerPressRaycast_9);
            args   = new Type[] { typeof(UnityEngine.EventSystems.RaycastResult) };
            method = type.GetMethod("set_pointerPressRaycast", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pointerPressRaycast_10);
            args   = new Type[] {};
            method = type.GetMethod("get_eligibleForClick", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_eligibleForClick_11);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_eligibleForClick", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_eligibleForClick_12);
            args   = new Type[] {};
            method = type.GetMethod("get_pointerId", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerId_13);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_pointerId", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pointerId_14);
            args   = new Type[] {};
            method = type.GetMethod("get_position", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_position_15);
            args   = new Type[] { typeof(UnityEngine.Vector2) };
            method = type.GetMethod("set_position", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_position_16);
            args   = new Type[] {};
            method = type.GetMethod("get_delta", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_delta_17);
            args   = new Type[] { typeof(UnityEngine.Vector2) };
            method = type.GetMethod("set_delta", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_delta_18);
            args   = new Type[] {};
            method = type.GetMethod("get_pressPosition", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pressPosition_19);
            args   = new Type[] { typeof(UnityEngine.Vector2) };
            method = type.GetMethod("set_pressPosition", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pressPosition_20);
            args   = new Type[] {};
            method = type.GetMethod("get_clickTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_clickTime_21);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_clickTime", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_clickTime_22);
            args   = new Type[] {};
            method = type.GetMethod("get_clickCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_clickCount_23);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_clickCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_clickCount_24);
            args   = new Type[] {};
            method = type.GetMethod("get_scrollDelta", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_scrollDelta_25);
            args   = new Type[] { typeof(UnityEngine.Vector2) };
            method = type.GetMethod("set_scrollDelta", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_scrollDelta_26);
            args   = new Type[] {};
            method = type.GetMethod("get_useDragThreshold", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_useDragThreshold_27);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_useDragThreshold", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_useDragThreshold_28);
            args   = new Type[] {};
            method = type.GetMethod("get_dragging", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_dragging_29);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_dragging", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_dragging_30);
            args   = new Type[] {};
            method = type.GetMethod("get_button", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_button_31);
            args   = new Type[] { typeof(UnityEngine.EventSystems.PointerEventData.InputButton) };
            method = type.GetMethod("set_button", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_button_32);
            args   = new Type[] {};
            method = type.GetMethod("IsPointerMoving", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsPointerMoving_33);
            args   = new Type[] {};
            method = type.GetMethod("IsScrolling", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsScrolling_34);
            args   = new Type[] {};
            method = type.GetMethod("get_enterEventCamera", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_enterEventCamera_35);
            args   = new Type[] {};
            method = type.GetMethod("get_pressEventCamera", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pressEventCamera_36);
            args   = new Type[] {};
            method = type.GetMethod("get_pointerPress", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerPress_37);
            args   = new Type[] { typeof(UnityEngine.GameObject) };
            method = type.GetMethod("set_pointerPress", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pointerPress_38);
            args   = new Type[] {};
            method = type.GetMethod("ToString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToString_39);

            field = type.GetField("hovered", flag);
            app.RegisterCLRFieldGetter(field, get_hovered_0);
            app.RegisterCLRFieldSetter(field, set_hovered_0);


            app.RegisterCLRCreateArrayInstance(type, s => new UnityEngine.EventSystems.PointerEventData[s]);

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

            Type[] args;
            Type   type = typeof(GameDll.CGameProcedure);

            args   = new Type[] {};
            method = type.GetMethod("InitStaticMemeber", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, InitStaticMemeber_0);
            args   = new Type[] { typeof(GameDll.CGameProcedure) };
            method = type.GetMethod("SetActiveProc", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetActiveProc_1);
            args   = new Type[] {};
            method = type.GetMethod("TickActive", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, TickActive_2);
            args   = new Type[] {};
            method = type.GetMethod("ProcessCloseRequest", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ProcessCloseRequest_3);
            args   = new Type[] {};
            method = type.GetMethod("ReleaseStaticMember", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ReleaseStaticMember_4);
            args   = new Type[] {};
            method = type.GetMethod("Update", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Update_5);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("SetProcedureStatus", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetProcedureStatus_6);
            args   = new Type[] {};
            method = type.GetMethod("GetProcedureStatus", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetProcedureStatus_7);
            args   = new Type[] {};
            method = type.GetMethod("GetActiveProcedure", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetActiveProcedure_8);
            args   = new Type[] {};
            method = type.GetMethod("IsWindowActive", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsWindowActive_9);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("SetDisconnect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetDisconnect_10);
            args   = new Type[] {};
            method = type.GetMethod("IsDisconnect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsDisconnect_11);

            field = type.GetField("m_ProType", flag);
            app.RegisterCLRFieldGetter(field, get_m_ProType_0);
            app.RegisterCLRFieldSetter(field, set_m_ProType_0);
            field = type.GetField("s_TimerManager", flag);
            app.RegisterCLRFieldGetter(field, get_s_TimerManager_1);
            app.RegisterCLRFieldSetter(field, set_s_TimerManager_1);
            field = type.GetField("s_VariableManager", flag);
            app.RegisterCLRFieldGetter(field, get_s_VariableManager_2);
            app.RegisterCLRFieldSetter(field, set_s_VariableManager_2);
            field = type.GetField("s_MainHotFixManager", flag);
            app.RegisterCLRFieldGetter(field, get_s_MainHotFixManager_3);
            app.RegisterCLRFieldSetter(field, set_s_MainHotFixManager_3);
            field = type.GetField("s_MainHotFixManager_SystemDll", flag);
            app.RegisterCLRFieldGetter(field, get_s_MainHotFixManager_SystemDll_4);
            app.RegisterCLRFieldSetter(field, set_s_MainHotFixManager_SystemDll_4);
            field = type.GetField("s_EventManager", flag);
            app.RegisterCLRFieldGetter(field, get_s_EventManager_5);
            app.RegisterCLRFieldSetter(field, set_s_EventManager_5);
            field = type.GetField("s_BattleManager", flag);
            app.RegisterCLRFieldGetter(field, get_s_BattleManager_6);
            app.RegisterCLRFieldSetter(field, set_s_BattleManager_6);
            field = type.GetField("s_ProcStartApp", flag);
            app.RegisterCLRFieldGetter(field, get_s_ProcStartApp_7);
            app.RegisterCLRFieldSetter(field, set_s_ProcStartApp_7);
            field = type.GetField("s_ProcLogIn", flag);
            app.RegisterCLRFieldGetter(field, get_s_ProcLogIn_8);
            app.RegisterCLRFieldSetter(field, set_s_ProcLogIn_8);
            field = type.GetField("s_ProcBattle", flag);
            app.RegisterCLRFieldGetter(field, get_s_ProcBattle_9);
            app.RegisterCLRFieldSetter(field, set_s_ProcBattle_9);
            field = type.GetField("s_ProcLobby", flag);
            app.RegisterCLRFieldGetter(field, get_s_ProcLobby_10);
            app.RegisterCLRFieldSetter(field, set_s_ProcLobby_10);
            field = type.GetField("s_ActiveProcedure", flag);
            app.RegisterCLRFieldGetter(field, get_s_ActiveProcedure_11);
            app.RegisterCLRFieldSetter(field, set_s_ActiveProcedure_11);


            app.RegisterCLRCreateArrayInstance(type, s => new GameDll.CGameProcedure[s]);
        }
示例#11
0
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

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

            args   = new Type[] {};
            method = type.GetMethod("get_current", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_current_0);
            args   = new Type[] { typeof(UnityEngine.EventSystems.EventSystem) };
            method = type.GetMethod("set_current", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_current_1);
            args   = new Type[] {};
            method = type.GetMethod("get_sendNavigationEvents", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_sendNavigationEvents_2);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_sendNavigationEvents", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_sendNavigationEvents_3);
            args   = new Type[] {};
            method = type.GetMethod("get_pixelDragThreshold", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pixelDragThreshold_4);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_pixelDragThreshold", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pixelDragThreshold_5);
            args   = new Type[] {};
            method = type.GetMethod("get_currentInputModule", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_currentInputModule_6);
            args   = new Type[] {};
            method = type.GetMethod("get_firstSelectedGameObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_firstSelectedGameObject_7);
            args   = new Type[] { typeof(UnityEngine.GameObject) };
            method = type.GetMethod("set_firstSelectedGameObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_firstSelectedGameObject_8);
            args   = new Type[] {};
            method = type.GetMethod("get_currentSelectedGameObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_currentSelectedGameObject_9);
            args   = new Type[] {};
            method = type.GetMethod("get_isFocused", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_isFocused_10);
            args   = new Type[] {};
            method = type.GetMethod("UpdateModules", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, UpdateModules_11);
            args   = new Type[] {};
            method = type.GetMethod("get_alreadySelecting", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_alreadySelecting_12);
            args   = new Type[] { typeof(UnityEngine.GameObject), typeof(UnityEngine.EventSystems.BaseEventData) };
            method = type.GetMethod("SetSelectedGameObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetSelectedGameObject_13);
            args   = new Type[] { typeof(UnityEngine.GameObject) };
            method = type.GetMethod("SetSelectedGameObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetSelectedGameObject_14);
            args   = new Type[] { typeof(UnityEngine.EventSystems.PointerEventData), typeof(System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>) };
            method = type.GetMethod("RaycastAll", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, RaycastAll_15);
            args   = new Type[] {};
            method = type.GetMethod("IsPointerOverGameObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsPointerOverGameObject_16);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("IsPointerOverGameObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsPointerOverGameObject_17);
            args   = new Type[] {};
            method = type.GetMethod("ToString", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ToString_18);



            app.RegisterCLRCreateArrayInstance(type, s => new UnityEngine.EventSystems.EventSystem[s]);
        }
        static StackObject *TryGetValue_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            CSHotFix.Runtime.Intepreter.ILTypeInstance @value = (CSHotFix.Runtime.Intepreter.ILTypeInstance) typeof(CSHotFix.Runtime.Intepreter.ILTypeInstance).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 @key = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Collections.Generic.Dictionary <System.Int32, CSHotFix.Runtime.Intepreter.ILTypeInstance> instance_of_this_method = (System.Collections.Generic.Dictionary <System.Int32, CSHotFix.Runtime.Intepreter.ILTypeInstance>) typeof(System.Collections.Generic.Dictionary <System.Int32, CSHotFix.Runtime.Intepreter.ILTypeInstance>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.TryGetValue(@key, out @value);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var    ___dst = *(StackObject **)&ptr_of_this_method->Value;
                object ___obj = @value;
                if (___dst->ObjectType >= ObjectTypes.Object)
                {
                    if (___obj is CrossBindingAdaptorType)
                    {
                        ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
                    }
                    __mStack[___dst->Value] = ___obj;
                }
                else
                {
                    ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
                }
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @value;
                }
                else
                {
                    var ___type = __domain.GetType(___obj.GetType()) as CLRType;
                    ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @value);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var ___type = __domain.GetType(ptr_of_this_method->Value);
                if (___type is ILType)
                {
                    ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @value;
                }
                else
                {
                    ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @value);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as CSHotFix.Runtime.Intepreter.ILTypeInstance[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = @value;
            }
            break;
            }

            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            __intp.Free(ptr_of_this_method);
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

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

            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("Update", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Update_0);
            args   = new Type[] {};
            method = type.GetMethod("Update", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Update_1);
            args   = new Type[] {};
            method = type.GetMethod("Initialize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Initialize_2);
            args   = new Type[] {};
            method = type.GetMethod("ClearUpdateZones", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ClearUpdateZones_3);
            args   = new Type[] {};
            method = type.GetMethod("get_material", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_material_4);
            args   = new Type[] { typeof(UnityEngine.Material) };
            method = type.GetMethod("set_material", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_material_5);
            args   = new Type[] {};
            method = type.GetMethod("get_initializationMaterial", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_initializationMaterial_6);
            args   = new Type[] { typeof(UnityEngine.Material) };
            method = type.GetMethod("set_initializationMaterial", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_initializationMaterial_7);
            args   = new Type[] {};
            method = type.GetMethod("get_initializationTexture", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_initializationTexture_8);
            args   = new Type[] { typeof(UnityEngine.Texture) };
            method = type.GetMethod("set_initializationTexture", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_initializationTexture_9);
            args   = new Type[] { typeof(System.Collections.Generic.List <UnityEngine.CustomRenderTextureUpdateZone>) };
            method = type.GetMethod("GetUpdateZones", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetUpdateZones_10);
            args   = new Type[] { typeof(UnityEngine.CustomRenderTextureUpdateZone[]) };
            method = type.GetMethod("SetUpdateZones", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetUpdateZones_11);
            args   = new Type[] {};
            method = type.GetMethod("get_initializationSource", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_initializationSource_12);
            args   = new Type[] { typeof(UnityEngine.CustomRenderTextureInitializationSource) };
            method = type.GetMethod("set_initializationSource", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_initializationSource_13);
            args   = new Type[] {};
            method = type.GetMethod("get_initializationColor", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_initializationColor_14);
            args   = new Type[] { typeof(UnityEngine.Color) };
            method = type.GetMethod("set_initializationColor", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_initializationColor_15);
            args   = new Type[] {};
            method = type.GetMethod("get_updateMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_updateMode_16);
            args   = new Type[] { typeof(UnityEngine.CustomRenderTextureUpdateMode) };
            method = type.GetMethod("set_updateMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_updateMode_17);
            args   = new Type[] {};
            method = type.GetMethod("get_initializationMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_initializationMode_18);
            args   = new Type[] { typeof(UnityEngine.CustomRenderTextureUpdateMode) };
            method = type.GetMethod("set_initializationMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_initializationMode_19);
            args   = new Type[] {};
            method = type.GetMethod("get_updateZoneSpace", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_updateZoneSpace_20);
            args   = new Type[] { typeof(UnityEngine.CustomRenderTextureUpdateZoneSpace) };
            method = type.GetMethod("set_updateZoneSpace", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_updateZoneSpace_21);
            args   = new Type[] {};
            method = type.GetMethod("get_shaderPass", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_shaderPass_22);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_shaderPass", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_shaderPass_23);
            args   = new Type[] {};
            method = type.GetMethod("get_cubemapFaceMask", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_cubemapFaceMask_24);
            args   = new Type[] { typeof(System.UInt32) };
            method = type.GetMethod("set_cubemapFaceMask", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_cubemapFaceMask_25);
            args   = new Type[] {};
            method = type.GetMethod("get_doubleBuffered", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_doubleBuffered_26);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_doubleBuffered", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_doubleBuffered_27);
            args   = new Type[] {};
            method = type.GetMethod("get_wrapUpdateZones", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_wrapUpdateZones_28);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_wrapUpdateZones", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_wrapUpdateZones_29);



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

            args   = new Type[] { typeof(System.Int32), typeof(System.Int32), typeof(UnityEngine.RenderTextureFormat), typeof(UnityEngine.RenderTextureReadWrite) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
            args   = new Type[] { typeof(System.Int32), typeof(System.Int32), typeof(UnityEngine.RenderTextureFormat) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_1);
            args   = new Type[] { typeof(System.Int32), typeof(System.Int32) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_2);
            args   = new Type[] { typeof(System.Int32), typeof(System.Int32), typeof(UnityEngine.Experimental.Rendering.DefaultFormat) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_3);
            args   = new Type[] { typeof(System.Int32), typeof(System.Int32), typeof(UnityEngine.Experimental.Rendering.GraphicsFormat) };
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_4);
        }
示例#14
0
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

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

            args   = new Type[] {};
            method = type.GetMethod("get_renderMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_renderMode_0);
            args   = new Type[] { typeof(UnityEngine.RenderMode) };
            method = type.GetMethod("set_renderMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_renderMode_1);
            args   = new Type[] {};
            method = type.GetMethod("get_isRootCanvas", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_isRootCanvas_2);
            args   = new Type[] {};
            method = type.GetMethod("get_worldCamera", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_worldCamera_3);
            args   = new Type[] { typeof(UnityEngine.Camera) };
            method = type.GetMethod("set_worldCamera", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_worldCamera_4);
            args   = new Type[] {};
            method = type.GetMethod("get_pixelRect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pixelRect_5);
            args   = new Type[] {};
            method = type.GetMethod("get_scaleFactor", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_scaleFactor_6);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_scaleFactor", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_scaleFactor_7);
            args   = new Type[] {};
            method = type.GetMethod("get_referencePixelsPerUnit", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_referencePixelsPerUnit_8);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_referencePixelsPerUnit", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_referencePixelsPerUnit_9);
            args   = new Type[] {};
            method = type.GetMethod("get_overridePixelPerfect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_overridePixelPerfect_10);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_overridePixelPerfect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_overridePixelPerfect_11);
            args   = new Type[] {};
            method = type.GetMethod("get_pixelPerfect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pixelPerfect_12);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_pixelPerfect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pixelPerfect_13);
            args   = new Type[] {};
            method = type.GetMethod("get_planeDistance", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_planeDistance_14);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_planeDistance", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_planeDistance_15);
            args   = new Type[] {};
            method = type.GetMethod("get_renderOrder", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_renderOrder_16);
            args   = new Type[] {};
            method = type.GetMethod("get_overrideSorting", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_overrideSorting_17);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_overrideSorting", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_overrideSorting_18);
            args   = new Type[] {};
            method = type.GetMethod("get_sortingOrder", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_sortingOrder_19);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_sortingOrder", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_sortingOrder_20);
            args   = new Type[] {};
            method = type.GetMethod("get_targetDisplay", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_targetDisplay_21);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_targetDisplay", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_targetDisplay_22);
            args   = new Type[] {};
            method = type.GetMethod("get_normalizedSortingGridSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_normalizedSortingGridSize_23);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_normalizedSortingGridSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_normalizedSortingGridSize_24);
            args   = new Type[] {};
            method = type.GetMethod("get_sortingLayerID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_sortingLayerID_25);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_sortingLayerID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_sortingLayerID_26);
            args   = new Type[] {};
            method = type.GetMethod("get_cachedSortingLayerValue", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_cachedSortingLayerValue_27);
            args   = new Type[] {};
            method = type.GetMethod("get_additionalShaderChannels", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_additionalShaderChannels_28);
            args   = new Type[] { typeof(UnityEngine.AdditionalCanvasShaderChannels) };
            method = type.GetMethod("set_additionalShaderChannels", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_additionalShaderChannels_29);
            args   = new Type[] {};
            method = type.GetMethod("get_sortingLayerName", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_sortingLayerName_30);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("set_sortingLayerName", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_sortingLayerName_31);
            args   = new Type[] {};
            method = type.GetMethod("get_rootCanvas", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_rootCanvas_32);
            args   = new Type[] {};
            method = type.GetMethod("GetDefaultCanvasMaterial", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetDefaultCanvasMaterial_33);
            args   = new Type[] {};
            method = type.GetMethod("GetETC1SupportedCanvasMaterial", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetETC1SupportedCanvasMaterial_34);
            args   = new Type[] {};
            method = type.GetMethod("ForceUpdateCanvases", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ForceUpdateCanvases_35);



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

            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
示例#15
0
        static StackObject *PopulateUIVertex_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @i = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.UIVertex @vertex = (UnityEngine.UIVertex) typeof(UnityEngine.UIVertex).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.UI.VertexHelper instance_of_this_method;
            instance_of_this_method = (UnityEngine.UI.VertexHelper) typeof(UnityEngine.UI.VertexHelper).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.PopulateUIVertex(ref @vertex, @i);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var    ___dst = *(StackObject **)&ptr_of_this_method->Value;
                object ___obj = vertex;
                if (___dst->ObjectType >= ObjectTypes.Object)
                {
                    if (___obj is CrossBindingAdaptorType)
                    {
                        ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
                    }
                    __mStack[___dst->Value] = ___obj;
                }
                else
                {
                    ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
                }
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = vertex;
                }
                else
                {
                    var ___type = __domain.GetType(___obj.GetType()) as CLRType;
                    ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, vertex);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var ___type = __domain.GetType(ptr_of_this_method->Value);
                if (___type is ILType)
                {
                    ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = vertex;
                }
                else
                {
                    ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, vertex);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.UIVertex[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = vertex;
            }
            break;
            }

            return(__ret);
        }
示例#16
0
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

            Type[] args;
            Type   type = typeof(GameDll.InputManager);

            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("SetEnabled", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetEnabled_0);
            args   = new Type[] {};
            method = type.GetMethod("GetEnabled", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetEnabled_1);
            args   = new Type[] {};
            method = type.GetMethod("ResetInput", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ResetInput_2);
            args   = new Type[] {};
            method = type.GetMethod("Init", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Init_3);
            args   = new Type[] {};
            method = type.GetMethod("Update", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Update_4);
            args   = new Type[] {};
            method = type.GetMethod("GetDragX", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetDragX_5);
            args   = new Type[] {};
            method = type.GetMethod("GetDragY", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetDragY_6);
            args   = new Type[] {};
            method = type.GetMethod("GetJoystickValue", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetJoystickValue_7);
            args   = new Type[] {};
            method = type.GetMethod("IsJoystickDirty", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsJoystickDirty_8);
            args   = new Type[] {};
            method = type.GetMethod("GetClickObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetClickObject_9);
            args   = new Type[] {};
            method = type.GetMethod("GetClickPosition", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetClickPosition_10);
            args   = new Type[] {};
            method = type.GetMethod("isClickUI", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, isClickUI_11);
            args   = new Type[] {};
            method = type.GetMethod("isMouseClick", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, isMouseClick_12);
            args   = new Type[] {};
            method = type.GetMethod("isMousePress", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, isMousePress_13);
            args   = new Type[] {};
            method = type.GetMethod("isMouseDraging", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, isMouseDraging_14);
            args   = new Type[] {};
            method = type.GetMethod("GetMousePos2D", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetMousePos2D_15);
            args   = new Type[] { typeof(System.Single), typeof(System.Single), typeof(System.Int32) };
            method = type.GetMethod("GetMouseOverObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetMouseOverObject_16);
            args   = new Type[] {};
            method = type.GetMethod("JoystickStopMove", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, JoystickStopMove_17);
            args   = new Type[] {};
            method = type.GetMethod("JoystickChangeDir", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, JoystickChangeDir_18);
            args   = new Type[] {};
            method = type.GetMethod("UpdateRoleMove", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, UpdateRoleMove_19);

            field = type.GetField("m_bEnableClick3D", flag);
            app.RegisterCLRFieldGetter(field, get_m_bEnableClick3D_0);
            app.RegisterCLRFieldSetter(field, set_m_bEnableClick3D_0);
            field = type.GetField("m_bEnableClick2D", flag);
            app.RegisterCLRFieldGetter(field, get_m_bEnableClick2D_1);
            app.RegisterCLRFieldSetter(field, set_m_bEnableClick2D_1);
            field = type.GetField("m_JoystickValue", flag);
            app.RegisterCLRFieldGetter(field, get_m_JoystickValue_2);
            app.RegisterCLRFieldSetter(field, set_m_JoystickValue_2);


            app.RegisterCLRCreateDefaultInstance(type, () => new GameDll.InputManager());
            app.RegisterCLRCreateArrayInstance(type, s => new GameDll.InputManager[s]);

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

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

            args   = new Type[] {};
            method = type.GetMethod("Clear", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Clear_0);
            args   = new Type[] {};
            method = type.GetMethod("get_currentVertCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_currentVertCount_1);
            args   = new Type[] {};
            method = type.GetMethod("get_currentIndexCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_currentIndexCount_2);
            args   = new Type[] { typeof(UnityEngine.UIVertex).MakeByRefType(), typeof(System.Int32) };
            method = type.GetMethod("PopulateUIVertex", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, PopulateUIVertex_3);
            args   = new Type[] { typeof(UnityEngine.UIVertex), typeof(System.Int32) };
            method = type.GetMethod("SetUIVertex", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetUIVertex_4);
            args   = new Type[] { typeof(UnityEngine.Mesh) };
            method = type.GetMethod("FillMesh", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, FillMesh_5);
            args   = new Type[] {};
            method = type.GetMethod("Dispose", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Dispose_6);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Color32), typeof(UnityEngine.Vector2), typeof(UnityEngine.Vector2), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector4) };
            method = type.GetMethod("AddVert", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AddVert_7);
            args   = new Type[] { typeof(UnityEngine.Vector3), typeof(UnityEngine.Color32), typeof(UnityEngine.Vector2) };
            method = type.GetMethod("AddVert", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AddVert_8);
            args   = new Type[] { typeof(UnityEngine.UIVertex) };
            method = type.GetMethod("AddVert", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AddVert_9);
            args   = new Type[] { typeof(System.Int32), typeof(System.Int32), typeof(System.Int32) };
            method = type.GetMethod("AddTriangle", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AddTriangle_10);
            args   = new Type[] { typeof(UnityEngine.UIVertex[]) };
            method = type.GetMethod("AddUIVertexQuad", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AddUIVertexQuad_11);
            args   = new Type[] { typeof(System.Collections.Generic.List <UnityEngine.UIVertex>), typeof(System.Collections.Generic.List <System.Int32>) };
            method = type.GetMethod("AddUIVertexStream", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AddUIVertexStream_12);
            args   = new Type[] { typeof(System.Collections.Generic.List <UnityEngine.UIVertex>) };
            method = type.GetMethod("AddUIVertexTriangleStream", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AddUIVertexTriangleStream_13);
            args   = new Type[] { typeof(System.Collections.Generic.List <UnityEngine.UIVertex>) };
            method = type.GetMethod("GetUIVertexStream", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetUIVertexStream_14);



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

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

            Type[] args;
            Type   type = typeof(UnityEngine.Experimental.Director.PlayableGraph);

            args   = new Type[] {};
            method = type.GetMethod("IsValid", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsValid_0);
            args   = new Type[] {};
            method = type.GetMethod("CreateGraph", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CreateGraph_1);
            args   = new Type[] {};
            method = type.GetMethod("get_isDone", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_isDone_2);
            args   = new Type[] {};
            method = type.GetMethod("Play", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Play_3);
            args   = new Type[] {};
            method = type.GetMethod("Stop", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Stop_4);
            args   = new Type[] {};
            method = type.GetMethod("get_playableCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_playableCount_5);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("CreateScriptOutput", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CreateScriptOutput_6);
            args   = new Type[] {};
            method = type.GetMethod("get_scriptOutputCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_scriptOutputCount_7);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("GetScriptOutput", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetScriptOutput_8);
            args   = new Type[] {};
            method = type.GetMethod("CreatePlayable", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CreatePlayable_9);
            args   = new Type[] {};
            method = type.GetMethod("CreateGenericMixerPlayable", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CreateGenericMixerPlayable_10);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("CreateGenericMixerPlayable", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CreateGenericMixerPlayable_11);
            args   = new Type[] {};
            method = type.GetMethod("Destroy", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Destroy_12);
            args   = new Type[] { typeof(UnityEngine.Experimental.Director.PlayableHandle), typeof(System.Int32), typeof(UnityEngine.Experimental.Director.PlayableHandle), typeof(System.Int32) };
            method = type.GetMethod("Connect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Connect_13);
            args   = new Type[] { typeof(UnityEngine.Experimental.Director.Playable), typeof(System.Int32), typeof(UnityEngine.Experimental.Director.Playable), typeof(System.Int32) };
            method = type.GetMethod("Connect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Connect_14);
            args   = new Type[] { typeof(UnityEngine.Experimental.Director.Playable), typeof(System.Int32) };
            method = type.GetMethod("Disconnect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Disconnect_15);
            args   = new Type[] { typeof(UnityEngine.Experimental.Director.PlayableHandle), typeof(System.Int32) };
            method = type.GetMethod("Disconnect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Disconnect_16);
            args   = new Type[] { typeof(UnityEngine.Experimental.Director.PlayableHandle) };
            method = type.GetMethod("DestroyPlayable", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DestroyPlayable_17);
            args   = new Type[] { typeof(UnityEngine.Experimental.Director.ScriptPlayableOutput) };
            method = type.GetMethod("DestroyOutput", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DestroyOutput_18);
            args   = new Type[] { typeof(UnityEngine.Experimental.Director.PlayableHandle) };
            method = type.GetMethod("DestroySubgraph", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DestroySubgraph_19);
            args   = new Type[] {};
            method = type.GetMethod("Evaluate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Evaluate_20);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("Evaluate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Evaluate_21);
            args   = new Type[] {};
            method = type.GetMethod("get_rootPlayableCount", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_rootPlayableCount_22);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("GetRootPlayable", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetRootPlayable_23);


            app.RegisterCLRMemberwiseClone(type, PerformMemberwiseClone);

            app.RegisterCLRCreateDefaultInstance(type, () => new UnityEngine.Experimental.Director.PlayableGraph());
            app.RegisterCLRCreateArrayInstance(type, s => new UnityEngine.Experimental.Director.PlayableGraph[s]);
        }
示例#19
0
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

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

            args   = new Type[] {};
            method = type.GetMethod("get_forceModuleActive", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_forceModuleActive_0);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_forceModuleActive", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_forceModuleActive_1);
            args   = new Type[] {};
            method = type.GetMethod("get_inputActionsPerSecond", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_inputActionsPerSecond_2);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_inputActionsPerSecond", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_inputActionsPerSecond_3);
            args   = new Type[] {};
            method = type.GetMethod("get_repeatDelay", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_repeatDelay_4);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_repeatDelay", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_repeatDelay_5);
            args   = new Type[] {};
            method = type.GetMethod("get_horizontalAxis", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_horizontalAxis_6);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("set_horizontalAxis", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_horizontalAxis_7);
            args   = new Type[] {};
            method = type.GetMethod("get_verticalAxis", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_verticalAxis_8);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("set_verticalAxis", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_verticalAxis_9);
            args   = new Type[] {};
            method = type.GetMethod("get_submitButton", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_submitButton_10);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("set_submitButton", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_submitButton_11);
            args   = new Type[] {};
            method = type.GetMethod("get_cancelButton", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_cancelButton_12);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("set_cancelButton", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_cancelButton_13);
            args   = new Type[] {};
            method = type.GetMethod("UpdateModule", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, UpdateModule_14);
            args   = new Type[] {};
            method = type.GetMethod("IsModuleSupported", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, IsModuleSupported_15);
            args   = new Type[] {};
            method = type.GetMethod("ShouldActivateModule", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ShouldActivateModule_16);
            args   = new Type[] {};
            method = type.GetMethod("ActivateModule", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ActivateModule_17);
            args   = new Type[] {};
            method = type.GetMethod("DeactivateModule", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DeactivateModule_18);
            args   = new Type[] {};
            method = type.GetMethod("Process", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Process_19);



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

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

            args   = new Type[] { typeof(UnityEngine.FocusType) };
            method = type.GetMethod("GetControlID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetControlID_0);
            args   = new Type[] { typeof(UnityEngine.GUIContent), typeof(UnityEngine.FocusType) };
            method = type.GetMethod("GetControlID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetControlID_1);
            args   = new Type[] { typeof(UnityEngine.FocusType), typeof(UnityEngine.Rect) };
            method = type.GetMethod("GetControlID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetControlID_2);
            args   = new Type[] { typeof(System.Int32), typeof(UnityEngine.FocusType), typeof(UnityEngine.Rect) };
            method = type.GetMethod("GetControlID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetControlID_3);
            args   = new Type[] { typeof(UnityEngine.GUIContent), typeof(UnityEngine.FocusType), typeof(UnityEngine.Rect) };
            method = type.GetMethod("GetControlID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetControlID_4);
            args   = new Type[] { typeof(System.Type), typeof(System.Int32) };
            method = type.GetMethod("GetStateObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetStateObject_5);
            args   = new Type[] { typeof(System.Type), typeof(System.Int32) };
            method = type.GetMethod("QueryStateObject", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, QueryStateObject_6);
            args   = new Type[] {};
            method = type.GetMethod("get_hotControl", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_hotControl_7);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_hotControl", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_hotControl_8);
            args   = new Type[] {};
            method = type.GetMethod("get_keyboardControl", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_keyboardControl_9);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_keyboardControl", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_keyboardControl_10);
            args   = new Type[] {};
            method = type.GetMethod("ExitGUI", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ExitGUI_11);
            args   = new Type[] { typeof(UnityEngine.Vector2) };
            method = type.GetMethod("GUIToScreenPoint", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GUIToScreenPoint_12);
            args   = new Type[] { typeof(UnityEngine.Vector2) };
            method = type.GetMethod("ScreenToGUIPoint", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ScreenToGUIPoint_13);
            args   = new Type[] { typeof(UnityEngine.Rect) };
            method = type.GetMethod("ScreenToGUIRect", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ScreenToGUIRect_14);
            args   = new Type[] { typeof(System.Single), typeof(UnityEngine.Vector2) };
            method = type.GetMethod("RotateAroundPivot", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, RotateAroundPivot_15);
            args   = new Type[] { typeof(UnityEngine.Vector2), typeof(UnityEngine.Vector2) };
            method = type.GetMethod("ScaleAroundPivot", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ScaleAroundPivot_16);
            args   = new Type[] { typeof(System.Int32), typeof(UnityEngine.FocusType) };
            method = type.GetMethod("GetControlID", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetControlID_17);
            args   = new Type[] {};
            method = type.GetMethod("get_systemCopyBuffer", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_systemCopyBuffer_18);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("set_systemCopyBuffer", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_systemCopyBuffer_19);
            args   = new Type[] {};
            method = type.GetMethod("get_hasModalWindow", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_hasModalWindow_20);



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

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

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

            args   = new Type[] {};
            method = type.GetMethod("get_text", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_text_0);
            args   = new Type[] { typeof(System.String) };
            method = type.GetMethod("set_text", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_text_1);
            args   = new Type[] {};
            method = type.GetMethod("get_material", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_material_2);
            args   = new Type[] { typeof(UnityEngine.Material) };
            method = type.GetMethod("set_material", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_material_3);
            args   = new Type[] {};
            method = type.GetMethod("get_pixelOffset", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pixelOffset_4);
            args   = new Type[] { typeof(UnityEngine.Vector2) };
            method = type.GetMethod("set_pixelOffset", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_pixelOffset_5);
            args   = new Type[] {};
            method = type.GetMethod("get_font", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_font_6);
            args   = new Type[] { typeof(UnityEngine.Font) };
            method = type.GetMethod("set_font", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_font_7);
            args   = new Type[] {};
            method = type.GetMethod("get_alignment", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_alignment_8);
            args   = new Type[] { typeof(UnityEngine.TextAlignment) };
            method = type.GetMethod("set_alignment", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_alignment_9);
            args   = new Type[] {};
            method = type.GetMethod("get_anchor", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_anchor_10);
            args   = new Type[] { typeof(UnityEngine.TextAnchor) };
            method = type.GetMethod("set_anchor", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_anchor_11);
            args   = new Type[] {};
            method = type.GetMethod("get_lineSpacing", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_lineSpacing_12);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_lineSpacing", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_lineSpacing_13);
            args   = new Type[] {};
            method = type.GetMethod("get_tabSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_tabSize_14);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_tabSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_tabSize_15);
            args   = new Type[] {};
            method = type.GetMethod("get_fontSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_fontSize_16);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_fontSize", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_fontSize_17);
            args   = new Type[] {};
            method = type.GetMethod("get_fontStyle", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_fontStyle_18);
            args   = new Type[] { typeof(UnityEngine.FontStyle) };
            method = type.GetMethod("set_fontStyle", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_fontStyle_19);
            args   = new Type[] {};
            method = type.GetMethod("get_richText", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_richText_20);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_richText", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_richText_21);
            args   = new Type[] {};
            method = type.GetMethod("get_color", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_color_22);
            args   = new Type[] { typeof(UnityEngine.Color) };
            method = type.GetMethod("set_color", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_color_23);



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

            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
示例#22
0
        static StackObject *FindCullAndClipWorldRect_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Boolean validRect = ptr_of_this_method->Value == 1;
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Collections.Generic.List <UnityEngine.UI.RectMask2D> rectMaskParents = (System.Collections.Generic.List <UnityEngine.UI.RectMask2D>) typeof(System.Collections.Generic.List <UnityEngine.UI.RectMask2D>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = UnityEngine.UI.Clipping.FindCullAndClipWorldRect(rectMaskParents, out validRect);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var ___dst = *(StackObject **)&ptr_of_this_method->Value;
                ___dst->ObjectType = ObjectTypes.Integer;
                ___dst->Value      = validRect ? 1 : 0;;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = validRect;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, validRect);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = validRect;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, validRect);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Boolean[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = validRect;
            }
            break;
            }

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
示例#23
0
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

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

            args   = new Type[] {};
            method = type.GetMethod("get_forceMagnitude", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_forceMagnitude_0);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_forceMagnitude", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_forceMagnitude_1);
            args   = new Type[] {};
            method = type.GetMethod("get_forceVariation", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_forceVariation_2);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_forceVariation", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_forceVariation_3);
            args   = new Type[] {};
            method = type.GetMethod("get_distanceScale", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_distanceScale_4);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_distanceScale", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_distanceScale_5);
            args   = new Type[] {};
            method = type.GetMethod("get_drag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_drag_6);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_drag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_drag_7);
            args   = new Type[] {};
            method = type.GetMethod("get_angularDrag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_angularDrag_8);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_angularDrag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_angularDrag_9);
            args   = new Type[] {};
            method = type.GetMethod("get_forceSource", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_forceSource_10);
            args   = new Type[] { typeof(UnityEngine.EffectorSelection2D) };
            method = type.GetMethod("set_forceSource", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_forceSource_11);
            args   = new Type[] {};
            method = type.GetMethod("get_forceTarget", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_forceTarget_12);
            args   = new Type[] { typeof(UnityEngine.EffectorSelection2D) };
            method = type.GetMethod("set_forceTarget", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_forceTarget_13);
            args   = new Type[] {};
            method = type.GetMethod("get_forceMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_forceMode_14);
            args   = new Type[] { typeof(UnityEngine.EffectorForceMode2D) };
            method = type.GetMethod("set_forceMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_forceMode_15);



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

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

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

            args   = new Type[] { typeof(UnityEngine.GameObject), typeof(System.Single) };
            method = type.GetMethod("SampleAnimation", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SampleAnimation_0);
            args   = new Type[] {};
            method = type.GetMethod("get_length", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_length_1);
            args   = new Type[] {};
            method = type.GetMethod("get_frameRate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_frameRate_2);
            args   = new Type[] { typeof(System.Single) };
            method = type.GetMethod("set_frameRate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_frameRate_3);
            args   = new Type[] { typeof(System.String), typeof(System.Type), typeof(System.String), typeof(UnityEngine.AnimationCurve) };
            method = type.GetMethod("SetCurve", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetCurve_4);
            args   = new Type[] {};
            method = type.GetMethod("EnsureQuaternionContinuity", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, EnsureQuaternionContinuity_5);
            args   = new Type[] {};
            method = type.GetMethod("ClearCurves", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ClearCurves_6);
            args   = new Type[] {};
            method = type.GetMethod("get_wrapMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_wrapMode_7);
            args   = new Type[] { typeof(UnityEngine.WrapMode) };
            method = type.GetMethod("set_wrapMode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_wrapMode_8);
            args   = new Type[] {};
            method = type.GetMethod("get_localBounds", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_localBounds_9);
            args   = new Type[] { typeof(UnityEngine.Bounds) };
            method = type.GetMethod("set_localBounds", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_localBounds_10);
            args   = new Type[] {};
            method = type.GetMethod("get_legacy", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_legacy_11);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_legacy", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_legacy_12);
            args   = new Type[] {};
            method = type.GetMethod("get_humanMotion", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_humanMotion_13);
            args   = new Type[] { typeof(UnityEngine.AnimationEvent) };
            method = type.GetMethod("AddEvent", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, AddEvent_14);
            args   = new Type[] {};
            method = type.GetMethod("get_events", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_events_15);
            args   = new Type[] { typeof(UnityEngine.AnimationEvent[]) };
            method = type.GetMethod("set_events", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_events_16);



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

            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
        public static void GenerateBindingCode(CSHotFix.Runtime.Enviorment.AppDomain domain, string outputPath,
                                               List <Type> valueTypeBinders = null, List <Type> delegateTypes = null)
        {
            if (domain == null)
            {
                return;
            }
            if (!System.IO.Directory.Exists(outputPath))
            {
                System.IO.Directory.CreateDirectory(outputPath);
            }
            Dictionary <Type, CLRBindingGenerateInfo> infos = new Dictionary <Type, CLRBindingGenerateInfo>(new ByReferenceKeyComparer <Type>());

            CrawlAppdomain(domain, infos);

            if (valueTypeBinders == null)
            {
                valueTypeBinders = new List <Type>(domain.ValueTypeBinders.Keys);
            }

            HashSet <MethodBase> excludeMethods = null;
            HashSet <FieldInfo>  excludeFields  = null;
            HashSet <string>     files          = new HashSet <string>();
            List <string>        clsNames       = new List <string>();

            foreach (var info in infos)
            {
                if (!info.Value.NeedGenerate)
                {
                    continue;
                }
                Type i = info.Value.Type;

                //CLR binding for delegate is important for cross domain invocation,so it should be generated
                //if (i.BaseType == typeof(MulticastDelegate))
                //    continue;

                string clsName, realClsName;
                bool   isByRef;
                if (i.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0)
                {
                    continue;
                }
                i.GetClassName(out clsName, out realClsName, out isByRef);
                if (clsNames.Contains(clsName))
                {
                    clsName = clsName + "_t";
                }
                clsNames.Add(clsName);

                string oFileName = outputPath + "/" + clsName;
                int    len       = Math.Min(oFileName.Length, 100);
                if (len < oFileName.Length)
                {
                    oFileName = oFileName.Substring(0, len) + "_t";
                }
                while (files.Contains(oFileName))
                {
                    oFileName = oFileName + "_t";
                }
                files.Add(oFileName);
                oFileName = oFileName + ".cs";
                //判断Gen1是否已经有该文件
                Type hasType = Type.GetType("CSHotFix.Runtime.Generated." + clsName);
                if (hasType != null)
                {
                    continue;
                }
                if (clsName == "LCLFieldDelegateName_Binding")
                {
                    continue;
                }
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(oFileName, false, new UTF8Encoding(false)))
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(@"using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using CSHotFix.CLR.TypeSystem;
using CSHotFix.CLR.Method;
using CSHotFix.Runtime.Enviorment;
using CSHotFix.Runtime.Intepreter;
using CSHotFix.Runtime.Stack;
using CSHotFix.Reflection;
using CSHotFix.CLR.Utils;

namespace CSHotFix.Runtime.Generated
{
    unsafe class ");
                    sb.AppendLine(clsName);
                    sb.Append(@"    {
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
");
                    string flagDef   = "            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;";
                    string methodDef = "            MethodBase method;";
                    string fieldDef  = "            FieldInfo field;";
                    string argsDef   = "            Type[] args;";
                    string typeDef   = string.Format("            Type type = typeof({0});", realClsName);

                    MethodInfo[]      methods               = info.Value.Methods.ToArray();
                    FieldInfo[]       fields                = info.Value.Fields.ToArray();
                    string            registerMethodCode    = i.GenerateMethodRegisterCode(methods, excludeMethods);
                    string            registerFieldCode     = fields.Length > 0 ? i.GenerateFieldRegisterCode(fields, excludeFields) : null;
                    string            registerValueTypeCode = info.Value.ValueTypeNeeded ? i.GenerateValueTypeRegisterCode(realClsName) : null;
                    string            registerMiscCode      = i.GenerateMiscRegisterCode(realClsName, info.Value.DefaultInstanceNeeded, info.Value.ArrayNeeded);
                    string            commonCode            = i.GenerateCommonCode(realClsName);
                    ConstructorInfo[] ctors            = info.Value.Constructors.ToArray();
                    string            ctorRegisterCode = i.GenerateConstructorRegisterCode(ctors, excludeMethods);
                    string            methodWraperCode = i.GenerateMethodWraperCode(methods, realClsName, excludeMethods, valueTypeBinders);
                    string            fieldWraperCode  = fields.Length > 0 ? i.GenerateFieldWraperCode(fields, realClsName, excludeFields) : null;
                    string            cloneWraperCode  = null;
                    if (info.Value.ValueTypeNeeded)
                    {
                        //Memberwise clone should copy all fields
                        var fs = i.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly);
                        cloneWraperCode = i.GenerateCloneWraperCode(fs, realClsName);
                    }

                    bool hasMethodCode    = !string.IsNullOrEmpty(registerMethodCode);
                    bool hasFieldCode     = !string.IsNullOrEmpty(registerFieldCode);
                    bool hasValueTypeCode = !string.IsNullOrEmpty(registerValueTypeCode);
                    bool hasMiscCode      = !string.IsNullOrEmpty(registerMiscCode);
                    bool hasCtorCode      = !string.IsNullOrEmpty(ctorRegisterCode);
                    bool hasNormalMethod  = methods.Where(x => !x.IsGenericMethod).Count() != 0;

                    if ((hasMethodCode && hasNormalMethod) || hasFieldCode || hasCtorCode)
                    {
                        sb.AppendLine(flagDef);
                    }
                    if (hasMethodCode || hasCtorCode)
                    {
                        sb.AppendLine(methodDef);
                    }
                    if (hasFieldCode)
                    {
                        sb.AppendLine(fieldDef);
                    }
                    if (hasMethodCode || hasFieldCode || hasCtorCode)
                    {
                        sb.AppendLine(argsDef);
                    }
                    if (hasMethodCode || hasFieldCode || hasValueTypeCode || hasMiscCode || hasCtorCode)
                    {
                        sb.AppendLine(typeDef);
                    }

                    sb.AppendLine(registerMethodCode);
                    if (fields.Length > 0)
                    {
                        sb.AppendLine(registerFieldCode);
                    }
                    if (info.Value.ValueTypeNeeded)
                    {
                        sb.AppendLine(registerValueTypeCode);
                    }
                    if (!string.IsNullOrEmpty(registerMiscCode))
                    {
                        sb.AppendLine(registerMiscCode);
                    }
                    sb.AppendLine(ctorRegisterCode);
                    sb.AppendLine("        }");
                    sb.AppendLine();
                    sb.AppendLine(commonCode);
                    sb.AppendLine(methodWraperCode);
                    if (fields.Length > 0)
                    {
                        sb.AppendLine(fieldWraperCode);
                    }
                    if (info.Value.ValueTypeNeeded)
                    {
                        sb.AppendLine(cloneWraperCode);
                    }
                    string ctorWraperCode = i.GenerateConstructorWraperCode(ctors, realClsName, excludeMethods, valueTypeBinders);
                    sb.AppendLine(ctorWraperCode);
                    sb.AppendLine("    }");
                    sb.AppendLine("}");

                    sw.Write(Regex.Replace(sb.ToString(), "(?<!\r)\n", "\r\n"));
                    sw.Flush();
                }
            }

            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outputPath + "/CLRBindings2.cs", false, new UTF8Encoding(false)))
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(@"using System;
using System.Collections.Generic;
using System.Reflection;

namespace CSHotFix.Runtime.Generated
{
    class CLRBindings2
    {
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(CSHotFix.Runtime.Enviorment.AppDomain app)
        {");
                foreach (var i in clsNames)
                {
                    //判断Gen1是否已经有该文件
                    Type hasType = Type.GetType("CSHotFix.Runtime.Generated." + i);
                    if (hasType != null)
                    {
                        continue;
                    }
                    if (i == "LCLFieldDelegateName_Binding")
                    {
                        continue;
                    }
                    sb.Append("            ");
                    sb.Append(i);
                    sb.AppendLine(".Register(app);");
                }

                sb.AppendLine(@"        }
    }
}");
                sw.Write(Regex.Replace(sb.ToString(), "(?<!\r)\n", "\r\n"));
            }

            var delegateClsNames = GenerateDelegateBinding(delegateTypes, outputPath);

            clsNames.AddRange(delegateClsNames);

            //GenerateBindingInitializeScript(clsNames, valueTypeBinders, outputPath);
        }
示例#26
0
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;

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

            args   = new Type[] {};
            method = type.GetMethod("get_resolutions", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_resolutions_0);
            args   = new Type[] {};
            method = type.GetMethod("get_currentResolution", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_currentResolution_1);
            args   = new Type[] { typeof(System.Int32), typeof(System.Int32), typeof(System.Boolean), typeof(System.Int32) };
            method = type.GetMethod("SetResolution", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetResolution_2);
            args   = new Type[] { typeof(System.Int32), typeof(System.Int32), typeof(System.Boolean) };
            method = type.GetMethod("SetResolution", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetResolution_3);
            args   = new Type[] {};
            method = type.GetMethod("get_width", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_width_4);
            args   = new Type[] {};
            method = type.GetMethod("get_height", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_height_5);
            args   = new Type[] {};
            method = type.GetMethod("get_dpi", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_dpi_6);
            args   = new Type[] {};
            method = type.GetMethod("get_fullScreen", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_fullScreen_7);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_fullScreen", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_fullScreen_8);
            args   = new Type[] {};
            method = type.GetMethod("get_autorotateToPortrait", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_autorotateToPortrait_9);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_autorotateToPortrait", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_autorotateToPortrait_10);
            args   = new Type[] {};
            method = type.GetMethod("get_autorotateToPortraitUpsideDown", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_autorotateToPortraitUpsideDown_11);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_autorotateToPortraitUpsideDown", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_autorotateToPortraitUpsideDown_12);
            args   = new Type[] {};
            method = type.GetMethod("get_autorotateToLandscapeLeft", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_autorotateToLandscapeLeft_13);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_autorotateToLandscapeLeft", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_autorotateToLandscapeLeft_14);
            args   = new Type[] {};
            method = type.GetMethod("get_autorotateToLandscapeRight", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_autorotateToLandscapeRight_15);
            args   = new Type[] { typeof(System.Boolean) };
            method = type.GetMethod("set_autorotateToLandscapeRight", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_autorotateToLandscapeRight_16);
            args   = new Type[] {};
            method = type.GetMethod("get_orientation", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_orientation_17);
            args   = new Type[] { typeof(UnityEngine.ScreenOrientation) };
            method = type.GetMethod("set_orientation", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_orientation_18);
            args   = new Type[] {};
            method = type.GetMethod("get_sleepTimeout", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_sleepTimeout_19);
            args   = new Type[] { typeof(System.Int32) };
            method = type.GetMethod("set_sleepTimeout", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_sleepTimeout_20);



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

            args   = new Type[] {};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);
        }
示例#27
0
 /// <summary>
 /// 初始化IL类型
 /// </summary>
 /// <param name="def">MONO返回的类型定义</param>
 /// <param name="domain">ILdomain</param>
 public ILType(TypeReference def, Runtime.Enviorment.AppDomain domain)
 {
     this.typeRef = def;
     RetriveDefinitino(def);
     appdomain = domain;
 }
示例#28
0
 public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
 {
 }
示例#29
0
        public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase   method;
            FieldInfo    field;

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

            args   = new Type[] {};
            method = type.GetMethod("get_pointerEnterHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerEnterHandler_0);
            args   = new Type[] {};
            method = type.GetMethod("get_pointerExitHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerExitHandler_1);
            args   = new Type[] {};
            method = type.GetMethod("get_pointerDownHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerDownHandler_2);
            args   = new Type[] {};
            method = type.GetMethod("get_pointerUpHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerUpHandler_3);
            args   = new Type[] {};
            method = type.GetMethod("get_pointerClickHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_pointerClickHandler_4);
            args   = new Type[] {};
            method = type.GetMethod("get_initializePotentialDrag", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_initializePotentialDrag_5);
            args   = new Type[] {};
            method = type.GetMethod("get_beginDragHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_beginDragHandler_6);
            args   = new Type[] {};
            method = type.GetMethod("get_dragHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_dragHandler_7);
            args   = new Type[] {};
            method = type.GetMethod("get_endDragHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_endDragHandler_8);
            args   = new Type[] {};
            method = type.GetMethod("get_dropHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_dropHandler_9);
            args   = new Type[] {};
            method = type.GetMethod("get_scrollHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_scrollHandler_10);
            args   = new Type[] {};
            method = type.GetMethod("get_updateSelectedHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_updateSelectedHandler_11);
            args   = new Type[] {};
            method = type.GetMethod("get_selectHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_selectHandler_12);
            args   = new Type[] {};
            method = type.GetMethod("get_deselectHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_deselectHandler_13);
            args   = new Type[] {};
            method = type.GetMethod("get_moveHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_moveHandler_14);
            args   = new Type[] {};
            method = type.GetMethod("get_submitHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_submitHandler_15);
            args   = new Type[] {};
            method = type.GetMethod("get_cancelHandler", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_cancelHandler_16);
        }
示例#30
0
    public override void RegisterCLRRedirection(CSHotFix.Runtime.Enviorment.AppDomain appdomain)
    {
        BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
        MethodBase   method;

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

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

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

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

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

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

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

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

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

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

        args   = new Type[] { typeof(Vector2) };
        method = type.GetMethod("op_Implicit", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector2_Implicit);

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

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

        args   = new Type[] { typeof(Vector2), typeof(Vector2) };
        method = type.GetMethod("Distance", flag, null, args, null);
        appdomain.RegisterCLRMethodRedirection(method, Vector2_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);
    }