private IEnumerator Download(WebFileDownloader downloader) { downloader.OnError += DownloadError; downloader.OnComplete += DownloadComplete; downloaderLoadings.Add(downloader); yield return(downloader.Start()); }
private void DownloadComplete(WebFileDownloader d) { d.OnError -= DownloadError; d.OnComplete -= DownloadComplete; downloaderLoadings.Remove(d); if (downloaderLoadings.Count < MAX_COUNT && downloaderWaitings.Count > 0) { WebFileDownloader n = downloaderWaitings.Dequeue(); downloadMananger.StartCoroutine(downloadMananger.Download(n)); } }
public static WebFileDownloader StartDownload(string url, string filePath) { if (downloadMananger == null) { GameObject downloadObject = new GameObject("DownloadObject"); downloadMananger = downloadObject.AddComponent <DownloadManager>(); } WebFileDownloader downloader = new WebFileDownloader(url, filePath); if (downloaderLoadings.Count >= MAX_COUNT) { downloaderWaitings.Enqueue(downloader); } else { downloadMananger.StartCoroutine(downloadMananger.Download(downloader)); } return(downloader); }
private IEnumerator DownloaderStart(WebFileDownloader downloader) { yield return(new WaitForSeconds(3.0f)); yield return(downloader.Start()); }
private void DownloadError(WebFileDownloader downloader) { //Debug.LogError("[DownloaderMnanager] DownloadError"); StartCoroutine(DownloaderStart(downloader)); }