예제 #1
0
        async static ETTask <bool> DownloadContent(this UIUpdateView self)
        {
            var url  = ServerConfigComponent.Instance.GetUpdateListCdnUrl();
            var info = await HttpManager.Instance.HttpGetResult(url);

            if (!string.IsNullOrEmpty(info))
            {
                await self.DownloadAllAssetBundle();

                return(true);
            }
            else
            {
                Log.Info("DownloadContent Begin DownloadDependenciesAsync failed");
                var btnState = await self.ShowMsgBoxView("Update_Get_Fail", "Update_ReTry", self.force_update?"Btn_Exit" : "Update_Skip");

                if (btnState == self.BTN_CONFIRM)
                {
                    return(await self.DownloadContent());
                }
                else
                {
                    if (self.force_update)
                    {
                        GameUtility.Quit();
                    }
                    return(false);
                }
            }
        }
예제 #2
0
        async static ETTask DownloadAllAssetBundle(this UIUpdateView self)
        {
            var downloadTool = self.AddComponent <DownloadComponent>();

            for (int i = 0; i < self.m_needdownloadinfo.Count; i++)
            {
                var url      = string.Format("{0}/{1}", self.m_rescdn_url, self.m_needdownloadinfo[i].name);
                var savePath = AssetBundleMgr.GetInstance().getCachedAssetBundlePath(self.m_needdownloadinfo[i].name) + ".temp";
                downloadTool.AddDownloadUrl(url, savePath);
            }
            self.RefreshProgress(downloadTool).Coroutine();
            var res = await downloadTool.DownloadAll();

            if (!res)
            {
                var btnState = await self.ShowMsgBoxView("Update_Download_Fail", "Update_ReTry",
                                                         self.force_update? "Btn_Exit" : "Btn_Cancel");

                if (btnState == self.BTN_CONFIRM)
                {
                    await self.DownloadAllAssetBundle();
                }
                else if (self.force_update)
                {
                    GameUtility.Quit();
                }
            }
            else
            {
                for (int i = 0; i < self.m_needdownloadinfo.Count; i++)
                {
                    var downinfo = self.m_needdownloadinfo[i];
                    AssetBundleMgr.GetInstance().CacheAssetBundle(downinfo.name, downinfo.hash);
                }
            }
        }