Example #1
0
    //下载开始,从最尾端开始
    private void Download()
    {
        if (m_nDownloadCount > 0)
        {
            m_bDownloading = true;

            string url = GameDataMgr.c_HotUpdate + GetDownloadName(m_DownloadList[m_nDownloadCount - 1]);

            string localFilePath = LocalPath.LocalPackagingResources + GetDownloadName(m_DownloadList[m_nDownloadCount - 1]);

            m_Downloader.DownloadFile(url, C_String.GetSavePath(localFilePath), () =>
            {
                m_CurDownloadLength += m_Downloader.DownloadFileLength;

                m_Downloader.Reset();

                m_nDownloadCount--;

                m_bDownloading = false;
            });
        }
        else
        {
            m_bDownloading = true;

            //如果都下载完了,就需要删除原来的文件,替换下载的文件
            if (ReplaceAllDownloadFile())
            {
                //配置文件替换,整个下载过程完成
                string stageConfigName = GameStageHotUpdateMgr.GetStageConfigName(StageName);

                string localFilePath = LocalPath.LocalHotUpdateConfigPath + stageConfigName;
                if (File.Exists(localFilePath))
                {
                    File.Delete(localFilePath);
                }

                m_Downloader.DownloadFile(LocalPath.ServerHotUpdateConfigPath + stageConfigName, LocalPath.LocalHotUpdateConfigPath, () =>
                {
                    m_bDownloading = false;

                    DownloadState = 2;
                });
            }
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        //bundle下载
        localPath             = LocalPath.LocalPackagingResources;
        httpDownloader_bundle = new C_HttpDownloader();
        httpDownloader_bundle.DownloadFile(url, localPath, Finish);

        //manifest下载
        httpDownloader_mainifest = new C_HttpDownloader();
        httpDownloader_mainifest.DownloadFile(ur2, localPath, Finish);
    }