Beispiel #1
0
        /// <summary>
        /// 启动热更代码执行
        /// </summary>
        /// <param name="dllDir">Dll文件所在目录</param>
        /// <param name="dllName">DLL文件名称(不含扩展名)</param>
        /// <param name="isDebug">是否是调试模式(仅针对ILRuntime,可以用第三方插件在APP运行时进行调试)</param>
        /// <param name="methodName">是否需要加载PDB文件(仅针对ILRuntime,可以在调试时打印出错代码信息)</param>
        public void Startup(string dllDir, string dllName, bool isDebug, bool isNeedPdbFile)
        {
            this.dllDir  = dllDir;
            this.dllName = dllName;

            string dllPath = Path.Combine(dllDir, dllName + ".dll");

            byte[] dllBytes = File.ReadAllBytes(dllPath);

            Assembly assembly = null;

            //如果是反射执行模式,则优先检查是否反射执行,如果不行则切换为ILRuntime模式
            if (Runtime.Ins.VO.ilType == EILType.REFLECTION)
            {
                assembly = AssemblyILWorker.LoadAssembly(dllBytes);
            }

            if (null != assembly)
            {
                //使用Assembly
                iLWorker = new AssemblyILWorker(assembly);
            }
            else
            {
                //使用ILRuntime
                var ilruntimeWorker = new ILRuntimeILWorker(dllBytes, dllDir, dllName, isDebug, isNeedPdbFile);
                iLWorker = ilruntimeWorker;

                ILRuntimeAppDomain = ilruntimeWorker.appDomain;
                IsILRuntimeMode    = true;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 开始激活预加载
        /// </summary>
        /// <param name="rg"></param>
        public void StartPreload(BaseILRuntimeGenerics rg = null)
        {
            if (null != rg)
            {
                ILRuntimeILWorker.RegisterILRuntimeGenerics(rg);
            }

            //初始化运行环境配置环境
            Runtime.Ins.Init(runtimeCfg);

            Log.CI(Log.COLOR_BLUE, "游戏运行模式:[{0}]", Runtime.Ins.IsHotResProject?Runtime.Ins.ResMode.ToString():"Local");

            if (false == Runtime.Ins.IsHotResProject)
            {
                ResMgr.Ins.Init(ResMgr.EResMgrType.RESOURCES);
                StartMainPrefab();
            }
            else
            {
                OnStageChange(EState.UNZIP_PACKAGE);
                new PackageUpdate().Start(LoadSettingFile, OnPackageUpdate);
            }
        }