예제 #1
0
        private void DownloadNext()
        {
            if (_md5File.DownloadQueue.Count == 0)
            {
                if (_failList.Count > 0)
                {
                    Error(new SDownloadEventResult(DownloadEventType.Error, "下载失败"));
                    //TODO 临时输出
                    for (int i = 0; i < _failList.Count; i++)
                    {
                        Debug.LogError("失败的文件:" + _failList[i].download_url);
                    }
                }
                else
                {
                    AllComplete(new SDownloadEventResult(DownloadEventType.AllComplete));
                }
                return;
            }

            _currentConfig = _md5File.DownloadQueue.Dequeue();
            //将这个文件记录到下载中
            _md5File.PushTmpFile(_currentConfig.key);

            _webDownload.DownloadFile(_currentConfig.download_url, _currentConfig.localPath_url, TIMEOUT, OnProgress, OnComplete);
        }
예제 #2
0
 private void DownloadNext()
 {
     if (m_downloadConfigQueue.Count == 0)
     {
         if (m_downloadFailConfigList.Count > 0)
         {
             //有资源下载失败
             for (int i = 0; i < m_downloadFailConfigList.Count; i++)
             {
                 if (m_downloadCallback.Error != null)
                 {
                     m_downloadCallback.Error(m_downloadFailConfigList[i].fileName);
                 }
                 Debug.LogError("下载失败的资源文件: " + m_downloadFailConfigList[i].fileName);
             }
         }
         else
         {
             //资源全部下载成功
             if (m_downloadCallback.AllComplete != null)
             {
                 m_downloadCallback.AllComplete();       //=========================================================================================== AllComplete回调
             }
         }
         return;
     }
     m_currentConfig = m_downloadConfigQueue.Dequeue();
     m_md5File.PushTempFile(m_currentConfig.fileName);
     m_downloader.DownloadFile(m_currentConfig.downloadUrl, m_currentConfig.localUrl,
                               m_currentConfig.downloadTimeout,
                               OnProgress,  //资源下载过程中会一直调用这个Progress
                               OnComplete); //资源下载完成后调用OnComplete
 }