update asset bundle builder

报告文件内增加资源包内嵌的资源列表
This commit is contained in:
hevinci
2023-03-13 19:36:17 +08:00
parent d60b0ea0ea
commit c9b775d8ff
6 changed files with 64 additions and 26 deletions
@@ -51,7 +51,7 @@ namespace YooAsset.Editor
/// 参与构建的资源列表
/// 注意:不包含零依赖资源
/// </summary>
public readonly List<BuildAssetInfo> BuildinAssets = new List<BuildAssetInfo>();
public readonly List<BuildAssetInfo> AllMainAssets = new List<BuildAssetInfo>();
/// <summary>
/// 补丁文件信息
@@ -76,9 +76,9 @@ namespace YooAsset.Editor
{
get
{
foreach (var asset in BuildinAssets)
foreach (var assetInfo in AllMainAssets)
{
if (asset.IsRawAsset)
if (assetInfo.IsRawAsset)
return true;
}
return false;
@@ -113,7 +113,7 @@ namespace YooAsset.Editor
if (IsContainsAsset(assetInfo.AssetPath))
throw new System.Exception($"Asset is existed : {assetInfo.AssetPath}");
BuildinAssets.Add(assetInfo);
AllMainAssets.Add(assetInfo);
}
/// <summary>
@@ -121,7 +121,7 @@ namespace YooAsset.Editor
/// </summary>
public bool IsContainsAsset(string assetPath)
{
foreach (var assetInfo in BuildinAssets)
foreach (var assetInfo in AllMainAssets)
{
if (assetInfo.AssetPath == assetPath)
{
@@ -136,8 +136,8 @@ namespace YooAsset.Editor
/// </summary>
public string[] GetBundleTags()
{
List<string> result = new List<string>(BuildinAssets.Count);
foreach (var assetInfo in BuildinAssets)
List<string> result = new List<string>(AllMainAssets.Count);
foreach (var assetInfo in AllMainAssets)
{
foreach (var assetTag in assetInfo.BundleTags)
{
@@ -148,20 +148,43 @@ namespace YooAsset.Editor
return result.ToArray();
}
/// <summary>
/// 获取该资源包内的所有资源(包括零依赖资源)
/// </summary>
public List<string> GetAllBuiltinAssetPaths()
{
var packAssets = GetAllMainAssetPaths();
List<string> result = new List<string>(packAssets);
foreach (var assetInfo in AllMainAssets)
{
if (assetInfo.AllDependAssetInfos == null)
continue;
foreach (var depend in assetInfo.AllDependAssetInfos)
{
if (depend.HasBundleName() == false)
{
if (result.Contains(depend.AssetPath) == false)
result.Add(depend.AssetPath);
}
}
}
return result;
}
/// <summary>
/// 获取构建的资源路径列表
/// </summary>
public string[] GetBuildinAssetPaths()
public string[] GetAllMainAssetPaths()
{
return BuildinAssets.Select(t => t.AssetPath).ToArray();
return AllMainAssets.Select(t => t.AssetPath).ToArray();
}
/// <summary>
/// 获取所有写入补丁清单的资源
/// </summary>
public BuildAssetInfo[] GetAllBuildAssetInfos()
public BuildAssetInfo[] GetAllMainAssetInfos()
{
return BuildinAssets.Where(t => t.CollectorType == ECollectorType.MainAssetCollector).ToArray();
return AllMainAssets.Where(t => t.CollectorType == ECollectorType.MainAssetCollector).ToArray();
}
/// <summary>
@@ -173,7 +196,7 @@ namespace YooAsset.Editor
AssetBundleBuild build = new AssetBundleBuild();
build.assetBundleName = BundleName;
build.assetBundleVariant = string.Empty;
build.assetNames = GetBuildinAssetPaths();
build.assetNames = GetAllMainAssetPaths();
return build;
}