コード例 #1
0
        private IEnumerator Download(WebFileDownloader downloader)
        {
            downloader.OnError    += DownloadError;
            downloader.OnComplete += DownloadComplete;

            downloaderLoadings.Add(downloader);
            yield return(downloader.Start());
        }
コード例 #2
0
 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));
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        private IEnumerator DownloaderStart(WebFileDownloader downloader)
        {
            yield return(new WaitForSeconds(3.0f));

            yield return(downloader.Start());
        }
コード例 #5
0
 private void DownloadError(WebFileDownloader downloader)
 {
     //Debug.LogError("[DownloaderMnanager] DownloadError");
     StartCoroutine(DownloaderStart(downloader));
 }