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 List list = new List(); public static void InitILRuntime(ILRuntime.Runtime.Enviorment.AppDomain appdomain) { list.Add(typeof(Dictionary)); list.Add(typeof(Dictionary)); list.Add(typeof(Dictionary)); list.Add(typeof(Dictionary)); list.Add(typeof(Dictionary)); list.Add(typeof(Dictionary)); list.Add(typeof(Dictionary)); list.Add(typeof(Dictionary)); list.Add(typeof(Dictionary)); list.Add(typeof(Dictionary)); list.Add(typeof(List)); list.Add(typeof(List)); list.Add(typeof(List)); list.Add(typeof(List)); list.Add(typeof(List)); list.Add(typeof(ListComponent)); list.Add(typeof(ETTask)); list.Add(typeof(ETTask)); list.Add(typeof(ETTask)); list.Add(typeof(ETTask)); list.Add(typeof(ETTask)); list.Add(typeof(ETTask)); list.Add(typeof(ListComponent)); list.Add(typeof(ListComponent)); // 注册重定向函数 // 注册委托 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.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>(); appdomain.DelegateManager.RegisterDelegateConvertor((act) => { return new UnityEngine.Events.UnityAction(() => { ((Action)act)(); }); }); appdomain.DelegateManager.RegisterDelegateConvertor>>((act) => { return new Comparison>((x, y) => { return ((Func, KeyValuePair, int>)act)(x, y); }); }); // 注册适配器 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()); } } }