Exemplo n.º 1
0
        //
        /// <summary>
        /// 游戏逻辑的Assembly
        /// </summary>
        //        public static  Assembly GameAssembly { get; private set; }
        /// <summary>
        /// 开始热更脚本逻辑
        /// </summary>
        private void LoadScrpit(string root)
        {
            if (root != "") //热更代码模式
            {
                if (Config.CodeRunMode == HotfixCodeRunMode.ByILRuntime)
                {
                    //解释执行模式
                    ILRuntimeHelper.LoadHotfix(root);
                    ILRuntimeHelper.AppDomain.Invoke("BDLauncherBridge", "Start", null, new object[] { true });
                }
                else
                {
                    //
                    //反射模式
                    string dllPath = root + "/" + Utils.GetPlatformPath(Application.platform) + "/hotfix/hotfix.dll";

                    IEnumeratorTool.StartCoroutine(this.IE_LoadScript(dllPath));
                }
            }
            else
            {
                //PC 模式非热更

                //这里用反射是为了 不访问逻辑模块的具体类,防止编译失败
                var assembly = Assembly.GetExecutingAssembly();
                //
                var type   = assembly.GetType("BDLauncherBridge");
                var method = type.GetMethod("Start", BindingFlags.Public | BindingFlags.Static);
                method.Invoke(null, new object[] { false });
            }
        }
Exemplo n.º 2
0
        public AssetBundleMgr()
        {
            this.assetbundleMap = new Dictionary <string, AssetBundleReference>();
            this.willDoTaskSet  = new HashSet <int>();
            this.allTaskList    = new List <LoadTaskGroup>();
            //1.设置加载路径
            //persistent 和 streaming同时只能存在一个,
            path = Path.Combine(Application.persistentDataPath, Utils.GetPlatformPath(Application.platform) + "/Art").Replace("\\", "/");
            var configPath = Path.Combine(this.path, "Config.json");

            this.path     = File.Exists(configPath) ? path : Path.Combine(Application.streamingAssetsPath, Utils.GetPlatformPath(Application.platform) + "/Art").Replace("\\", "/");
            this.manifest = new AssetBundleManifestReference(configPath);

            BDebug.Log("Art加载路径:" + path, "red");
        }
Exemplo n.º 3
0
        public AssetBundleMgr(string root)
        {
            //多热更切换,需要卸载
            if (this.manifest != null)
            {
                this.UnloadAllAsset();
                GC.Collect();
            }

            this.assetbundleMap = new Dictionary <string, AssetBundleReference>();
            this.willDoTaskSet  = new HashSet <int>();
            this.allTaskList    = new List <LoadTaskGroup>();
            //1.设置加载路径
            path          = (root + "/" + Utils.GetPlatformPath(Application.platform) + "/Art").Replace("\\", "/");
            this.manifest = new AssetBundleManifestReference(path + "/Config.json");
            BDebug.Log("Art加载路径:" + path, "red");
        }
Exemplo n.º 4
0
        public AssetBundleMgr(string root, Action onLoded)
        {
            //多热更切换,需要卸载
            if (this.manifest != null)
            {
                this.UnloadAllAsset();
                GC.Collect();
            }

            this.assetbundleMap = new Dictionary <string, AssetBundleReference>();
            this.willDoTaskSet  = new HashSet <int>();
            this.allTaskList    = new List <LoadTaskGroup>();
            //1.设置加载路径
            artRootPath    = (root + "/" + Utils.GetPlatformPath(Application.platform) + "/Art").Replace("\\", "/");
            secArtRootPath = (Application.streamingAssetsPath + "/" + Utils.GetPlatformPath(Application.platform) + "/Art").Replace("\\", "/");
            //
            string configPath = FindAsset("Config.json");

            BDebug.Log("Art加载路径:" + configPath, "red");
            //
            this.manifest          = new AssetBundleManifestReference(configPath);
            this.manifest.OnLoaded = onLoded;
        }