Esempio n. 1
0
        public HttpDownloadTask(string url, string saveFile, AssetBundleConfig config, HttpDownloadFinish callback)
        {
            this.url      = url;
            this.saveFile = saveFile;
            this.callback = callback;
            this.config   = config;

            if (string.IsNullOrEmpty(configPath))
            {
                configPath = BundleCommon.UserVersionPath;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 下载资源
        /// </summary>
        private void DownLoadAsset()
        {
            mCurrentDownLoadCount = mNewVersionDataConfig.Count;
            for (int i = 0; i < mNewVersionDataConfig.Count; i++)
            {
                AssetBundleConfig child     = mNewVersionDataConfig[i];
                string            remoteUrl = BundleCommon.RemoteUrl + child.RelativePath + "_Compress";
                string            saveFile  = Application.persistentDataPath + "/" + BundleCommon.ResVersion + "/Out" + child.RelativePath + "_Compress";

                HttpDownloadFinish downLoadAssetComplete = (success) =>
                {
                    OnDownLoadAsset(success, child);
                };
                SG.CoreEntry.gHttpDownloadMgr.PushDownloadFile(remoteUrl, saveFile, child, downLoadAssetComplete);
            }

            mNewVersionDataConfig.Clear();
        }
Esempio n. 3
0
        public void PushDownloadFile(string url, string saveFile, AssetBundleConfig config, HttpDownloadFinish finishCallback = null)
        {
            int index = -1;

            for (int i = 0; i < mDownloadTask.Count; i++)
            {
                if (mDownloadTask[i].url.Equals(url))
                {
                    index = i;

                    break;
                }
            }
            if (-1 != index)
            {
                if (mDownloadTask.Count > 1)
                {
                    HttpDownloadTask tmp = mDownloadTask[index];
                    mDownloadTask.RemoveAt(index);
                    mDownloadTask.Add(tmp);
                }
            }
            else if (null == mCurTask || !mCurTask.url.Equals(url))
            {
                HttpDownloadTask task = new HttpDownloadTask(url, saveFile, config, finishCallback);
                mDownloadTask.Add(task);
            }
        }