namespace YooAsset { internal class BundleInfo { private readonly IFileSystem _fileSystem; private readonly string _importFilePath; /// /// 资源包对象 /// public readonly PackageBundle Bundle; public BundleInfo(IFileSystem fileSystem, PackageBundle bundle) { _fileSystem = fileSystem; Bundle = bundle; _importFilePath = null; } public BundleInfo(IFileSystem fileSystem, PackageBundle bundle, string importFilePath) { _fileSystem = fileSystem; Bundle = bundle; _importFilePath = importFilePath; } /// /// 加载资源包 /// public FSLoadBundleOperation LoadBundleFile() { return _fileSystem.LoadBundleFile(Bundle); } /// /// 创建下载器 /// public FSDownloadFileOperation CreateDownloader(int failedTryAgain, int timeout) { DownloadFileOptions options = new DownloadFileOptions(failedTryAgain, timeout); options.ImportFilePath = _importFilePath; return _fileSystem.DownloadFileAsync(Bundle, options); } /// /// 是否需要从远端下载 /// public bool IsNeedDownloadFromRemote() { return _fileSystem.NeedDownload(Bundle); } /// /// 下载器合并识别码 /// public string GetDownloadCombineGUID() { return $"{_fileSystem.GetHashCode()}_{Bundle.BundleGUID}"; } } }