From 3652f2af314601be4744e516d76018c83a0849b2 Mon Sep 17 00:00:00 2001 From: hevinci Date: Sat, 19 Mar 2022 00:42:44 +0800 Subject: [PATCH] Update AssetBundleReporter --- .../AssetBundleReporterWindow.cs | 60 +++++++++---------- .../VisualViewers/SummaryReporterViewer.cs | 49 +++++++++++---- .../VisualViewers/SummaryReporterViewer.uxml | 4 +- 3 files changed, 69 insertions(+), 44 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs b/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs index 2e64bd0..c42d5ad 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs @@ -17,9 +17,9 @@ namespace YooAsset.Editor } /// - /// 显示模式 + /// 视口模式 /// - private enum EShowMode + private enum EViewMode { /// /// 概览 @@ -29,20 +29,20 @@ namespace YooAsset.Editor /// /// 资源对象列表显示模式 /// - AssetList, + AssetView, /// /// 资源包列表显示模式 /// - BundleList, + BundleView, } - private ToolbarMenu _showModeMenu; + private ToolbarMenu _viewModeMenu; private SummaryReporterViewer _summaryViewer; private AssetListReporterViewer _assetListViewer; private BundleListReporterViewer _bundleListViewer; - private EShowMode _showMode; + private EViewMode _viewMode; private string _searchKeyWord; private BuildReport _buildReport; @@ -67,10 +67,10 @@ namespace YooAsset.Editor importBtn.clicked += ImportBtn_onClick; // 显示模式菜单 - _showModeMenu = root.Q("ShowModeMenu"); - _showModeMenu.menu.AppendAction(EShowMode.Summary.ToString(), ShowModeMenuAction0, ShowModeMenuFun0); - _showModeMenu.menu.AppendAction(EShowMode.AssetList.ToString(), ShowModeMenuAction1, ShowModeMenuFun1); - _showModeMenu.menu.AppendAction(EShowMode.BundleList.ToString(), ShowModeMenuAction2, ShowModeMenuFun2); + _viewModeMenu = root.Q("ShowModeMenu"); + _viewModeMenu.menu.AppendAction(EViewMode.Summary.ToString(), ViewModeMenuAction0, ViewModeMenuFun0); + _viewModeMenu.menu.AppendAction(EViewMode.AssetView.ToString(), ViewModeMenuAction1, ViewModeMenuFun1); + _viewModeMenu.menu.AppendAction(EViewMode.BundleView.ToString(), ViewModeMenuAction2, ViewModeMenuFun2); // 搜索栏 var searchField = root.Q("SearchField"); @@ -89,8 +89,8 @@ namespace YooAsset.Editor _bundleListViewer.InitViewer(); // 初始页面 - _showMode = EShowMode.Summary; - _showModeMenu.text = EShowMode.Summary.ToString(); + _viewMode = EViewMode.Summary; + _viewModeMenu.text = EViewMode.Summary.ToString(); _summaryViewer.AttachParent(root); } @@ -115,59 +115,59 @@ namespace YooAsset.Editor _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; - _showModeMenu.text = EShowMode.Summary.ToString(); + _viewModeMenu.text = EViewMode.Summary.ToString(); _summaryViewer.AttachParent(root); _assetListViewer.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; - _showModeMenu.text = EShowMode.AssetList.ToString(); + _viewModeMenu.text = EViewMode.AssetView.ToString(); _summaryViewer.DetachParent(); _assetListViewer.AttachParent(root); _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; - _showModeMenu.text = EShowMode.BundleList.ToString(); + _viewModeMenu.text = EViewMode.BundleView.ToString(); _summaryViewer.DetachParent(); _assetListViewer.DetachParent(); _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; else 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; else 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; else return DropdownMenuAction.Status.Normal; diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/SummaryReporterViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/SummaryReporterViewer.cs index 9315d79..08adfb7 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/SummaryReporterViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/SummaryReporterViewer.cs @@ -68,21 +68,34 @@ namespace YooAsset.Editor _items.Add(new ItemWrapper("构建耗时", $"{buildReport.Summary.BuildSeconds}秒")); _items.Add(new ItemWrapper("构建平台", $"{buildReport.Summary.BuildTarget}")); _items.Add(new ItemWrapper("构建版本", $"{buildReport.Summary.BuildVersion}")); - - _items.Add(new ItemWrapper("开启自动分包", $"{buildReport.Summary.ApplyRedundancy}")); - _items.Add(new ItemWrapper("开启资源包后缀名", $"{buildReport.Summary.AppendFileExtension}")); - - _items.Add(new ItemWrapper("自动收集着色器", $"{buildReport.Summary.IsCollectAllShaders}")); + _items.Add(new ItemWrapper("启用自动分包机制", $"{buildReport.Summary.EnableAutoCollect}")); + _items.Add(new ItemWrapper("追加文件扩展名", $"{buildReport.Summary.AppendFileExtension}")); + _items.Add(new ItemWrapper("自动收集着色器", $"{buildReport.Summary.AutoCollectShaders}")); _items.Add(new ItemWrapper("着色器资源包名称", $"{buildReport.Summary.ShadersBundleName}")); - _items.Add(new ItemWrapper("高级构建选项", $"---------------------------------")); - _items.Add(new ItemWrapper("IsForceRebuild", $"{buildReport.Summary.IsForceRebuild}")); + _items.Add(new ItemWrapper(string.Empty, string.Empty)); + _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("CompressOption", $"{buildReport.Summary.CompressOption}")); - _items.Add(new ItemWrapper("IsAppendHash", $"{buildReport.Summary.IsAppendHash}")); - _items.Add(new ItemWrapper("IsDisableWriteTypeTree", $"{buildReport.Summary.IsDisableWriteTypeTree}")); - _items.Add(new ItemWrapper("IsIgnoreTypeTreeChanges", $"{buildReport.Summary.IsIgnoreTypeTreeChanges}")); - _items.Add(new ItemWrapper("IsDisableLoadAssetByFileName", $"{buildReport.Summary.IsDisableLoadAssetByFileName}")); + _items.Add(new ItemWrapper("AppendHash", $"{buildReport.Summary.AppendHash}")); + _items.Add(new ItemWrapper("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}")); + _items.Add(new ItemWrapper("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}")); + _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; } /// @@ -113,7 +126,7 @@ namespace YooAsset.Editor label.style.unityTextAlign = TextAnchor.MiddleLeft; label.style.marginLeft = 3f; //label.style.flexGrow = 1f; - label.style.width = 100; + label.style.width = 200; element.Add(label); } @@ -141,6 +154,18 @@ namespace YooAsset.Editor var label2 = element.Q