using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Reflection; using ILRuntime.CLR.Method; using ILRuntime.CLR.TypeSystem; using ILRuntime.Runtime.Enviorment; using ILRuntime.Runtime.Generated; using ILRuntime.Runtime.Intepreter; using ProtoBuf; using UnityEngine; namespace ET { public static class ILHelper { public static void InitILRuntime(ILRuntime.Runtime.Enviorment.AppDomain appdomain) { // 注册重定向函数 // 注册委托 appdomain.DelegateManager.RegisterMethodDelegate>(); appdomain.DelegateManager.RegisterMethodDelegate(); appdomain.DelegateManager.RegisterMethodDelegate(); appdomain.DelegateManager.RegisterMethodDelegate(); appdomain.DelegateManager.RegisterMethodDelegate(); appdomain.DelegateManager.RegisterMethodDelegate(); appdomain.DelegateManager.RegisterMethodDelegate(); appdomain.DelegateManager.RegisterMethodDelegate(); appdomain.DelegateManager.RegisterMethodDelegate(); appdomain.DelegateManager.RegisterFunctionDelegate(); appdomain.DelegateManager.RegisterFunctionDelegate(); appdomain.DelegateManager.RegisterFunctionDelegate(); appdomain.DelegateManager.RegisterFunctionDelegate, System.String>(); appdomain.DelegateManager.RegisterFunctionDelegate, System.Boolean>(); appdomain.DelegateManager.RegisterFunctionDelegate, System.Int32>(); appdomain.DelegateManager.RegisterFunctionDelegate, int>(); appdomain.DelegateManager.RegisterFunctionDelegate, bool>(); appdomain.DelegateManager.RegisterFunctionDelegate();//Linq appdomain.DelegateManager.RegisterFunctionDelegate();//Linq appdomain.DelegateManager.RegisterFunctionDelegate>, bool>(); appdomain.DelegateManager.RegisterFunctionDelegate, KeyValuePair, int>(); // 注册适配器 RegisterAdaptor(appdomain); //注册Json的CLR LitJson.JsonMapper.RegisterILRuntimeCLRRedirection(appdomain); //注册ProtoBuf的CLR PType.RegisterILRuntimeCLRRedirection(appdomain); CLRBindings.Initialize(appdomain); } public static void RegisterAdaptor(ILRuntime.Runtime.Enviorment.AppDomain appdomain) { //注册自己写的适配器 appdomain.RegisterCrossBindingAdaptor(new IAsyncStateMachineClassInheritanceAdaptor()); appdomain.RegisterCrossBindingAdaptor(new IDisposableAdapter()); } } }