This commit is contained in:
hevinci
2023-12-27 18:20:37 +08:00
parent 67b2b886a8
commit cbdb84a69f
12 changed files with 3 additions and 445 deletions
@@ -121,17 +121,6 @@ namespace YooAsset.Editor
return true;
}
/// <summary>
/// 判断是否为冗余资源
/// </summary>
public bool IsRedundancyAsset()
{
if (HasBundleName())
return false;
return _referenceBundleNames.Count > 1;
}
/// <summary>
/// 获取关联资源包的数量
/// </summary>
@@ -13,11 +13,6 @@ namespace YooAsset.Editor
/// </summary>
private readonly Dictionary<string, BuildBundleInfo> _bundleInfoDic = new Dictionary<string, BuildBundleInfo>(10000);
/// <summary>
/// 冗余的资源列表
/// </summary>
public readonly List<ReportRedundancyAsset> RedundancyInfos = new List<ReportRedundancyAsset>(1000);
/// <summary>
/// 未被依赖的资源列表
/// </summary>
@@ -107,8 +107,7 @@ namespace YooAsset.Editor
buildReport.BundleInfos.Add(reportBundleInfo);
}
// 资源列表
buildReport.RedundancyAssets = new List<ReportRedundancyAsset>(buildMapContext.RedundancyInfos);
// 其它资源列表
buildReport.IndependAssets = new List<ReportIndependAsset>(buildMapContext.IndependAssets);
// 序列化文件
@@ -102,22 +102,7 @@ namespace YooAsset.Editor
context.AssetFileCount = allBuildAssetInfos.Count;
context.Command = collectResult.Command;
// 8. 记录冗余资源
foreach (var buildAssetInfo in allBuildAssetInfos.Values)
{
if (buildAssetInfo.IsRedundancyAsset())
{
var redundancyAsset = new ReportRedundancyAsset();
redundancyAsset.AssetPath = buildAssetInfo.AssetInfo.AssetPath;
redundancyAsset.AssetGUID = buildAssetInfo.AssetInfo.AssetGUID;
redundancyAsset.AssetType = buildAssetInfo.AssetInfo.AssetType.ToString();
redundancyAsset.FileSize = FileUtility.GetFileSize(buildAssetInfo.AssetInfo.AssetPath);
redundancyAsset.Number = buildAssetInfo.GetReferenceBundleCount();
context.RedundancyInfos.Add(redundancyAsset);
}
}
// 9. 移除不参与构建的资源
// 8. 移除不参与构建的资源
List<BuildAssetInfo> removeBuildList = new List<BuildAssetInfo>();
foreach (var buildAssetInfo in allBuildAssetInfos.Values)
{
@@ -129,7 +114,7 @@ namespace YooAsset.Editor
allBuildAssetInfos.Remove(removeValue.AssetInfo.AssetPath);
}
// 10. 构建资源列表
// 9. 构建资源列表
var allPackAssets = allBuildAssetInfos.Values.ToList();
if (allPackAssets.Count == 0)
{