Esempio n. 1
0
        private void AddDownload(Downloader d)
        {
            string ext = System.IO.Path.GetExtension(d.LocalFile);

            DownLoadFileInfo dInfo = new DownLoadFileInfo();

            dInfo.FileName              = System.IO.Path.GetFileName(d.LocalFile);
            dInfo.FileSize              = ByteFormatter.ToString(d.FileSize);
            dInfo.DownloadProcess       = d.Progress;
            dInfo.FileLink              = d.ResourceLocation.URL;
            dInfo.FileAlbum             = d.ResourceLocation.Password;
            dInfo.DownloadState         = d.State;
            mapDownloadToObj[d]         = dInfo;
            mapObjToDownload[dInfo]     = d;
            mapObjToCurrentState[dInfo] = d.State;
            DownloadingList.Add(dInfo);
        }
        /// <summary>
        ///   下载
        /// </summary>
        bool Download(HttpAsyDownload d, string assetbundlename)
        {
            lock (lock_obj_)
            {
                if (string.IsNullOrEmpty(assetbundlename))
                {
                    return(false);
                }
                var ab = resources_manifest_.Find(assetbundlename);
                if (ab == null)
                {
                    Debug.LogWarning("AssetBundleDownloader.Download - AssetBundleName is invalid.");
                    return(true);
                }

                DownloadingList.Add(assetbundlename);

                string file_name = ab.IsCompress ? Compress.GetCompressFileName(assetbundlename) : assetbundlename;
                d.Start(Root, file_name, _DownloadNotify, _DownloadError);
                return(true);
            }
        }