using System; using System.Collections; using System.Collections.Generic; using System.Threading; using Cysharp.Threading.Tasks; using UnityEngine; namespace AssetBundleHub { public interface IFileDownloader { UniTask Run(IDownloadRequestContext context, CancellationToken cancellationToken = default(CancellationToken)); } /// /// AssetBundleListのダウンロード用 /// AssetBundleのダウンロードには使用しない。 /// 差し替えOK /// public class FileDownloader : IFileDownloader { readonly Func> next; public FileDownloader() { this.next = InvokeRecursive; } public async UniTask Run(IDownloadRequestContext context, CancellationToken cancellationToken = default) { return await InvokeRecursive(context, cancellationToken); } UniTask InvokeRecursive(IDownloadRequestContext context, CancellationToken cancellationToken) { return context.GetNextDecorator().DownloadAsync(context, cancellationToken, next); } } }