diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportAssetInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportAssetInfo.cs
index 1c03bc6..aef363d 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportAssetInfo.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportAssetInfo.cs
@@ -7,15 +7,31 @@ namespace YooAsset.Editor
[Serializable]
public class ReportAssetInfo
{
+ ///
+ /// 可寻址地址
+ ///
+ public string Address;
+
///
/// 资源路径
///
public string AssetPath;
+ ///
+ /// 资源GUID
+ /// 说明:Meta文件记录的GUID
+ ///
+ public string AssetGUID;
+
///
/// 所属资源包名称
///
- public string MainBundle;
+ public string MainBundleName;
+
+ ///
+ /// 所属资源包的大小
+ ///
+ public long MainBundleSize;
///
/// 依赖的资源包名称列表
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportBundleInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportBundleInfo.cs
index ee60316..b1e941a 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportBundleInfo.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportBundleInfo.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.Collections;
using System.Collections.Generic;
@@ -36,5 +37,13 @@ namespace YooAsset.Editor
/// Flags
///
public int Flags;
+
+ public string GetTagsString()
+ {
+ if (Tags != null)
+ return String.Join(";", Tags);
+ else
+ return string.Empty;
+ }
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs
index ed6600f..05832b5 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using UnityEditor;
namespace YooAsset.Editor
{
@@ -62,8 +63,11 @@ namespace YooAsset.Editor
{
var mainBundle = patchManifest.BundleList[patchAsset.BundleID];
ReportAssetInfo reportAssetInfo = new ReportAssetInfo();
+ reportAssetInfo.Address = patchAsset.Address;
reportAssetInfo.AssetPath = patchAsset.AssetPath;
- reportAssetInfo.MainBundle = mainBundle.BundleName;
+ reportAssetInfo.AssetGUID = AssetDatabase.AssetPathToGUID(patchAsset.AssetPath);
+ reportAssetInfo.MainBundleName = mainBundle.BundleName;
+ reportAssetInfo.MainBundleSize = mainBundle.SizeBytes;
reportAssetInfo.DependBundles = GetDependBundles(patchManifest, patchAsset);
reportAssetInfo.DependAssets = GetDependAssets(buildMapContext, mainBundle.BundleName, patchAsset.AssetPath);
buildReport.AssetInfos.Add(reportAssetInfo);
diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/AssetListReporterViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/AssetListReporterViewer.cs
index eedf7ce..9bda204 100644
--- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/AssetListReporterViewer.cs
+++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/AssetListReporterViewer.cs
@@ -1,5 +1,5 @@
#if UNITY_2019_4_OR_NEWER
-using System.IO;
+using System;
using System.Linq;
using System.Collections.Generic;
using UnityEditor;
@@ -11,18 +11,26 @@ namespace YooAsset.Editor
{
internal class AssetListReporterViewer
{
+ private enum ESortMode
+ {
+ AssetPath,
+ BundleName
+ }
+
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
private ToolbarButton _topBar1;
private ToolbarButton _topBar2;
- private ToolbarButton _topBar3;
private ToolbarButton _bottomBar1;
- private ToolbarButton _bottomBar2;
- private ToolbarButton _bottomBar3;
private ListView _assetListView;
private ListView _dependListView;
+
private BuildReport _buildReport;
+ private string _searchKeyWord;
+ private ESortMode _sortMode = ESortMode.AssetPath;
+ private bool _descendingSort = false;
+
///
/// 初始化页面
@@ -38,36 +46,40 @@ namespace YooAsset.Editor
Debug.LogError($"Not found {nameof(AssetListReporterViewer)}.uxml : {uxml}");
return;
}
- _root = _visualAsset.CloneTree();
- _root.style.flexGrow = 1f;
- // 顶部按钮栏
- _topBar1 = _root.Q("TopBar1");
- _topBar2 = _root.Q("TopBar2");
- _topBar3 = _root.Q("TopBar3");
- _topBar1.clicked += TopBar1_clicked;
- _topBar2.clicked += TopBar2_clicked;
- _topBar3.clicked += TopBar3_clicked;
+ try
+ {
+ _root = _visualAsset.CloneTree();
+ _root.style.flexGrow = 1f;
- // 底部按钮栏
- _bottomBar1 = _root.Q("BottomBar1");
- _bottomBar2 = _root.Q("BottomBar2");
- _bottomBar3 = _root.Q("BottomBar3");
-
- // 资源列表
- _assetListView = _root.Q("TopListView");
- _assetListView.makeItem = MakeAssetListViewItem;
- _assetListView.bindItem = BindAssetListViewItem;
+ // 顶部按钮栏
+ _topBar1 = _root.Q("TopBar1");
+ _topBar2 = _root.Q("TopBar2");
+ _topBar1.clicked += TopBar1_clicked;
+ _topBar2.clicked += TopBar2_clicked;
+ // 底部按钮栏
+ _bottomBar1 = _root.Q("BottomBar1");
+
+ // 资源列表
+ _assetListView = _root.Q("TopListView");
+ _assetListView.makeItem = MakeAssetListViewItem;
+ _assetListView.bindItem = BindAssetListViewItem;
#if UNITY_2020_1_OR_NEWER
- _assetListView.onSelectionChange += AssetListView_onSelectionChange;
+ _assetListView.onSelectionChange += AssetListView_onSelectionChange;
#else
- _assetListView.onSelectionChanged += AssetListView_onSelectionChange;
+ _assetListView.onSelectionChanged += AssetListView_onSelectionChange;
#endif
- // 依赖列表
- _dependListView = _root.Q("BottomListView");
- _dependListView.makeItem = MakeDependListViewItem;
- _dependListView.bindItem = BindDependListViewItem;
+
+ // 依赖列表
+ _dependListView = _root.Q("BottomListView");
+ _dependListView.makeItem = MakeDependListViewItem;
+ _dependListView.bindItem = BindDependListViewItem;
+ }
+ catch (Exception e)
+ {
+ Debug.LogError(e.ToString());
+ }
}
///
@@ -76,25 +88,76 @@ namespace YooAsset.Editor
public void FillViewData(BuildReport buildReport, string searchKeyWord)
{
_buildReport = buildReport;
+ _searchKeyWord = searchKeyWord;
+ RefreshView();
+ }
+ private void RefreshView()
+ {
_assetListView.Clear();
_assetListView.ClearSelection();
- _assetListView.itemsSource = FilterViewItems(buildReport, searchKeyWord);
+ _assetListView.itemsSource = FilterAndSortViewItems();
_assetListView.Rebuild();
- _topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count})";
+ RefreshSortingSymbol();
}
- private List FilterViewItems(BuildReport buildReport, string searchKeyWord)
+ private List FilterAndSortViewItems()
{
- List result = new List(buildReport.AssetInfos.Count);
- foreach (var assetInfo in buildReport.AssetInfos)
+ List result = new List(_buildReport.AssetInfos.Count);
+
+ // 过滤列表
+ foreach (var assetInfo in _buildReport.AssetInfos)
{
- if(string.IsNullOrEmpty(searchKeyWord) == false)
+ if (string.IsNullOrEmpty(_searchKeyWord) == false)
{
- if (assetInfo.AssetPath.Contains(searchKeyWord) == false)
- continue;
+ if (assetInfo.AssetPath.Contains(_searchKeyWord) == false)
+ continue;
}
result.Add(assetInfo);
}
- return result;
+
+ // 排序列表
+ if (_sortMode == ESortMode.AssetPath)
+ {
+ if (_descendingSort)
+ return result.OrderByDescending(a => a.AssetPath).ToList();
+ else
+ return result.OrderBy(a => a.AssetPath).ToList();
+ }
+ else if (_sortMode == ESortMode.BundleName)
+ {
+ if (_descendingSort)
+ return result.OrderByDescending(a => a.MainBundleName).ToList();
+ else
+ return result.OrderBy(a => a.MainBundleName).ToList();
+ }
+ else
+ {
+ throw new System.NotImplementedException();
+ }
+ }
+ private void RefreshSortingSymbol()
+ {
+ // 刷新符号
+ _topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count})";
+ _topBar2.text = "Main Bundle";
+
+ if (_sortMode == ESortMode.AssetPath)
+ {
+ if (_descendingSort)
+ _topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count}) ↓";
+ else
+ _topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count}) ↑";
+ }
+ else if (_sortMode == ESortMode.BundleName)
+ {
+ if (_descendingSort)
+ _topBar2.text = "Main Bundle ↓";
+ else
+ _topBar2.text = "Main Bundle ↑";
+ }
+ else
+ {
+ throw new System.NotImplementedException();
+ }
}
///
@@ -135,18 +198,8 @@ namespace YooAsset.Editor
label.name = "Label2";
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
- //label.style.flexGrow = 1f;
- label.style.width = 100;
- element.Add(label);
- }
-
- {
- var label = new Label();
- label.name = "Label3";
- label.style.unityTextAlign = TextAnchor.MiddleLeft;
- label.style.marginLeft = 3f;
label.style.flexGrow = 1f;
- label.style.width = 145;
+ label.style.width = 150;
element.Add(label);
}
@@ -156,19 +209,15 @@ namespace YooAsset.Editor
{
var sourceData = _assetListView.itemsSource as List;
var assetInfo = sourceData[index];
- var bundleInfo = _buildReport.GetBundleInfo(assetInfo.MainBundle);
+ var bundleInfo = _buildReport.GetBundleInfo(assetInfo.MainBundleName);
// Asset Path
var label1 = element.Q