feat : the build report file add independ asset info

This commit is contained in:
hevinci
2023-12-26 11:30:19 +08:00
parent 4b68362fb8
commit 2838289650
9 changed files with 81 additions and 20 deletions

View File

@@ -35,7 +35,7 @@ namespace YooAsset.Editor
/// <summary>
/// 未被依赖的资源列表
/// </summary>
public List<AssetInfo> UndependAssets = new List<AssetInfo>();
public List<ReportIndependAsset> IndependAssets = new List<ReportIndependAsset>();
/// <summary>
/// 获取资源包信息类

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace YooAsset.Editor
{
[Serializable]
public class ReportIndependAsset
{
/// <summary>
/// 资源路径
/// </summary>
public string AssetPath;
/// <summary>
/// 资源GUID
/// </summary>
public string AssetGUID;
/// <summary>
/// 资源类型
/// </summary>
public string AssetType;
/// <summary>
/// 资源文件大小
/// </summary>
public long FileSize;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6f187b12ce298c0429119fcf194f2621
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -8,9 +8,19 @@ namespace YooAsset.Editor
public class ReportRedundancyAsset
{
/// <summary>
/// 资源信息
/// 资源路径
/// </summary>
public AssetInfo AssetInfo;
public string AssetPath;
/// <summary>
/// 资源GUID
/// </summary>
public string AssetGUID;
/// <summary>
/// 资源类型
/// </summary>
public string AssetType;
/// <summary>
/// 资源文件大小

View File

@@ -89,7 +89,7 @@ namespace YooAsset.Editor
{
if (string.IsNullOrEmpty(_searchKeyWord) == false)
{
if (redundancyInfo.AssetInfo.AssetPath.Contains(_searchKeyWord) == false)
if (redundancyInfo.AssetPath.Contains(_searchKeyWord) == false)
continue;
}
result.Add(redundancyInfo);
@@ -99,16 +99,16 @@ namespace YooAsset.Editor
if (_sortMode == ESortMode.AssetPath)
{
if (_descendingSort)
return result.OrderByDescending(a => a.AssetInfo.AssetPath).ToList();
return result.OrderByDescending(a => a.AssetPath).ToList();
else
return result.OrderBy(a => a.AssetInfo.AssetPath).ToList();
return result.OrderBy(a => a.AssetPath).ToList();
}
else if (_sortMode == ESortMode.AssetType)
{
if (_descendingSort)
return result.OrderByDescending(a => a.AssetInfo.AssetType).ToList();
return result.OrderByDescending(a => a.AssetType).ToList();
else
return result.OrderBy(a => a.AssetInfo.AssetType).ToList();
return result.OrderBy(a => a.AssetType).ToList();
}
else if (_sortMode == ESortMode.FileSize)
{
@@ -209,7 +209,7 @@ namespace YooAsset.Editor
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = 0;
label.style.width = 125;
label.style.width = 200;
element.Add(label);
}
@@ -242,11 +242,11 @@ namespace YooAsset.Editor
// Asset Path
var label1 = element.Q<Label>("Label1");
label1.text = redundancyInfo.AssetInfo.AssetPath;
label1.text = redundancyInfo.AssetPath;
// Asset Type
var label2 = element.Q<Label>("Label2");
label2.text = redundancyInfo.AssetInfo.AssetType.ToString();
label2.text = redundancyInfo.AssetType.ToString();
// File Size
var label3 = element.Q<Label>("Label3");

View File

@@ -2,7 +2,7 @@
<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:ToolbarButton text="Asset Path" display-tooltip-when-elided="true" name="TopBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
<uie:ToolbarButton text="Asset Type" display-tooltip-when-elided="true" name="TopBar2" style="width: 125px; -unity-text-align: middle-left; flex-grow: 0; flex-shrink: 1;" />
<uie:ToolbarButton text="Asset Type" display-tooltip-when-elided="true" name="TopBar2" style="width: 200px; -unity-text-align: middle-left; flex-grow: 0; flex-shrink: 1;" />
<uie:ToolbarButton text="File Size" display-tooltip-when-elided="true" name="TopBar3" style="width: 125px; -unity-text-align: middle-left; flex-grow: 0; flex-shrink: 1;" />
<uie:ToolbarButton text="Redundancy Num" display-tooltip-when-elided="true" name="TopBar4" style="width: 125px; -unity-text-align: middle-left; flex-grow: 0; flex-shrink: 1;" />
</uie:Toolbar>