mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-22 00:11:41 +00:00
refactor : editor code
This commit is contained in:
@@ -30,8 +30,12 @@ namespace YooAsset.Editor
|
||||
/// <summary>
|
||||
/// 冗余的资源列表
|
||||
/// </summary>
|
||||
public List<ReportRedundancyInfo> RedundancyInfos = new List<ReportRedundancyInfo>();
|
||||
public List<ReportRedundancyAsset> RedundancyAssets = new List<ReportRedundancyAsset>();
|
||||
|
||||
/// <summary>
|
||||
/// 未被依赖的资源列表
|
||||
/// </summary>
|
||||
public List<AssetInfo> UndependAssets = new List<AssetInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源包信息类
|
||||
|
||||
@@ -5,23 +5,12 @@ using System.Collections.Generic;
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
[Serializable]
|
||||
public class ReportRedundancyInfo
|
||||
public class ReportRedundancyAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源路径
|
||||
/// 资源信息
|
||||
/// </summary>
|
||||
public string AssetPath;
|
||||
|
||||
/// <summary>
|
||||
/// 资源类型
|
||||
/// </summary>
|
||||
public string AssetType;
|
||||
|
||||
/// <summary>
|
||||
/// 资源GUID
|
||||
/// 说明:Meta文件记录的GUID
|
||||
/// </summary>
|
||||
public string AssetGUID;
|
||||
public AssetInfo AssetInfo;
|
||||
|
||||
/// <summary>
|
||||
/// 资源文件大小
|
||||
@@ -80,16 +80,16 @@ namespace YooAsset.Editor
|
||||
_assetListView.Rebuild();
|
||||
RefreshSortingSymbol();
|
||||
}
|
||||
private List<ReportRedundancyInfo> FilterAndSortViewItems()
|
||||
private List<ReportRedundancyAsset> FilterAndSortViewItems()
|
||||
{
|
||||
List<ReportRedundancyInfo> result = new List<ReportRedundancyInfo>(_buildReport.RedundancyInfos.Count);
|
||||
List<ReportRedundancyAsset> result = new List<ReportRedundancyAsset>(_buildReport.RedundancyAssets.Count);
|
||||
|
||||
// 过滤列表
|
||||
foreach (var redundancyInfo in _buildReport.RedundancyInfos)
|
||||
foreach (var redundancyInfo in _buildReport.RedundancyAssets)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_searchKeyWord) == false)
|
||||
{
|
||||
if (redundancyInfo.AssetPath.Contains(_searchKeyWord) == false)
|
||||
if (redundancyInfo.AssetInfo.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.AssetPath).ToList();
|
||||
return result.OrderByDescending(a => a.AssetInfo.AssetPath).ToList();
|
||||
else
|
||||
return result.OrderBy(a => a.AssetPath).ToList();
|
||||
return result.OrderBy(a => a.AssetInfo.AssetPath).ToList();
|
||||
}
|
||||
else if (_sortMode == ESortMode.AssetType)
|
||||
{
|
||||
if (_descendingSort)
|
||||
return result.OrderByDescending(a => a.AssetType).ToList();
|
||||
return result.OrderByDescending(a => a.AssetInfo.AssetType).ToList();
|
||||
else
|
||||
return result.OrderBy(a => a.AssetType).ToList();
|
||||
return result.OrderBy(a => a.AssetInfo.AssetType).ToList();
|
||||
}
|
||||
else if (_sortMode == ESortMode.FileSize)
|
||||
{
|
||||
@@ -237,16 +237,16 @@ namespace YooAsset.Editor
|
||||
}
|
||||
private void BindAssetListViewItem(VisualElement element, int index)
|
||||
{
|
||||
var sourceData = _assetListView.itemsSource as List<ReportRedundancyInfo>;
|
||||
var sourceData = _assetListView.itemsSource as List<ReportRedundancyAsset>;
|
||||
var redundancyInfo = sourceData[index];
|
||||
|
||||
// Asset Path
|
||||
var label1 = element.Q<Label>("Label1");
|
||||
label1.text = redundancyInfo.AssetPath;
|
||||
label1.text = redundancyInfo.AssetInfo.AssetPath;
|
||||
|
||||
// Asset Type
|
||||
var label2 = element.Q<Label>("Label2");
|
||||
label2.text = redundancyInfo.AssetType;
|
||||
label2.text = redundancyInfo.AssetInfo.AssetType.ToString();
|
||||
|
||||
// File Size
|
||||
var label3 = element.Q<Label>("Label3");
|
||||
|
||||
Reference in New Issue
Block a user