update resource package

pull/189/head
hevinci 2023-09-25 16:30:24 +08:00
parent 8fe2fa7bc6
commit eb98eaeb3b
7 changed files with 30 additions and 28 deletions

View File

@ -348,7 +348,7 @@ namespace YooAsset
}
internal List<BundleLoaderBase> CreateDependAssetBundleLoaders(AssetInfo assetInfo)
{
BundleInfo[] depends = _bundleQuery.GetAllDependBundleInfos(assetInfo);
BundleInfo[] depends = _bundleQuery.GetDependBundleInfos(assetInfo);
List<BundleLoaderBase> result = new List<BundleLoaderBase>(depends.Length);
foreach (var bundleInfo in depends)
{

View File

@ -11,7 +11,7 @@ namespace YooAsset
/// <summary>
/// 获取依赖的资源包信息集合
/// </summary>
BundleInfo[] GetAllDependBundleInfos(AssetInfo assetPath);
BundleInfo[] GetDependBundleInfos(AssetInfo assetPath);
/// <summary>
/// 清单是否有效

View File

@ -111,7 +111,7 @@ namespace YooAsset
var packageBundle = _activeManifest.GetMainPackageBundle(assetInfo.AssetPath);
return CreateBundleInfo(packageBundle, assetInfo);
}
BundleInfo[] IBundleQuery.GetAllDependBundleInfos(AssetInfo assetInfo)
BundleInfo[] IBundleQuery.GetDependBundleInfos(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
throw new Exception("Should never get here !");

View File

@ -366,7 +366,7 @@ namespace YooAsset
var packageBundle = _activeManifest.GetMainPackageBundle(assetInfo.AssetPath);
return CreateBundleInfo(packageBundle);
}
BundleInfo[] IBundleQuery.GetAllDependBundleInfos(AssetInfo assetInfo)
BundleInfo[] IBundleQuery.GetDependBundleInfos(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
throw new Exception("Should never get here !");

View File

@ -195,7 +195,7 @@ namespace YooAsset
var packageBundle = _activeManifest.GetMainPackageBundle(assetInfo.AssetPath);
return CreateBundleInfo(packageBundle);
}
BundleInfo[] IBundleQuery.GetAllDependBundleInfos(AssetInfo assetInfo)
BundleInfo[] IBundleQuery.GetDependBundleInfos(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
throw new Exception("Should never get here !");

View File

@ -144,7 +144,7 @@ namespace YooAsset
var packageBundle = _activeManifest.GetMainPackageBundle(assetInfo.AssetPath);
return CreateBundleInfo(packageBundle);
}
BundleInfo[] IBundleQuery.GetAllDependBundleInfos(AssetInfo assetInfo)
BundleInfo[] IBundleQuery.GetDependBundleInfos(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
throw new Exception("Should never get here !");

View File

@ -403,17 +403,7 @@ namespace YooAsset
{
DebugCheckInitialize();
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
if (assetInfo.IsInvalid)
{
YooLogger.Warning(assetInfo.Error);
return false;
}
BundleInfo bundleInfo = _bundleQuery.GetMainBundleInfo(assetInfo);
if (bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromRemote)
return true;
else
return false;
return IsNeedDownloadFromRemoteInternal(assetInfo);
}
/// <summary>
@ -423,17 +413,7 @@ namespace YooAsset
public bool IsNeedDownloadFromRemote(AssetInfo assetInfo)
{
DebugCheckInitialize();
if (assetInfo.IsInvalid)
{
YooLogger.Warning(assetInfo.Error);
return false;
}
BundleInfo bundleInfo = _bundleQuery.GetMainBundleInfo(assetInfo);
if (bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromRemote)
return true;
else
return false;
return IsNeedDownloadFromRemoteInternal(assetInfo);
}
/// <summary>
@ -487,6 +467,28 @@ namespace YooAsset
string assetPath = _playModeImpl.ActiveManifest.TryMappingToAssetPath(location);
return string.IsNullOrEmpty(assetPath) == false;
}
private bool IsNeedDownloadFromRemoteInternal(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
{
YooLogger.Warning(assetInfo.Error);
return false;
}
BundleInfo bundleInfo = _bundleQuery.GetMainBundleInfo(assetInfo);
if (bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromRemote)
return true;
BundleInfo[] depends = _bundleQuery.GetDependBundleInfos(assetInfo);
foreach (var depend in depends)
{
if (depend.LoadMode == BundleInfo.ELoadMode.LoadFromRemote)
return true;
}
return false;
}
#endregion
#region 原生文件