void OnInitializeDownload(string path, List <string> assetbundles, ResourcesManifest manifest) { this.path = path; unCompleteDownloads = assetbundles; m_Manifest = manifest; isDone = false; errorCode = ErrorCode.None; completeDownloads.Clear(); failedDownloads.Clear(); if (unCompleteDownloads == null) { unCompleteDownloads = new List <string>(); } totalSize = 0; completedSize = 0; foreach (var item in unCompleteDownloads) { var ab = manifest.Find(item); if (ab == null) { continue; } totalSize += ab.size; } }
/// <summary> /// 启动下载 /// </summary> bool OnDownload(string assetbundleName) { lock (m_Lock) { var ab = m_Manifest.Find(assetbundleName); if (null == ab) { Debug.LogWarning(string.Format("AssetBundleName is invalid : {0}", assetbundleName)); return(true); } var fileName = assetbundleName; if (!IsDownLoading(fileName)) { var d = GetFreeDownload(); if (null == d) { return(false); } d.Start(path, fileName, OnDownloadNotify, OnDownloadError); } return(true); } }