Update AssetBundleReporter

pull/4/head
hevinci 2022-03-27 19:59:34 +08:00
parent 2d39b9ab2b
commit ee5840dc63
3 changed files with 19 additions and 19 deletions

View File

@ -1,6 +1,6 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True"> <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<uie:Toolbar name="Toolbar" style="display: flex;"> <uie:Toolbar name="Toolbar" style="display: flex;">
<uie:ToolbarMenu display-tooltip-when-elided="true" name="ShowModeMenu" text="ShowMode" style="width: 100px; flex-grow: 0;" /> <uie:ToolbarMenu display-tooltip-when-elided="true" name="ViewModeMenu" text="ViewMode" style="width: 100px; flex-grow: 0;" />
<uie:ToolbarSearchField focusable="true" name="SearchField" style="width: 300px; flex-grow: 1;" /> <uie:ToolbarSearchField focusable="true" name="SearchField" style="width: 300px; flex-grow: 1;" />
<ui:Button text="导入" display-tooltip-when-elided="true" name="ImportButton" style="width: 50px; background-color: rgb(56, 147, 58);" /> <ui:Button text="导入" display-tooltip-when-elided="true" name="ImportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
</uie:Toolbar> </uie:Toolbar>

View File

@ -17,22 +17,22 @@ namespace YooAsset.Editor
} }
/// <summary> /// <summary>
/// 视模式 /// 视模式
/// </summary> /// </summary>
private enum EViewMode private enum EViewMode
{ {
/// <summary> /// <summary>
/// 概览 /// 概览视图
/// </summary> /// </summary>
Summary, Summary,
/// <summary> /// <summary>
/// 资源对象列表显示模式 /// 资源对象视图
/// </summary> /// </summary>
AssetView, AssetView,
/// <summary> /// <summary>
/// 资源包列表显示模式 /// 资源包视图
/// </summary> /// </summary>
BundleView, BundleView,
} }
@ -66,8 +66,8 @@ namespace YooAsset.Editor
var importBtn = root.Q<Button>("ImportButton"); var importBtn = root.Q<Button>("ImportButton");
importBtn.clicked += ImportBtn_onClick; importBtn.clicked += ImportBtn_onClick;
// 显示模式菜单 // 视图模式菜单
_viewModeMenu = root.Q<ToolbarMenu>("ShowModeMenu"); _viewModeMenu = root.Q<ToolbarMenu>("ViewModeMenu");
_viewModeMenu.menu.AppendAction(EViewMode.Summary.ToString(), ViewModeMenuAction0, ViewModeMenuFun0); _viewModeMenu.menu.AppendAction(EViewMode.Summary.ToString(), ViewModeMenuAction0, ViewModeMenuFun0);
_viewModeMenu.menu.AppendAction(EViewMode.AssetView.ToString(), ViewModeMenuAction1, ViewModeMenuFun1); _viewModeMenu.menu.AppendAction(EViewMode.AssetView.ToString(), ViewModeMenuAction1, ViewModeMenuFun1);
_viewModeMenu.menu.AppendAction(EViewMode.BundleView.ToString(), ViewModeMenuAction2, ViewModeMenuFun2); _viewModeMenu.menu.AppendAction(EViewMode.BundleView.ToString(), ViewModeMenuAction2, ViewModeMenuFun2);
@ -76,19 +76,19 @@ namespace YooAsset.Editor
var searchField = root.Q<ToolbarSearchField>("SearchField"); var searchField = root.Q<ToolbarSearchField>("SearchField");
searchField.RegisterValueChangedCallback(OnSearchKeyWordChange); searchField.RegisterValueChangedCallback(OnSearchKeyWordChange);
// 加载页面 // 加载视图
_summaryViewer = new SummaryReporterViewer(); _summaryViewer = new SummaryReporterViewer();
_summaryViewer.InitViewer(); _summaryViewer.InitViewer();
// 加载页面 // 加载视图
_assetListViewer = new AssetListReporterViewer(); _assetListViewer = new AssetListReporterViewer();
_assetListViewer.InitViewer(); _assetListViewer.InitViewer();
// 加载页面 // 加载视图
_bundleListViewer = new BundleListReporterViewer(); _bundleListViewer = new BundleListReporterViewer();
_bundleListViewer.InitViewer(); _bundleListViewer.InitViewer();
// 初始页面 // 显示视图
_viewMode = EViewMode.Summary; _viewMode = EViewMode.Summary;
_viewModeMenu.text = EViewMode.Summary.ToString(); _viewModeMenu.text = EViewMode.Summary.ToString();
_summaryViewer.AttachParent(root); _summaryViewer.AttachParent(root);

View File

@ -67,8 +67,8 @@ namespace YooAsset.Editor
// 包含列表 // 包含列表
_includeListView = _root.Q<ListView>("BottomListView"); _includeListView = _root.Q<ListView>("BottomListView");
_includeListView.makeItem = MakeContainsListViewItem; _includeListView.makeItem = MakeIncludeListViewItem;
_includeListView.bindItem = BindContainsListViewItem; _includeListView.bindItem = BindIncludeListViewItem;
} }
/// <summary> /// <summary>
@ -113,7 +113,7 @@ namespace YooAsset.Editor
} }
// 资源列表相关 // 顶部列表相关
private VisualElement MakeBundleListViewItem() private VisualElement MakeBundleListViewItem()
{ {
VisualElement element = new VisualElement(); VisualElement element = new VisualElement();
@ -201,12 +201,12 @@ namespace YooAsset.Editor
foreach (var item in objs) foreach (var item in objs)
{ {
ReportBundleInfo bundleInfo = item as ReportBundleInfo; ReportBundleInfo bundleInfo = item as ReportBundleInfo;
FillContainsListView(bundleInfo); FillIncludeListView(bundleInfo);
} }
} }
// 依赖列表相关 // 底部列表相关
private void FillContainsListView(ReportBundleInfo bundleInfo) private void FillIncludeListView(ReportBundleInfo bundleInfo)
{ {
List<string> containsList = new List<string>(); List<string> containsList = new List<string>();
foreach (var assetInfo in _buildReport.AssetInfos) foreach (var assetInfo in _buildReport.AssetInfos)
@ -222,7 +222,7 @@ namespace YooAsset.Editor
_includeListView.itemsSource = containsList; _includeListView.itemsSource = containsList;
_bottomBar1.text = $"Include Assets ({containsList.Count})"; _bottomBar1.text = $"Include Assets ({containsList.Count})";
} }
private VisualElement MakeContainsListViewItem() private VisualElement MakeIncludeListViewItem()
{ {
VisualElement element = new VisualElement(); VisualElement element = new VisualElement();
element.style.flexDirection = FlexDirection.Row; element.style.flexDirection = FlexDirection.Row;
@ -259,7 +259,7 @@ namespace YooAsset.Editor
return element; return element;
} }
private void BindContainsListViewItem(VisualElement element, int index) private void BindIncludeListViewItem(VisualElement element, int index)
{ {
List<string> containsList = _includeListView.itemsSource as List<string>; List<string> containsList = _includeListView.itemsSource as List<string>;
string assetPath = containsList[index]; string assetPath = containsList[index];