Esempio n. 1
0
    public void Init(string dllName)
    {
        if (!Load(dllName))
        {
            UnityEngine.Debug.LogError("script dll load err");
            return;
        }
        Main main = Tool.Main();

        if (main != null)
        {
            m_Assembly.AllowUnboundCLRMethod = main.m_CheckUnBoundClass;
            UnityEngine.Debug.Log("CSHotFix 检测是否绑定类:" + main.m_CheckUnBoundClass);
        }
#if CSHotFixSafe
#else
        InitScript(m_Assembly);

#if CSHotFix
        CSHotFix.Runtime.Generated.CLRBindings.Initialize(m_Assembly);
        CSHotFix.Runtime.Generated.CLRBindings2.Initialize(m_Assembly);
#endif
#endif
        string HotFixLoop = dllName + ".HotFixLoop";
        m_HotFixDll = m_Assembly.Instantiate <IGameHotFixInterface>(HotFixLoop);
        m_HotFixDll.Start();
    }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
    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();
    }
Esempio n. 5
0
    //区分多个dll,用于加载类似子游戏的
    public void Init(string dllName)
    {
        if (!Load(dllName))
        {
            UnityEngine.Debug.LogError("script dll load err");
            return;
        }
        //HotFix.HotFixLoop
        string HotFixLoop = dllName + ".HotFixLoop";

        m_HotFixDll = (IGameHotFixInterface)m_Assembly.CreateInstance(HotFixLoop);
        m_HotFixDll.Start();
    }
Esempio n. 6
0
        public void Init()
        {
            IsHotFix = false;
            if (HotFixDllMdb != null)
            {
                m_Assembly = System.Reflection.Assembly.Load(HotFixDll.bytes, HotFixDllMdb.bytes);
            }
            else
            {
                m_Assembly = System.Reflection.Assembly.Load(HotFixDll.bytes);
            }
            string HotFixLoop = "LCL.HotFixLoop";

            m_DllInstance = (IGameHotFixInterface)m_Assembly.CreateInstance(HotFixLoop);
            m_DllInstance.Start();
        }