Пример #1
0
        public static HttpDownload StartDownloadFile(string url, string saveFile, AssetBundleConfig config, HttpDownloadCallback finishCallback = null)
        {
            if (null == downloader)
            {
                downloader = new HttpDownload();
            }

            downloader.StartTask(url, saveFile, config, finishCallback);

            return(downloader);
        }
Пример #2
0
        private void Download()
        {
            if (!mIsPause && mDownloadTask.Count > 0 && !mIsDownload)
            {
                if (null == mDownloader || (!mDownloader.IsProcess() && !mDownloader.HasTask()))
                {
                    mCurTask = mDownloadTask[mDownloadTask.Count - 1];
                    HttpDownloadCallback callback = (success) =>
                    {
                        lock (mLockObject)
                        {
                            DownloadCallback(success, mCurTask);
                        }
                    };
                    mDownloader = HttpDownload.StartDownloadFile(mCurTask.url, mCurTask.saveFile, mCurTask.config, callback);
                    mDownloadTask.RemoveAt(mDownloadTask.Count - 1);
                    mIsDownload = true;

                    LogMgr.UnityLog("http download:" + mCurTask.url);
                }
            }
        }