mirror of https://github.com/tuyoogame/YooAsset
update asset bundle reporter
parent
a3ceb3dcb6
commit
d9c911d89b
|
@ -56,13 +56,13 @@ namespace YooAsset.Editor
|
|||
public string EncryptedFilePath { set; get; }
|
||||
#endregion
|
||||
|
||||
private readonly HashSet<string> _assetPaths = new HashSet<string>();
|
||||
private readonly Dictionary<string, BuildAssetInfo> _packAssetDic = new Dictionary<string, BuildAssetInfo>(100);
|
||||
|
||||
/// <summary>
|
||||
/// 参与构建的资源列表
|
||||
/// 注意:不包含零依赖资源和冗余资源
|
||||
/// </summary>
|
||||
public readonly List<BuildAssetInfo> MainAssets = new List<BuildAssetInfo>();
|
||||
public readonly List<BuildAssetInfo> AllPackAssets = new List<BuildAssetInfo>(100);
|
||||
|
||||
/// <summary>
|
||||
/// 资源包名称
|
||||
|
@ -86,51 +86,68 @@ namespace YooAsset.Editor
|
|||
public void PackAsset(BuildAssetInfo buildAsset)
|
||||
{
|
||||
string assetPath = buildAsset.AssetInfo.AssetPath;
|
||||
if (_assetPaths.Contains(assetPath))
|
||||
if (_packAssetDic.ContainsKey(assetPath))
|
||||
throw new System.Exception($"Should never get here ! Asset is existed : {assetPath}");
|
||||
|
||||
_assetPaths.Add(assetPath);
|
||||
MainAssets.Add(buildAsset);
|
||||
_packAssetDic.Add(assetPath, buildAsset);
|
||||
AllPackAssets.Add(buildAsset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否包含指定资源
|
||||
/// </summary>
|
||||
public bool IsContainsAsset(string assetPath)
|
||||
public bool IsContainsPackAsset(string assetPath)
|
||||
{
|
||||
return _assetPaths.Contains(assetPath);
|
||||
return _packAssetDic.ContainsKey(assetPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取构建的资源路径列表
|
||||
/// </summary>
|
||||
public string[] GetAllMainAssetPaths()
|
||||
public string[] GetAllPackAssetPaths()
|
||||
{
|
||||
return MainAssets.Select(t => t.AssetInfo.AssetPath).ToArray();
|
||||
return AllPackAssets.Select(t => t.AssetInfo.AssetPath).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取该资源包内的所有资源(包括零依赖资源和冗余资源)
|
||||
/// 获取构建的主资源信息
|
||||
/// </summary>
|
||||
public List<string> GetAllBuiltinAssetPaths()
|
||||
public BuildAssetInfo GetPackAssetInfo(string assetPath)
|
||||
{
|
||||
var packAssets = GetAllMainAssetPaths();
|
||||
List<string> result = new List<string>(packAssets);
|
||||
foreach (var buildAsset in MainAssets)
|
||||
if (_packAssetDic.TryGetValue(assetPath, out BuildAssetInfo value))
|
||||
{
|
||||
if (buildAsset.AllDependAssetInfos == null)
|
||||
continue;
|
||||
foreach (var dependAssetInfo in buildAsset.AllDependAssetInfos)
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Can not found pack asset info {assetPath} in bundle : {BundleName}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源包内部所有资产
|
||||
/// </summary>
|
||||
public List<AssetInfo> GetBundleContents()
|
||||
{
|
||||
Dictionary<string, AssetInfo> result = new Dictionary<string, AssetInfo>(AllPackAssets.Count);
|
||||
foreach (var packAsset in AllPackAssets)
|
||||
{
|
||||
result.Add(packAsset.AssetInfo.AssetPath, packAsset.AssetInfo);
|
||||
if (packAsset.AllDependAssetInfos != null)
|
||||
{
|
||||
// 注意:依赖资源里只添加零依赖资源和冗余资源
|
||||
if (dependAssetInfo.HasBundleName() == false)
|
||||
foreach (var dependAssetInfo in packAsset.AllDependAssetInfos)
|
||||
{
|
||||
if (result.Contains(dependAssetInfo.AssetInfo.AssetPath) == false)
|
||||
result.Add(dependAssetInfo.AssetInfo.AssetPath);
|
||||
// 注意:依赖资源里只添加零依赖资源和冗余资源
|
||||
if (dependAssetInfo.HasBundleName() == false)
|
||||
{
|
||||
string dependAssetPath = dependAssetInfo.AssetInfo.AssetPath;
|
||||
if (result.ContainsKey(dependAssetPath) == false)
|
||||
result.Add(dependAssetPath, dependAssetInfo.AssetInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return result.Values.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -142,7 +159,7 @@ namespace YooAsset.Editor
|
|||
AssetBundleBuild build = new AssetBundleBuild();
|
||||
build.assetBundleName = BundleName;
|
||||
build.assetBundleVariant = string.Empty;
|
||||
build.assetNames = GetAllMainAssetPaths();
|
||||
build.assetNames = GetAllPackAssetPaths();
|
||||
return build;
|
||||
}
|
||||
|
||||
|
@ -151,7 +168,7 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public BuildAssetInfo[] GetAllManifestAssetInfos()
|
||||
{
|
||||
return MainAssets.Where(t => t.CollectorType == ECollectorType.MainAssetCollector).ToArray();
|
||||
return AllPackAssets.Where(t => t.CollectorType == ECollectorType.MainAssetCollector).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace YooAsset.Editor
|
|||
|
||||
/// <summary>
|
||||
/// 怀旧版依赖模式
|
||||
/// 说明:兼容YooAssets1.5.x版本
|
||||
/// 说明:兼容YooAsset1.5.x版本
|
||||
/// </summary>
|
||||
public bool LegacyDependency = false;
|
||||
|
||||
|
|
|
@ -34,37 +34,35 @@ namespace YooAsset.Editor
|
|||
buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||
buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||
buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||
buildReport.Summary.IgnoreRuleName = buildMapContext.Command.IgnoreRule.GetType().FullName;
|
||||
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
||||
buildReport.Summary.IgnoreRuleName = buildMapContext.Command.IgnoreRule.GetType().FullName;
|
||||
|
||||
// 构建参数
|
||||
buildReport.Summary.LegacyDependency = buildParameters.LegacyDependency;
|
||||
buildReport.Summary.ClearBuildCacheFiles = buildParameters.ClearBuildCacheFiles;
|
||||
buildReport.Summary.UseAssetDependencyDB = buildParameters.UseAssetDependencyDB;
|
||||
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
||||
buildReport.Summary.SingleReferencedPackAlone = buildParameters.SingleReferencedPackAlone;
|
||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
||||
buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
||||
if (buildParameters.BuildPipeline == nameof(BuiltinBuildPipeline))
|
||||
if (buildParameters is BuiltinBuildParameters)
|
||||
{
|
||||
var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
|
||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
||||
buildReport.Summary.CompressOption = builtinBuildParameters.CompressOption;
|
||||
buildReport.Summary.DisableWriteTypeTree = builtinBuildParameters.DisableWriteTypeTree;
|
||||
buildReport.Summary.IgnoreTypeTreeChanges = builtinBuildParameters.IgnoreTypeTreeChanges;
|
||||
}
|
||||
else if (buildParameters.BuildPipeline == nameof(ScriptableBuildPipeline))
|
||||
else if (buildParameters is ScriptableBuildParameters)
|
||||
{
|
||||
var scriptableBuildParameters = buildParameters as ScriptableBuildParameters;
|
||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
||||
buildReport.Summary.CompressOption = scriptableBuildParameters.CompressOption;
|
||||
buildReport.Summary.DisableWriteTypeTree = scriptableBuildParameters.DisableWriteTypeTree;
|
||||
buildReport.Summary.IgnoreTypeTreeChanges = scriptableBuildParameters.IgnoreTypeTreeChanges;
|
||||
}
|
||||
else
|
||||
{
|
||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
||||
buildReport.Summary.CompressOption = ECompressOption.Uncompressed;
|
||||
buildReport.Summary.DisableWriteTypeTree = false;
|
||||
buildReport.Summary.IgnoreTypeTreeChanges = false;
|
||||
buildReport.Summary.WriteLinkXML = scriptableBuildParameters.WriteLinkXML;
|
||||
buildReport.Summary.CacheServerHost = scriptableBuildParameters.CacheServerHost;
|
||||
buildReport.Summary.CacheServerPort = scriptableBuildParameters.CacheServerPort;
|
||||
buildReport.Summary.BuiltinShadersBundleName = scriptableBuildParameters.BuiltinShadersBundleName;
|
||||
buildReport.Summary.MonoScriptsBundleName = scriptableBuildParameters.MonoScriptsBundleName;
|
||||
}
|
||||
|
||||
// 构建结果
|
||||
|
@ -88,7 +86,8 @@ namespace YooAsset.Editor
|
|||
reportAssetInfo.AssetGUID = AssetDatabase.AssetPathToGUID(packageAsset.AssetPath);
|
||||
reportAssetInfo.MainBundleName = mainBundle.BundleName;
|
||||
reportAssetInfo.MainBundleSize = mainBundle.FileSize;
|
||||
reportAssetInfo.DependAssets = GetDependAssets(buildMapContext, mainBundle.BundleName, packageAsset.AssetPath);
|
||||
reportAssetInfo.DependAssets = GetAssetDependAssets(buildMapContext, mainBundle.BundleName, packageAsset.AssetPath);
|
||||
reportAssetInfo.DependBundles = GetAssetDependBundles(manifest, packageAsset);
|
||||
buildReport.AssetInfos.Add(reportAssetInfo);
|
||||
}
|
||||
|
||||
|
@ -104,8 +103,9 @@ namespace YooAsset.Editor
|
|||
reportBundleInfo.FileSize = packageBundle.FileSize;
|
||||
reportBundleInfo.Encrypted = packageBundle.Encrypted;
|
||||
reportBundleInfo.Tags = packageBundle.Tags;
|
||||
reportBundleInfo.DependBundles = GetDependBundles(manifest, packageBundle);
|
||||
reportBundleInfo.AllBuiltinAssets = GetAllBuiltinAssets(buildMapContext, packageBundle.BundleName);
|
||||
reportBundleInfo.DependBundles = GetBundleDependBundles(manifest, packageBundle);
|
||||
reportBundleInfo.ReferenceBundles = GetBundleReferenceBundles(manifest, packageBundle);
|
||||
reportBundleInfo.BundleContents = GetBundleContents(buildMapContext, packageBundle.BundleName);
|
||||
buildReport.BundleInfos.Add(reportBundleInfo);
|
||||
}
|
||||
|
||||
|
@ -120,9 +120,40 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源对象依赖的所有资源包
|
||||
/// 获取资源对象依赖的其它所有资源
|
||||
/// </summary>
|
||||
private List<string> GetDependBundles(PackageManifest manifest, PackageBundle packageBundle)
|
||||
private List<AssetInfo> GetAssetDependAssets(BuildMapContext buildMapContext, string bundleName, string assetPath)
|
||||
{
|
||||
List<AssetInfo> result = new List<AssetInfo>();
|
||||
var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
|
||||
var assetInfo = bundleInfo.GetPackAssetInfo(assetPath);
|
||||
foreach (var dependAssetInfo in assetInfo.AllDependAssetInfos)
|
||||
{
|
||||
result.Add(dependAssetInfo.AssetInfo);
|
||||
}
|
||||
result.Sort();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源对象依赖的资源包集合
|
||||
/// </summary>
|
||||
private List<string> GetAssetDependBundles(PackageManifest manifest, PackageAsset packageAsset)
|
||||
{
|
||||
List<string> dependBundles = new List<string>(packageAsset.DependBundleIDs.Length);
|
||||
foreach (int index in packageAsset.DependBundleIDs)
|
||||
{
|
||||
string dependBundleName = manifest.BundleList[index].BundleName;
|
||||
dependBundles.Add(dependBundleName);
|
||||
}
|
||||
dependBundles.Sort();
|
||||
return dependBundles;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源包依赖的资源包集合
|
||||
/// </summary>
|
||||
private List<string> GetBundleDependBundles(PackageManifest manifest, PackageBundle packageBundle)
|
||||
{
|
||||
List<string> dependBundles = new List<string>(packageBundle.DependIDs.Length);
|
||||
foreach (int index in packageBundle.DependIDs)
|
||||
|
@ -135,42 +166,27 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源对象依赖的其它所有资源
|
||||
/// 获取引用该资源包的资源包集合
|
||||
/// </summary>
|
||||
private List<string> GetDependAssets(BuildMapContext buildMapContext, string bundleName, string assetPath)
|
||||
private List<string> GetBundleReferenceBundles(PackageManifest manifest, PackageBundle packageBundle)
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
|
||||
List<string> referenceBundles = new List<string>(packageBundle.ReferenceBundleIDs.Length);
|
||||
foreach (int index in packageBundle.ReferenceBundleIDs)
|
||||
{
|
||||
BuildAssetInfo findAssetInfo = null;
|
||||
foreach (var buildAsset in bundleInfo.MainAssets)
|
||||
{
|
||||
if (buildAsset.AssetInfo.AssetPath == assetPath)
|
||||
{
|
||||
findAssetInfo = buildAsset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (findAssetInfo == null)
|
||||
{
|
||||
throw new Exception($"Should never get here ! Not found asset {assetPath} in bunlde {bundleName}");
|
||||
}
|
||||
foreach (var dependAssetInfo in findAssetInfo.AllDependAssetInfos)
|
||||
{
|
||||
result.Add(dependAssetInfo.AssetInfo.AssetPath);
|
||||
}
|
||||
string dependBundleName = manifest.BundleList[index].BundleName;
|
||||
referenceBundles.Add(dependBundleName);
|
||||
}
|
||||
result.Sort();
|
||||
return result;
|
||||
referenceBundles.Sort();
|
||||
return referenceBundles;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取该资源包内的所有资源
|
||||
/// 获取资源包内部所有资产
|
||||
/// </summary>
|
||||
private List<string> GetAllBuiltinAssets(BuildMapContext buildMapContext, string bundleName)
|
||||
private List<AssetInfo> GetBundleContents(BuildMapContext buildMapContext, string bundleName)
|
||||
{
|
||||
var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
|
||||
List<string> result = bundleInfo.GetAllBuiltinAssetPaths();
|
||||
List<AssetInfo> result = bundleInfo.GetBundleContents();
|
||||
result.Sort();
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace YooAsset.Editor
|
|||
{
|
||||
long tempSize = 0;
|
||||
|
||||
var assetPaths = bundleInfo.GetAllMainAssetPaths();
|
||||
var assetPaths = bundleInfo.GetAllPackAssetPaths();
|
||||
foreach (var assetPath in assetPaths)
|
||||
{
|
||||
long size = FileUtility.GetFileSize(assetPath);
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace YooAsset.Editor
|
|||
foreach (var bundleInfo in buildMapContext.Collection)
|
||||
{
|
||||
string dest = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
|
||||
foreach (var buildAsset in bundleInfo.MainAssets)
|
||||
foreach (var buildAsset in bundleInfo.AllPackAssets)
|
||||
{
|
||||
EditorTools.CopyFile(buildAsset.AssetInfo.AssetPath, dest, true);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace YooAsset.Editor
|
|||
// 注意:原生文件资源包只能包含一个原生文件
|
||||
foreach (var bundleInfo in buildMapContext.Collection)
|
||||
{
|
||||
if (bundleInfo.MainAssets.Count != 1)
|
||||
if (bundleInfo.AllPackAssets.Count != 1)
|
||||
{
|
||||
string message = BuildLogger.GetErrorMessage(ErrorCode.NotSupportMultipleRawAsset, $"The bundle does not support multiple raw asset : {bundleInfo.BundleName}");
|
||||
throw new Exception(message);
|
||||
|
|
|
@ -39,8 +39,14 @@ namespace YooAsset.Editor
|
|||
public long MainBundleSize;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖的资源路径列表
|
||||
/// 依赖的资源集合
|
||||
/// </summary>
|
||||
public List<string> DependAssets = new List<string>();
|
||||
public List<AssetInfo> DependAssets = new List<AssetInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 依赖的资源包集合
|
||||
/// 说明:框架层收集查询结果
|
||||
/// </summary>
|
||||
public List<string> DependBundles = new List<string>();
|
||||
}
|
||||
}
|
|
@ -44,14 +44,21 @@ namespace YooAsset.Editor
|
|||
public string[] Tags;
|
||||
|
||||
/// <summary>
|
||||
/// 资源包的依赖集合
|
||||
/// 依赖的资源包集合
|
||||
/// 说明:引擎层构建查询结果
|
||||
/// </summary>
|
||||
public List<string> DependBundles;
|
||||
public List<string> DependBundles = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 该资源包内包含的所有资源
|
||||
/// 引用该资源包的资源包集合
|
||||
/// 说明:谁依赖该资源包
|
||||
/// </summary>
|
||||
public List<string> AllBuiltinAssets = new List<string>();
|
||||
public List<string> ReferenceBundles = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 资源包内部所有资产
|
||||
/// </summary>
|
||||
public List<AssetInfo> BundleContents = new List<AssetInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源分类标签的字符串
|
||||
|
|
|
@ -71,11 +71,19 @@ namespace YooAsset.Editor
|
|||
public bool ClearBuildCacheFiles;
|
||||
public bool UseAssetDependencyDB;
|
||||
public bool EnableSharePackRule;
|
||||
public bool SingleReferencedPackAlone;
|
||||
public string EncryptionClassName;
|
||||
public EFileNameStyle FileNameStyle;
|
||||
|
||||
// 引擎参数
|
||||
public ECompressOption CompressOption;
|
||||
public bool DisableWriteTypeTree;
|
||||
public bool IgnoreTypeTreeChanges;
|
||||
public bool WriteLinkXML = true;
|
||||
public string CacheServerHost;
|
||||
public int CacheServerPort;
|
||||
public string BuiltinShadersBundleName;
|
||||
public string MonoScriptsBundleName;
|
||||
|
||||
// 构建结果
|
||||
public int AssetFileTotalCount;
|
||||
|
|
|
@ -116,6 +116,7 @@ namespace YooAsset.Editor
|
|||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
columnStyle.Counter = true;
|
||||
var column = new TableColumn("DependBundles", "Depend Bundles", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
|
|
|
@ -320,15 +320,15 @@ namespace YooAsset.Editor
|
|||
sourceDatas.Add(rowData);
|
||||
}
|
||||
}
|
||||
foreach (string assetPath in bundleInfo.AllBuiltinAssets)
|
||||
foreach (var assetInfo in bundleInfo.BundleContents)
|
||||
{
|
||||
if (mainAssetDic.Contains(assetPath) == false)
|
||||
if (mainAssetDic.Contains(assetInfo.AssetPath) == false)
|
||||
{
|
||||
var rowData = new IncludeTableData();
|
||||
rowData.AssetInfo = null;
|
||||
rowData.AddAssetPathCell("IncludeAssets", assetPath);
|
||||
rowData.AddAssetPathCell("IncludeAssets", assetInfo.AssetPath);
|
||||
rowData.AddStringValueCell("AssetSource", "BuiltinAsset");
|
||||
rowData.AddStringValueCell("AssetGUID", "--");
|
||||
rowData.AddStringValueCell("AssetGUID", assetInfo.AssetGUID);
|
||||
sourceDatas.Add(rowData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,24 +11,9 @@ namespace YooAsset.Editor
|
|||
{
|
||||
internal class ReporterSummaryViewer
|
||||
{
|
||||
private class ItemWrapper
|
||||
{
|
||||
public string Title { private set; get; }
|
||||
public string Value { private set; get; }
|
||||
|
||||
public ItemWrapper(string title, string value)
|
||||
{
|
||||
Title = title;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
private VisualTreeAsset _visualAsset;
|
||||
private TemplateContainer _root;
|
||||
|
||||
private ListView _listView;
|
||||
private readonly List<ItemWrapper> _items = new List<ItemWrapper>();
|
||||
|
||||
private ScrollView _scrollView;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化页面
|
||||
|
@ -44,9 +29,7 @@ namespace YooAsset.Editor
|
|||
_root.style.flexGrow = 1f;
|
||||
|
||||
// 概述列表
|
||||
_listView = _root.Q<ListView>("ListView");
|
||||
_listView.makeItem = MakeListViewItem;
|
||||
_listView.bindItem = BindListViewItem;
|
||||
_scrollView = _root.Q<ScrollView>("ScrollView");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -54,53 +37,50 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public void FillViewData(BuildReport buildReport)
|
||||
{
|
||||
_items.Clear();
|
||||
_scrollView.Clear();
|
||||
|
||||
_items.Add(new ItemWrapper("YooAsset Version", buildReport.Summary.YooVersion));
|
||||
_items.Add(new ItemWrapper("UnityEngine Version", buildReport.Summary.UnityVersion));
|
||||
_items.Add(new ItemWrapper("Build Date", buildReport.Summary.BuildDate));
|
||||
_items.Add(new ItemWrapper("Build Seconds", ConvertTime(buildReport.Summary.BuildSeconds)));
|
||||
_items.Add(new ItemWrapper("Build Target", $"{buildReport.Summary.BuildTarget}"));
|
||||
_items.Add(new ItemWrapper("Build Pipeline", $"{buildReport.Summary.BuildPipeline}"));
|
||||
_items.Add(new ItemWrapper("Build Bundle Type", buildReport.Summary.BuildBundleType.ToString()));
|
||||
_items.Add(new ItemWrapper("Package Name", buildReport.Summary.BuildPackageName));
|
||||
_items.Add(new ItemWrapper("Package Version", buildReport.Summary.BuildPackageVersion));
|
||||
_items.Add(new ItemWrapper("Package Note", buildReport.Summary.BuildPackageNote));
|
||||
BindListViewHeader("Build Infos");
|
||||
BindListViewItem("YooAsset Version", buildReport.Summary.YooVersion);
|
||||
BindListViewItem("UnityEngine Version", buildReport.Summary.UnityVersion);
|
||||
BindListViewItem("Build Date", buildReport.Summary.BuildDate);
|
||||
BindListViewItem("Build Seconds", ConvertTime(buildReport.Summary.BuildSeconds));
|
||||
BindListViewItem("Build Target", $"{buildReport.Summary.BuildTarget}");
|
||||
BindListViewItem("Build Pipeline", $"{buildReport.Summary.BuildPipeline}");
|
||||
BindListViewItem("Build Bundle Type", buildReport.Summary.BuildBundleType.ToString());
|
||||
BindListViewItem("Package Name", buildReport.Summary.BuildPackageName);
|
||||
BindListViewItem("Package Version", buildReport.Summary.BuildPackageVersion);
|
||||
BindListViewItem("Package Note", buildReport.Summary.BuildPackageNote);
|
||||
BindListViewItem(string.Empty, string.Empty);
|
||||
|
||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
||||
_items.Add(new ItemWrapper("Collect Settings", string.Empty));
|
||||
_items.Add(new ItemWrapper("Unique Bundle Name", $"{buildReport.Summary.UniqueBundleName}"));
|
||||
_items.Add(new ItemWrapper("Enable Addressable", $"{buildReport.Summary.EnableAddressable}"));
|
||||
_items.Add(new ItemWrapper("Location To Lower", $"{buildReport.Summary.LocationToLower}"));
|
||||
_items.Add(new ItemWrapper("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}"));
|
||||
_items.Add(new ItemWrapper("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}"));
|
||||
_items.Add(new ItemWrapper("Ignore Rule Name", $"{buildReport.Summary.IgnoreRuleName}"));
|
||||
|
||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
||||
_items.Add(new ItemWrapper("Build Params", string.Empty));
|
||||
_items.Add(new ItemWrapper("Legacy Dependency Mode", $"{buildReport.Summary.LegacyDependency}"));
|
||||
_items.Add(new ItemWrapper("Clear Build Cache Files", $"{buildReport.Summary.ClearBuildCacheFiles}"));
|
||||
_items.Add(new ItemWrapper("Use Asset Dependency DB", $"{buildReport.Summary.UseAssetDependencyDB}"));
|
||||
_items.Add(new ItemWrapper("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}"));
|
||||
_items.Add(new ItemWrapper("Encryption Class Name", buildReport.Summary.EncryptionClassName));
|
||||
_items.Add(new ItemWrapper("FileNameStyle", $"{buildReport.Summary.FileNameStyle}"));
|
||||
_items.Add(new ItemWrapper("CompressOption", $"{buildReport.Summary.CompressOption}"));
|
||||
_items.Add(new ItemWrapper("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}"));
|
||||
_items.Add(new ItemWrapper("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}"));
|
||||
BindListViewHeader("Collect Settings");
|
||||
BindListViewItem("Unique Bundle Name", $"{buildReport.Summary.UniqueBundleName}");
|
||||
BindListViewItem("Enable Addressable", $"{buildReport.Summary.EnableAddressable}");
|
||||
BindListViewItem("Location To Lower", $"{buildReport.Summary.LocationToLower}");
|
||||
BindListViewItem("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}");
|
||||
BindListViewItem("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}");
|
||||
BindListViewItem("Ignore Rule Name", $"{buildReport.Summary.IgnoreRuleName}");
|
||||
BindListViewItem(string.Empty, string.Empty);
|
||||
|
||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
||||
_items.Add(new ItemWrapper("Build Results", string.Empty));
|
||||
_items.Add(new ItemWrapper("Asset File Total Count", $"{buildReport.Summary.AssetFileTotalCount}"));
|
||||
_items.Add(new ItemWrapper("Main Asset Total Count", $"{buildReport.Summary.MainAssetTotalCount}"));
|
||||
_items.Add(new ItemWrapper("All Bundle Total Count", $"{buildReport.Summary.AllBundleTotalCount}"));
|
||||
_items.Add(new ItemWrapper("All Bundle Total Size", ConvertSize(buildReport.Summary.AllBundleTotalSize)));
|
||||
_items.Add(new ItemWrapper("Encrypted Bundle Total Count", $"{buildReport.Summary.EncryptedBundleTotalCount}"));
|
||||
_items.Add(new ItemWrapper("Encrypted Bundle Total Size", ConvertSize(buildReport.Summary.EncryptedBundleTotalSize)));
|
||||
BindListViewHeader("Build Params");
|
||||
BindListViewItem("Legacy Dependency Mode", $"{buildReport.Summary.LegacyDependency}");
|
||||
BindListViewItem("Clear Build Cache Files", $"{buildReport.Summary.ClearBuildCacheFiles}");
|
||||
BindListViewItem("Use Asset Dependency DB", $"{buildReport.Summary.UseAssetDependencyDB}");
|
||||
BindListViewItem("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}");
|
||||
BindListViewItem("Single Referenced Pack Alone", $"{buildReport.Summary.SingleReferencedPackAlone}");
|
||||
BindListViewItem("Encryption Class Name", buildReport.Summary.EncryptionClassName);
|
||||
BindListViewItem("FileNameStyle", $"{buildReport.Summary.FileNameStyle}");
|
||||
BindListViewItem("CompressOption", $"{buildReport.Summary.CompressOption}");
|
||||
BindListViewItem("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}");
|
||||
BindListViewItem("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}");
|
||||
BindListViewItem(string.Empty, string.Empty);
|
||||
|
||||
_listView.Clear();
|
||||
_listView.ClearSelection();
|
||||
_listView.itemsSource = _items;
|
||||
_listView.Rebuild();
|
||||
BindListViewHeader("Build Results");
|
||||
BindListViewItem("Asset File Total Count", $"{buildReport.Summary.AssetFileTotalCount}");
|
||||
BindListViewItem("Main Asset Total Count", $"{buildReport.Summary.MainAssetTotalCount}");
|
||||
BindListViewItem("All Bundle Total Count", $"{buildReport.Summary.AllBundleTotalCount}");
|
||||
BindListViewItem("All Bundle Total Size", ConvertSize(buildReport.Summary.AllBundleTotalSize));
|
||||
BindListViewItem("Encrypted Bundle Total Count", $"{buildReport.Summary.EncryptedBundleTotalCount}");
|
||||
BindListViewItem("Encrypted Bundle Total Size", ConvertSize(buildReport.Summary.EncryptedBundleTotalSize));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -120,45 +100,60 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
// 列表相关
|
||||
private void BindListViewHeader(string titile)
|
||||
{
|
||||
Toolbar toolbar = new Toolbar();
|
||||
_scrollView.Add(toolbar);
|
||||
|
||||
ToolbarButton titleButton = new ToolbarButton();
|
||||
titleButton.text = titile;
|
||||
titleButton.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
titleButton.style.width = 200;
|
||||
toolbar.Add(titleButton);
|
||||
|
||||
ToolbarButton valueButton = new ToolbarButton();
|
||||
valueButton.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
valueButton.style.width = 150;
|
||||
valueButton.style.flexShrink = 1;
|
||||
valueButton.style.flexGrow = 1;
|
||||
valueButton.SetEnabled(false);
|
||||
toolbar.Add(valueButton);
|
||||
}
|
||||
private void BindListViewItem(string name, string value)
|
||||
{
|
||||
VisualElement element = MakeListViewItem();
|
||||
_scrollView.Add(element);
|
||||
|
||||
// Title
|
||||
var titleLabel = element.Q<Label>("TitleLabel");
|
||||
titleLabel.text = name;
|
||||
|
||||
// Value
|
||||
var valueLabel = element.Q<Label>("ValueLabel");
|
||||
valueLabel.text = value;
|
||||
}
|
||||
private VisualElement MakeListViewItem()
|
||||
{
|
||||
VisualElement element = new VisualElement();
|
||||
element.style.flexDirection = FlexDirection.Row;
|
||||
|
||||
{
|
||||
var label = new Label();
|
||||
label.name = "Label1";
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
label.style.marginLeft = 3f;
|
||||
//label.style.flexGrow = 1f;
|
||||
label.style.width = 200;
|
||||
element.Add(label);
|
||||
}
|
||||
var titleLabel = new Label();
|
||||
titleLabel.name = "TitleLabel";
|
||||
titleLabel.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
titleLabel.style.marginLeft = 3f;
|
||||
titleLabel.style.width = 200;
|
||||
element.Add(titleLabel);
|
||||
|
||||
{
|
||||
var label = new Label();
|
||||
label.name = "Label2";
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
label.style.marginLeft = 3f;
|
||||
label.style.flexGrow = 1f;
|
||||
label.style.width = 150;
|
||||
element.Add(label);
|
||||
}
|
||||
var valueLabel = new Label();
|
||||
valueLabel.name = "ValueLabel";
|
||||
valueLabel.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
valueLabel.style.marginLeft = 3f;
|
||||
valueLabel.style.flexGrow = 1f;
|
||||
valueLabel.style.width = 150;
|
||||
element.Add(valueLabel);
|
||||
|
||||
return element;
|
||||
}
|
||||
private void BindListViewItem(VisualElement element, int index)
|
||||
{
|
||||
var itemWrapper = _items[index];
|
||||
|
||||
// Title
|
||||
var label1 = element.Q<Label>("Label1");
|
||||
label1.text = itemWrapper.Title;
|
||||
|
||||
// Value
|
||||
var label2 = element.Q<Label>("Label2");
|
||||
label2.text = itemWrapper.Value;
|
||||
}
|
||||
|
||||
private string ConvertTime(int time)
|
||||
{
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
|
||||
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
|
||||
<uie:Toolbar name="TopBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
|
||||
<uie:ToolbarButton text="Info" display-tooltip-when-elided="true" name="TopBar1" style="width: 200px; -unity-text-align: middle-left; flex-grow: 0;" />
|
||||
<uie:ToolbarButton text="Param" display-tooltip-when-elided="true" name="TopBar2" style="width: 150px; -unity-text-align: middle-left; flex-grow: 1;" />
|
||||
</uie:Toolbar>
|
||||
<ui:ListView focusable="true" name="ListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
|
||||
<ui:ScrollView name="ScrollView" horizontal-scroller-visibility="Hidden" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Collections.Generic;
|
|||
namespace YooAsset.Editor
|
||||
{
|
||||
[Serializable]
|
||||
public class AssetInfo
|
||||
public class AssetInfo : IComparable<AssetInfo>
|
||||
{
|
||||
private string _fileExtension = null;
|
||||
|
||||
|
@ -37,6 +37,7 @@ namespace YooAsset.Editor
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public AssetInfo(string assetPath)
|
||||
{
|
||||
AssetPath = assetPath;
|
||||
|
@ -60,5 +61,10 @@ namespace YooAsset.Editor
|
|||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public int CompareTo(AssetInfo other)
|
||||
{
|
||||
return this.AssetPath.CompareTo(other.AssetPath);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,6 +41,11 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public bool Sortable = false;
|
||||
|
||||
/// <summary>
|
||||
/// 统计数量
|
||||
/// </summary>
|
||||
public bool Counter = false;
|
||||
|
||||
public ColumnStyle(Length width)
|
||||
{
|
||||
if (width.value > MaxValue)
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace YooAsset.Editor
|
|||
|
||||
// 定义标题栏
|
||||
_toolbar = new Toolbar();
|
||||
|
||||
|
||||
// 定义列表视图
|
||||
_listView = new ListView();
|
||||
_listView.style.flexShrink = 1f;
|
||||
|
@ -191,6 +191,16 @@ namespace YooAsset.Editor
|
|||
_listView.ClearSelection();
|
||||
_listView.itemsSource = itemsSource.ToList();
|
||||
_listView.Rebuild();
|
||||
|
||||
// 动态设置元素数量
|
||||
foreach (var column in _columns)
|
||||
{
|
||||
if (column.ColumnStyle.Counter)
|
||||
{
|
||||
var toobarButton = GetHeaderElement(column.ElementName) as ToolbarButton;
|
||||
toobarButton.text = $"{column.HeaderTitle} ({itemsSource.Count()})";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue