mirror of https://github.com/tuyoogame/YooAsset
Update AssetBundleReporter
parent
473e52c5ba
commit
3652f2af31
|
@ -17,9 +17,9 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示模式
|
/// 视口模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private enum EShowMode
|
private enum EViewMode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 概览
|
/// 概览
|
||||||
|
@ -29,20 +29,20 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源对象列表显示模式
|
/// 资源对象列表显示模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AssetList,
|
AssetView,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源包列表显示模式
|
/// 资源包列表显示模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BundleList,
|
BundleView,
|
||||||
}
|
}
|
||||||
|
|
||||||
private ToolbarMenu _showModeMenu;
|
private ToolbarMenu _viewModeMenu;
|
||||||
private SummaryReporterViewer _summaryViewer;
|
private SummaryReporterViewer _summaryViewer;
|
||||||
private AssetListReporterViewer _assetListViewer;
|
private AssetListReporterViewer _assetListViewer;
|
||||||
private BundleListReporterViewer _bundleListViewer;
|
private BundleListReporterViewer _bundleListViewer;
|
||||||
|
|
||||||
private EShowMode _showMode;
|
private EViewMode _viewMode;
|
||||||
private string _searchKeyWord;
|
private string _searchKeyWord;
|
||||||
private BuildReport _buildReport;
|
private BuildReport _buildReport;
|
||||||
|
|
||||||
|
@ -67,10 +67,10 @@ namespace YooAsset.Editor
|
||||||
importBtn.clicked += ImportBtn_onClick;
|
importBtn.clicked += ImportBtn_onClick;
|
||||||
|
|
||||||
// 显示模式菜单
|
// 显示模式菜单
|
||||||
_showModeMenu = root.Q<ToolbarMenu>("ShowModeMenu");
|
_viewModeMenu = root.Q<ToolbarMenu>("ShowModeMenu");
|
||||||
_showModeMenu.menu.AppendAction(EShowMode.Summary.ToString(), ShowModeMenuAction0, ShowModeMenuFun0);
|
_viewModeMenu.menu.AppendAction(EViewMode.Summary.ToString(), ViewModeMenuAction0, ViewModeMenuFun0);
|
||||||
_showModeMenu.menu.AppendAction(EShowMode.AssetList.ToString(), ShowModeMenuAction1, ShowModeMenuFun1);
|
_viewModeMenu.menu.AppendAction(EViewMode.AssetView.ToString(), ViewModeMenuAction1, ViewModeMenuFun1);
|
||||||
_showModeMenu.menu.AppendAction(EShowMode.BundleList.ToString(), ShowModeMenuAction2, ShowModeMenuFun2);
|
_viewModeMenu.menu.AppendAction(EViewMode.BundleView.ToString(), ViewModeMenuAction2, ViewModeMenuFun2);
|
||||||
|
|
||||||
// 搜索栏
|
// 搜索栏
|
||||||
var searchField = root.Q<ToolbarSearchField>("SearchField");
|
var searchField = root.Q<ToolbarSearchField>("SearchField");
|
||||||
|
@ -89,8 +89,8 @@ namespace YooAsset.Editor
|
||||||
_bundleListViewer.InitViewer();
|
_bundleListViewer.InitViewer();
|
||||||
|
|
||||||
// 初始页面
|
// 初始页面
|
||||||
_showMode = EShowMode.Summary;
|
_viewMode = EViewMode.Summary;
|
||||||
_showModeMenu.text = EShowMode.Summary.ToString();
|
_viewModeMenu.text = EViewMode.Summary.ToString();
|
||||||
_summaryViewer.AttachParent(root);
|
_summaryViewer.AttachParent(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,59 +115,59 @@ namespace YooAsset.Editor
|
||||||
_bundleListViewer.FillViewData(_buildReport, _searchKeyWord);
|
_bundleListViewer.FillViewData(_buildReport, _searchKeyWord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ShowModeMenuAction0(DropdownMenuAction action)
|
private void ViewModeMenuAction0(DropdownMenuAction action)
|
||||||
{
|
{
|
||||||
if (_showMode != EShowMode.Summary)
|
if (_viewMode != EViewMode.Summary)
|
||||||
{
|
{
|
||||||
_showMode = EShowMode.Summary;
|
_viewMode = EViewMode.Summary;
|
||||||
VisualElement root = this.rootVisualElement;
|
VisualElement root = this.rootVisualElement;
|
||||||
_showModeMenu.text = EShowMode.Summary.ToString();
|
_viewModeMenu.text = EViewMode.Summary.ToString();
|
||||||
_summaryViewer.AttachParent(root);
|
_summaryViewer.AttachParent(root);
|
||||||
_assetListViewer.DetachParent();
|
_assetListViewer.DetachParent();
|
||||||
_bundleListViewer.DetachParent();
|
_bundleListViewer.DetachParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ShowModeMenuAction1(DropdownMenuAction action)
|
private void ViewModeMenuAction1(DropdownMenuAction action)
|
||||||
{
|
{
|
||||||
if (_showMode != EShowMode.AssetList)
|
if (_viewMode != EViewMode.AssetView)
|
||||||
{
|
{
|
||||||
_showMode = EShowMode.AssetList;
|
_viewMode = EViewMode.AssetView;
|
||||||
VisualElement root = this.rootVisualElement;
|
VisualElement root = this.rootVisualElement;
|
||||||
_showModeMenu.text = EShowMode.AssetList.ToString();
|
_viewModeMenu.text = EViewMode.AssetView.ToString();
|
||||||
_summaryViewer.DetachParent();
|
_summaryViewer.DetachParent();
|
||||||
_assetListViewer.AttachParent(root);
|
_assetListViewer.AttachParent(root);
|
||||||
_bundleListViewer.DetachParent();
|
_bundleListViewer.DetachParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ShowModeMenuAction2(DropdownMenuAction action)
|
private void ViewModeMenuAction2(DropdownMenuAction action)
|
||||||
{
|
{
|
||||||
if (_showMode != EShowMode.BundleList)
|
if (_viewMode != EViewMode.BundleView)
|
||||||
{
|
{
|
||||||
_showMode = EShowMode.BundleList;
|
_viewMode = EViewMode.BundleView;
|
||||||
VisualElement root = this.rootVisualElement;
|
VisualElement root = this.rootVisualElement;
|
||||||
_showModeMenu.text = EShowMode.BundleList.ToString();
|
_viewModeMenu.text = EViewMode.BundleView.ToString();
|
||||||
_summaryViewer.DetachParent();
|
_summaryViewer.DetachParent();
|
||||||
_assetListViewer.DetachParent();
|
_assetListViewer.DetachParent();
|
||||||
_bundleListViewer.AttachParent(root);
|
_bundleListViewer.AttachParent(root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private DropdownMenuAction.Status ShowModeMenuFun0(DropdownMenuAction action)
|
private DropdownMenuAction.Status ViewModeMenuFun0(DropdownMenuAction action)
|
||||||
{
|
{
|
||||||
if (_showMode == EShowMode.Summary)
|
if (_viewMode == EViewMode.Summary)
|
||||||
return DropdownMenuAction.Status.Checked;
|
return DropdownMenuAction.Status.Checked;
|
||||||
else
|
else
|
||||||
return DropdownMenuAction.Status.Normal;
|
return DropdownMenuAction.Status.Normal;
|
||||||
}
|
}
|
||||||
private DropdownMenuAction.Status ShowModeMenuFun1(DropdownMenuAction action)
|
private DropdownMenuAction.Status ViewModeMenuFun1(DropdownMenuAction action)
|
||||||
{
|
{
|
||||||
if (_showMode == EShowMode.AssetList)
|
if (_viewMode == EViewMode.AssetView)
|
||||||
return DropdownMenuAction.Status.Checked;
|
return DropdownMenuAction.Status.Checked;
|
||||||
else
|
else
|
||||||
return DropdownMenuAction.Status.Normal;
|
return DropdownMenuAction.Status.Normal;
|
||||||
}
|
}
|
||||||
private DropdownMenuAction.Status ShowModeMenuFun2(DropdownMenuAction action)
|
private DropdownMenuAction.Status ViewModeMenuFun2(DropdownMenuAction action)
|
||||||
{
|
{
|
||||||
if (_showMode == EShowMode.BundleList)
|
if (_viewMode == EViewMode.BundleView)
|
||||||
return DropdownMenuAction.Status.Checked;
|
return DropdownMenuAction.Status.Checked;
|
||||||
else
|
else
|
||||||
return DropdownMenuAction.Status.Normal;
|
return DropdownMenuAction.Status.Normal;
|
||||||
|
|
|
@ -68,21 +68,34 @@ namespace YooAsset.Editor
|
||||||
_items.Add(new ItemWrapper("构建耗时", $"{buildReport.Summary.BuildSeconds}秒"));
|
_items.Add(new ItemWrapper("构建耗时", $"{buildReport.Summary.BuildSeconds}秒"));
|
||||||
_items.Add(new ItemWrapper("构建平台", $"{buildReport.Summary.BuildTarget}"));
|
_items.Add(new ItemWrapper("构建平台", $"{buildReport.Summary.BuildTarget}"));
|
||||||
_items.Add(new ItemWrapper("构建版本", $"{buildReport.Summary.BuildVersion}"));
|
_items.Add(new ItemWrapper("构建版本", $"{buildReport.Summary.BuildVersion}"));
|
||||||
|
_items.Add(new ItemWrapper("启用自动分包机制", $"{buildReport.Summary.EnableAutoCollect}"));
|
||||||
_items.Add(new ItemWrapper("开启自动分包", $"{buildReport.Summary.ApplyRedundancy}"));
|
_items.Add(new ItemWrapper("追加文件扩展名", $"{buildReport.Summary.AppendFileExtension}"));
|
||||||
_items.Add(new ItemWrapper("开启资源包后缀名", $"{buildReport.Summary.AppendFileExtension}"));
|
_items.Add(new ItemWrapper("自动收集着色器", $"{buildReport.Summary.AutoCollectShaders}"));
|
||||||
|
|
||||||
_items.Add(new ItemWrapper("自动收集着色器", $"{buildReport.Summary.IsCollectAllShaders}"));
|
|
||||||
_items.Add(new ItemWrapper("着色器资源包名称", $"{buildReport.Summary.ShadersBundleName}"));
|
_items.Add(new ItemWrapper("着色器资源包名称", $"{buildReport.Summary.ShadersBundleName}"));
|
||||||
|
|
||||||
_items.Add(new ItemWrapper("高级构建选项", $"---------------------------------"));
|
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
||||||
_items.Add(new ItemWrapper("IsForceRebuild", $"{buildReport.Summary.IsForceRebuild}"));
|
_items.Add(new ItemWrapper("构建参数", string.Empty));
|
||||||
|
_items.Add(new ItemWrapper("ForceRebuild", $"{buildReport.Summary.ForceRebuild}"));
|
||||||
_items.Add(new ItemWrapper("BuildinTags", $"{buildReport.Summary.BuildinTags}"));
|
_items.Add(new ItemWrapper("BuildinTags", $"{buildReport.Summary.BuildinTags}"));
|
||||||
_items.Add(new ItemWrapper("CompressOption", $"{buildReport.Summary.CompressOption}"));
|
_items.Add(new ItemWrapper("CompressOption", $"{buildReport.Summary.CompressOption}"));
|
||||||
_items.Add(new ItemWrapper("IsAppendHash", $"{buildReport.Summary.IsAppendHash}"));
|
_items.Add(new ItemWrapper("AppendHash", $"{buildReport.Summary.AppendHash}"));
|
||||||
_items.Add(new ItemWrapper("IsDisableWriteTypeTree", $"{buildReport.Summary.IsDisableWriteTypeTree}"));
|
_items.Add(new ItemWrapper("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}"));
|
||||||
_items.Add(new ItemWrapper("IsIgnoreTypeTreeChanges", $"{buildReport.Summary.IsIgnoreTypeTreeChanges}"));
|
_items.Add(new ItemWrapper("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}"));
|
||||||
_items.Add(new ItemWrapper("IsDisableLoadAssetByFileName", $"{buildReport.Summary.IsDisableLoadAssetByFileName}"));
|
_items.Add(new ItemWrapper("DisableLoadAssetByFileName", $"{buildReport.Summary.DisableLoadAssetByFileName}"));
|
||||||
|
|
||||||
|
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
||||||
|
_items.Add(new ItemWrapper("构建结果", string.Empty));
|
||||||
|
_items.Add(new ItemWrapper("构建文件总数", $"{buildReport.Summary.AssetFileTotalCount}"));
|
||||||
|
_items.Add(new ItemWrapper("资源包总数", $"{buildReport.Summary.AllBundleTotalCount}"));
|
||||||
|
_items.Add(new ItemWrapper("资源包总大小", ConvertSize(buildReport.Summary.AllBundleTotalSize)));
|
||||||
|
_items.Add(new ItemWrapper("内置资源包总数", $"{buildReport.Summary.BuildinBundleTotalCount}"));
|
||||||
|
_items.Add(new ItemWrapper("内置资源包总大小", ConvertSize(buildReport.Summary.BuildinBundleTotalSize)));
|
||||||
|
_items.Add(new ItemWrapper("加密资源包总数", $"{buildReport.Summary.EncryptedBundleTotalCount}"));
|
||||||
|
_items.Add(new ItemWrapper("加密资源包总大小", ConvertSize(buildReport.Summary.EncryptedBundleTotalSize)));
|
||||||
|
_items.Add(new ItemWrapper("原生资源包总数", $"{buildReport.Summary.RawBundleTotalCount}"));
|
||||||
|
_items.Add(new ItemWrapper("原生资源包总大小", ConvertSize(buildReport.Summary.RawBundleTotalSize)));
|
||||||
|
|
||||||
|
_listView.itemsSource = _items;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -113,7 +126,7 @@ namespace YooAsset.Editor
|
||||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
label.style.marginLeft = 3f;
|
label.style.marginLeft = 3f;
|
||||||
//label.style.flexGrow = 1f;
|
//label.style.flexGrow = 1f;
|
||||||
label.style.width = 100;
|
label.style.width = 200;
|
||||||
element.Add(label);
|
element.Add(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +154,18 @@ namespace YooAsset.Editor
|
||||||
var label2 = element.Q<Label>("Label2");
|
var label2 = element.Q<Label>("Label2");
|
||||||
label2.text = itemWrapper.Value;
|
label2.text = itemWrapper.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string ConvertSize(long size)
|
||||||
|
{
|
||||||
|
if (size == 0)
|
||||||
|
return "0";
|
||||||
|
if (size < 1024)
|
||||||
|
return $"{size} Bytes";
|
||||||
|
else if (size < 1024 * 1024)
|
||||||
|
return $"{(int)(size / 1024)} KB";
|
||||||
|
else
|
||||||
|
return $"{(int)(size / (1024 * 1024))} MB";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -1,7 +1,7 @@
|
||||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
<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;">
|
<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:Toolbar name="TopBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
|
||||||
<uie:ToolbarButton text="概览" display-tooltip-when-elided="true" name="TopBar1" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
|
<uie:ToolbarButton text="概览" display-tooltip-when-elided="true" name="TopBar1" style="width: 200px; -unity-text-align: middle-left; flex-grow: 0;" />
|
||||||
<uie:ToolbarButton text="参数" display-tooltip-when-elided="true" name="TopBar2" style="width: 150px; -unity-text-align: middle-left; flex-grow: 1;" />
|
<uie:ToolbarButton text="参数" display-tooltip-when-elided="true" name="TopBar2" style="width: 150px; -unity-text-align: middle-left; flex-grow: 1;" />
|
||||||
</uie:Toolbar>
|
</uie:Toolbar>
|
||||||
<ui:ListView focusable="true" name="ListView" item-height="18" style="flex-grow: 1;" />
|
<ui:ListView focusable="true" name="ListView" item-height="18" style="flex-grow: 1;" />
|
||||||
|
|
Loading…
Reference in New Issue