modify bundleViewer func

mlyDevMerge1.5.7
YGP 2023-07-27 16:06:09 +08:00 committed by QiJing
parent 9ff6984289
commit 6a2b031d90
4 changed files with 46 additions and 17 deletions

View File

@ -12,29 +12,29 @@ namespace YooAsset.Editor
{
internal class ReporterBundleListViewer
{
private enum ESortMode
protected enum ESortMode
{
BundleName,
BundleSize,
BundleTags
}
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
protected VisualTreeAsset _visualAsset;
protected TemplateContainer _root;
private ToolbarButton _topBar1;
private ToolbarButton _topBar2;
private ToolbarButton _topBar3;
private ToolbarButton _topBar5;
private ToolbarButton _bottomBar1;
private ListView _bundleListView;
private ListView _includeListView;
protected ToolbarButton _topBar1;
protected ToolbarButton _topBar2;
protected ToolbarButton _topBar3;
protected ToolbarButton _topBar5;
protected ToolbarButton _bottomBar1;
protected ListView _bundleListView;
protected ListView _includeListView;
private BuildReport _buildReport;
private string _reportFilePath;
private string _searchKeyWord;
private ESortMode _sortMode = ESortMode.BundleName;
private bool _descendingSort = false;
protected BuildReport _buildReport;
protected string _reportFilePath;
protected string _searchKeyWord;
protected ESortMode _sortMode = ESortMode.BundleName;
protected bool _descendingSort = false;
/// <summary>
/// 初始化页面
@ -349,10 +349,24 @@ namespace YooAsset.Editor
private void FillIncludeListView(ReportBundleInfo bundleInfo)
{
List<ReportAssetInfo> containsList = new List<ReportAssetInfo>();
Dictionary<string, int> tempAssetDict = new Dictionary<string, int>();
foreach (var assetInfo in _buildReport.AssetInfos)
{
if (assetInfo.MainBundleName == bundleInfo.BundleName)
{
tempAssetDict.Add(assetInfo.AssetPath, 1);
containsList.Add(assetInfo);
}
}
foreach (string includeInAsset in bundleInfo.AllBuiltinAssets)
{
if (!tempAssetDict.ContainsKey(includeInAsset))
{
var assetInfo = new ReportAssetInfo();
assetInfo.AssetPath = includeInAsset;
assetInfo.AssetGUID = "--";
containsList.Add(assetInfo);
}
}
_includeListView.Clear();
@ -376,6 +390,16 @@ namespace YooAsset.Editor
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 = 200;
element.Add(label);
}
{
var label = new Label();
label.name = "Label2";
@ -397,6 +421,10 @@ namespace YooAsset.Editor
var label1 = element.Q<Label>("Label1");
label1.text = assetInfo.AssetPath;
// Asset Source
var label3 = element.Q<Label>("Label3");
label3.text = assetInfo.AssetGUID != "--" ? "Main Asset" : "Include Asset";
// GUID
var label2 = element.Q<Label>("Label2");
label2.text = assetInfo.AssetGUID;

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a0319abb8eae03b4b88e8f900fe2276c
guid: 8875000dff445624da4d6a2d6ef2f446
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -12,6 +12,7 @@
<ui:VisualElement name="BottomGroup" style="height: 200px; 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: 1px; margin-bottom: 1px; display: flex;">
<uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
<uie:ToolbarButton text="Include Assets" display-tooltip-when-elided="true" name="BottomBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
<uie:ToolbarButton text="Asset Source" display-tooltip-when-elided="true" name="BottomBar3" style="width: 200px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="GUID" display-tooltip-when-elided="true" name="BottomBar2" style="width: 280px; -unity-text-align: middle-left;" />
</uie:Toolbar>
<ui:ListView focusable="true" name="BottomListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 56d6dbe0d65ce334a8996beb19612989
guid: cf2a9340bb457594d9bc1f80b84a89f6
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}