예제 #1
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);
                }
            }
        }