refactor : 重构代码

This commit is contained in:
何冠峰
2026-01-17 18:44:48 +08:00
parent e10888de93
commit 0a1c81faf1
75 changed files with 219 additions and 197 deletions
@@ -114,7 +114,7 @@ namespace YooAsset
var fileSystem = GetBelongFileSystem(packageBundle);
if (fileSystem != null)
{
BundleInfo bundleInfo = new BundleInfo(fileSystem, packageBundle);
var bundleInfo = new BundleInfo(fileSystem, packageBundle);
return bundleInfo;
}
@@ -209,9 +209,9 @@ namespace YooAsset
{
List<BundleInfo> downloadList;
if (options.Tags == null)
downloadList = GetBundleListByAll(manifest, NeedDownload);
downloadList = GetBundleInfoListByAll(manifest, NeedDownload);
else
downloadList = GetBundleListByTags(manifest, options.Tags, NeedDownload);
downloadList = GetBundleInfoListByTags(manifest, options.Tags, NeedDownload);
var operation = new ResourceDownloaderOperation(PackageName, downloadList, options.MaximumConcurrency, options.FailedTryAgain);
return operation;
@@ -225,9 +225,9 @@ namespace YooAsset
{
List<BundleInfo> downloadList;
if (options.AssetInfos == null)
downloadList = GetBundleListByAll(manifest, NeedDownload);
downloadList = GetBundleInfoListByAll(manifest, NeedDownload);
else
downloadList = GetBundleListByAssetInfos(manifest, options.AssetInfos, options.DownloadBundleDependencies, NeedDownload);
downloadList = GetBundleInfoListByAssetInfos(manifest, options.AssetInfos, options.DownloadBundleDependencies, NeedDownload);
var operation = new ResourceDownloaderOperation(PackageName, downloadList, options.MaximumConcurrency, options.FailedTryAgain);
return operation;
@@ -241,9 +241,9 @@ namespace YooAsset
{
List<BundleInfo> unpackList;
if (options.Tags == null)
unpackList = GetBundleListByAll(manifest, NeedUnpack);
unpackList = GetBundleInfoListByAll(manifest, NeedUnpack);
else
unpackList = GetBundleListByTags(manifest, options.Tags, NeedUnpack);
unpackList = GetBundleInfoListByTags(manifest, options.Tags, NeedUnpack);
var operation = new ResourceUnpackerOperation(PackageName, unpackList, options.MaximumConcurrency, options.FailedTryAgain);
return operation;
@@ -255,12 +255,12 @@ namespace YooAsset
}
public ResourceImporterOperation CreateResourceImporter(PackageManifest manifest, BundleImporterOptions options)
{
List<BundleInfo> importerList = GetBundleListByBundleInfos(manifest, options.BundleInfos, NeedImport);
List<BundleInfo> importerList = GetBundleInfoListByBundleInfos(manifest, options.BundleInfos, NeedImport);
var operation = new ResourceImporterOperation(PackageName, importerList, options.MaximumConcurrency, options.FailedTryAgain);
return operation;
}
private List<BundleInfo> GetBundleListByAll(PackageManifest manifest, Func<IFileSystem, PackageBundle, bool> predicate)
private List<BundleInfo> GetBundleInfoListByAll(PackageManifest manifest, Func<IFileSystem, PackageBundle, bool> predicate)
{
if (manifest == null)
return new List<BundleInfo>();
@@ -280,7 +280,7 @@ namespace YooAsset
}
return result;
}
private List<BundleInfo> GetBundleListByTags(PackageManifest manifest, string[] tags, Func<IFileSystem, PackageBundle, bool> predicate)
private List<BundleInfo> GetBundleInfoListByTags(PackageManifest manifest, string[] tags, Func<IFileSystem, PackageBundle, bool> predicate)
{
if (manifest == null)
return new List<BundleInfo>();
@@ -312,7 +312,7 @@ namespace YooAsset
}
return result;
}
private List<BundleInfo> GetBundleListByAssetInfos(PackageManifest manifest, AssetInfo[] assetInfos, bool recursiveDepend, Func<IFileSystem, PackageBundle, bool> predicate)
private List<BundleInfo> GetBundleInfoListByAssetInfos(PackageManifest manifest, AssetInfo[] assetInfos, bool recursiveDepend, Func<IFileSystem, PackageBundle, bool> predicate)
{
if (manifest == null)
return new List<BundleInfo>();
@@ -387,7 +387,7 @@ namespace YooAsset
}
return result;
}
private List<BundleInfo> GetBundleListByBundleInfos(PackageManifest manifest, ImportBundleInfo[] fileInfos, Func<IFileSystem, PackageBundle, bool> predicate)
private List<BundleInfo> GetBundleInfoListByBundleInfos(PackageManifest manifest, ImportBundleInfo[] fileInfos, Func<IFileSystem, PackageBundle, bool> predicate)
{
if (manifest == null)
return new List<BundleInfo>();