예제 #1
0
        private async ETTask HotfixUpdate()
        {
            BundleDownloaderComponent bundleDownloaderComponent = Game.Scene.GetComponent <BundleDownloaderComponent>();

            for (int i = 0; i < GameVersionsConfigMgr.Ins.ServerGameVersionsConfig.ToyGameVersionsArray.Count; i++)
            {
                for (int j = 0; j < GameVersionsConfigMgr.Ins.LocalGameVersionsConfig.ToyGameVersionsArray.Count; j++)
                {
                    //对比服务器版本
                    if (GameVersionsConfigMgr.Ins.ServerGameVersionsConfig.ToyGameVersionsArray[i].Id ==
                        GameVersionsConfigMgr.Ins.LocalGameVersionsConfig.ToyGameVersionsArray[j].Id)
                    {
                        //如果本地版本比服务器版本 高或者相同 就不用更新
                        if (GameVersionsConfigMgr.Ins.LocalGameVersionsConfig.ToyGameVersionsArray[j].Version >=
                            GameVersionsConfigMgr.Ins.ServerGameVersionsConfig.ToyGameVersionsArray[i].Version)
                        {
                            continue;
                        }
                        BundleDownSchedule bundleDownSchedule = new BundleDownSchedule();
                        UndateResActionInvoke(bundleDownSchedule, i + 1, GameVersionsConfigMgr.Ins.ServerGameVersionsConfig.ToyGameVersionsArray.Count);
                        await bundleDownloaderComponent.StartAsync(GameVersionsConfigMgr.Ins.ServerGameVersionsConfig
                                                                   .ToyGameVersionsArray[i], bundleDownSchedule);
                    }
                }
            }
            GameVersionsConfigMgr.Ins.SaveServerVersionsToLocal(); //更新完成 存储服务器版本信息到本地
        }
예제 #2
0
        public async void UndateResActionInvoke(BundleDownSchedule bundleDownSchedule, int currNum, int totalNum)
        {
            bundleDownSchedule.pLoserCall += DownError;
            while (!bundleDownSchedule.IsFinishDown)
            {
                await Game.Scene.GetComponent <TimerComponent>().WaitAsync(100);

                //Log.Debug(bundleDownSchedule.Progress.ToString());
                UpdateResAction?.Invoke(bundleDownSchedule.Progress, currNum, totalNum);
            }
            Log.Debug("下载完成currNum:" + currNum);
        }
예제 #3
0
        //开始下载
        public async ETTask StartAsync(string fileFoldr = "", string versionName = "Version.txt", BundleDownSchedule downloader = null)
        {
            BundleDownloader bundleDownloader = ComponentFactory.Create <BundleDownloader>();

            downloader?.SetBundleDownloader(bundleDownloader);
            await bundleDownloader.StartAsync(fileFoldr, versionName);

            DisposeBundleDownloader(bundleDownloader);
        }
예제 #4
0
        //public List<BundleDownloader> pDownloaders;


        //开始下载
        public async ETTask StartAsync(ToyGameVersions toyGameVersions, BundleDownSchedule downloader = null)
        {
            await StartAsync(toyGameVersions.DownloadFolder, toyGameVersions.VersionFile, downloader);
        }