public static void InitScript(object obj) { CSHotFix.Runtime.Enviorment.AppDomain appDomain = obj as CSHotFix.Runtime.Enviorment.AppDomain; //根据实际情况手动添加几个注册 //appDomain.DelegateManager.RegisterMethodDelegate<UnityEngine.GameObject>(); //appDomain.DelegateManager.RegisterMethodDelegate<WfPacket>(); appDomain.DelegateManager.RegisterDelegateConvertor <UnityEngine.Events.UnityAction>((act) => { return(new UnityEngine.Events.UnityAction(() => { ((Action)act)(); })); }); appDomain.DelegateManager.RegisterMethodDelegate <CSHotFix.Runtime.Intepreter.ILTypeInstance>(); #if CSHotFixSafe #else #if CSHotFix LCLFunctionDelegate.Reg(appDomain); #endif #endif AdapterRegister.RegisterCrossBindingAdaptor(appDomain); //单独注册协程 appDomain.RegisterCrossBindingAdaptor(new CoroutineAdapter()); //注册值类型 appDomain.RegisterValueTypeBinder(typeof(Vector3), new Vector3Binder()); appDomain.RegisterValueTypeBinder(typeof(Quaternion), new QuaternionBinder()); appDomain.RegisterValueTypeBinder(typeof(Vector2), new Vector2Binder()); }
public void Init() { IsHotFix = true; using (System.IO.MemoryStream fs = new MemoryStream(HotFixDll.bytes)) { m_Assembly.LoadAssembly(fs); } m_Assembly.AllowUnboundCLRMethod = true; //根据实际情况手动添加几个注册 m_Assembly.DelegateManager.RegisterMethodDelegate <UnityEngine.GameObject>(); m_Assembly.DelegateManager.RegisterDelegateConvertor <UnityEngine.Events.UnityAction>((act) => { return(new UnityEngine.Events.UnityAction(() => { ((Action)act)(); })); }); m_Assembly.DelegateManager.RegisterMethodDelegate <CSHotFix.Runtime.Intepreter.ILTypeInstance>(); #if CSHotFixSafe #else LCLFunctionDelegate.Reg(m_Assembly); AdapterRegister.RegisterCrossBindingAdaptor(m_Assembly); CSHotFix.Runtime.Generated.CLRBindings.Initialize(m_Assembly); #endif string HotFixLoop = "LCL.HotFixLoop"; m_DllInstance = m_Assembly.Instantiate <IGameHotFixInterface>(HotFixLoop); m_DllInstance.Start(); }
public void Init() { IsHotFix = true; using (System.IO.MemoryStream fs = new MemoryStream(HotFixDll.bytes)) { m_Assembly.LoadAssembly(fs); } m_Assembly.AllowUnboundCLRMethod = true; //注册跨域类 m_Assembly.RegisterCrossBindingAdaptor(new IGameHotFixInterfaceAdapter()); m_Assembly.DelegateManager.RegisterMethodDelegate <UnityEngine.GameObject>(); m_Assembly.DelegateManager.RegisterMethodDelegate <System.Int32>(); m_Assembly.DelegateManager.RegisterMethodDelegate <System.Boolean>(); m_Assembly.DelegateManager.RegisterMethodDelegate <CSHotFix.Runtime.Intepreter.ILTypeInstance>(); m_Assembly.DelegateManager.RegisterMethodDelegate <System.Int32, System.Int32>(); m_Assembly.DelegateManager.RegisterMethodDelegate <System.Object>(); LCLFunctionDelegate.Reg(m_Assembly); CSHotFix.Runtime.Generated.CLRBindings.Initialize(m_Assembly); string HotFixLoop = "LCL.HotFixLoop"; m_DllInstance = m_Assembly.Instantiate <IGameHotFixInterface>(HotFixLoop); m_DllInstance.Start(); }
public void Init() { using (System.IO.MemoryStream fs = new MemoryStream(HotFixDll.bytes)) { m_AssemblyILR.LoadAssembly(fs); } m_AssemblyILR.AllowUnboundCLRMethod = true; ILRuntime.Runtime.Enviorment.AppDomain.ShowDebugInfo = false; //注册跨域类 m_AssemblyILR.RegisterCrossBindingAdaptor(new IGameHotFixInterfaceAdapter()); m_AssemblyILR.DelegateManager.RegisterMethodDelegate <UnityEngine.GameObject>(); m_AssemblyILR.DelegateManager.RegisterMethodDelegate <System.Int32>(); m_AssemblyILR.DelegateManager.RegisterMethodDelegate <System.Boolean>(); m_AssemblyILR.DelegateManager.RegisterMethodDelegate <ILRuntime.Runtime.Intepreter.ILTypeInstance>(); m_AssemblyILR.DelegateManager.RegisterMethodDelegate <System.Int32, System.Int32>(); m_AssemblyILR.DelegateManager.RegisterMethodDelegate <System.Object>(); LCLFunctionDelegate.Reg(m_AssemblyILR); ILRuntime.Runtime.Generated.CLRBindings.Initialize(m_AssemblyILR); string HotFixLoop = "LCL.HotFixLoop"; m_HotFixDll = m_AssemblyILR.Instantiate <IGameHotFixInterface>(HotFixLoop); m_HotFixDll.Start(); }