pull/186/head^2
hevinci 2023-09-25 16:21:02 +08:00
parent dcdf41b7c2
commit 6fc45a758c
1 changed files with 24 additions and 22 deletions

View File

@ -368,17 +368,7 @@ namespace YooAsset
{
DebugCheckInitialize();
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
if (assetInfo.IsInvalid)
{
YooLogger.Warning(assetInfo.Error);
return false;
}
BundleInfo bundleInfo = _bundleServices.GetBundleInfo(assetInfo);
if (bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromRemote)
return true;
else
return false;
return IsNeedDownloadFromRemoteInternal(assetInfo);
}
/// <summary>
@ -388,17 +378,7 @@ namespace YooAsset
public bool IsNeedDownloadFromRemote(AssetInfo assetInfo)
{
DebugCheckInitialize();
if (assetInfo.IsInvalid)
{
YooLogger.Warning(assetInfo.Error);
return false;
}
BundleInfo bundleInfo = _bundleServices.GetBundleInfo(assetInfo);
if (bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromRemote)
return true;
else
return false;
return IsNeedDownloadFromRemoteInternal(assetInfo);
}
/// <summary>
@ -452,6 +432,28 @@ namespace YooAsset
string assetPath = _playModeServices.ActiveManifest.TryMappingToAssetPath(location);
return string.IsNullOrEmpty(assetPath) == false;
}
private bool IsNeedDownloadFromRemoteInternal(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
{
YooLogger.Warning(assetInfo.Error);
return false;
}
BundleInfo bundleInfo = _bundleServices.GetBundleInfo(assetInfo);
if (bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromRemote)
return true;
BundleInfo[] depends = _bundleServices.GetAllDependBundleInfos(assetInfo);
foreach (var depend in depends)
{
if (depend.LoadMode == BundleInfo.ELoadMode.LoadFromRemote)
return true;
}
return false;
}
#endregion
#region 原生文件