refactor : 重构代码

This commit is contained in:
何冠峰
2026-01-16 14:37:04 +08:00
parent 611ac886b3
commit 3e3661ad95
18 changed files with 258 additions and 309 deletions
@@ -285,7 +285,7 @@ namespace YooAsset
{
DebugCheckInitialize();
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
return IsNeedDownloadFromRemoteInternal(assetInfo);
return _fileSystemHost.IsNeedDownloadFromRemoteInternal(assetInfo);
}
/// <summary>
@@ -295,7 +295,7 @@ namespace YooAsset
public bool IsNeedDownloadFromRemote(AssetInfo assetInfo)
{
DebugCheckInitialize();
return IsNeedDownloadFromRemoteInternal(assetInfo);
return _fileSystemHost.IsNeedDownloadFromRemoteInternal(assetInfo);
}
/// <summary>
@@ -380,28 +380,6 @@ namespace YooAsset
string assetPath = _fileSystemHost.ActiveManifest.TryMappingToAssetPath(location);
return string.IsNullOrEmpty(assetPath) == false;
}
private bool IsNeedDownloadFromRemoteInternal(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
{
YooLogger.Warning(assetInfo.Error);
return false;
}
BundleInfo bundleInfo = _fileSystemHost.GetMainBundleInfo(assetInfo);
if (bundleInfo.IsNeedDownloadFromRemote())
return true;
List<BundleInfo> depends = _fileSystemHost.GetDependBundleInfos(assetInfo);
foreach (var depend in depends)
{
if (depend.IsNeedDownloadFromRemote())
return true;
}
return false;
}
#endregion
#region 原生文件
@@ -866,11 +844,11 @@ namespace YooAsset
DebugCheckInitialize();
return _fileSystemHost.CreateResourceDownloader(options);
}
/// <summary>
/// 创建资源下载器,用于下载指定的资源信息列表依赖的资源包文件
/// </summary>
public ResourceDownloaderOperation CreateBundleDownloader(BundleDownloaderOptions options)
public ResourceDownloaderOperation CreateResourceDownloader(BundleDownloaderOptions options)
{
DebugCheckInitialize();
return _fileSystemHost.CreateResourceDownloader(options);