Compare commits

..

No commits in common. "203b9994df799e6d857dbfaf0beb7fa0acfbcf4c" and "698d81a433b358bfd7e1b94c2c227221deca3f10" have entirely different histories.

17 changed files with 310 additions and 304 deletions

View File

@ -242,7 +242,7 @@ namespace YooAsset.Editor
}
private void FixAllBtn_clicked()
{
if (EditorUtility.DisplayDialog("提示", "修复全部资源(排除白名单和隐藏元素", "Yes", "No"))
if (EditorUtility.DisplayDialog("提示", "修复全部资源(白名单除外", "Yes", "No"))
{
if (_reportCombiner != null)
_reportCombiner.FixAll();
@ -250,7 +250,7 @@ namespace YooAsset.Editor
}
private void FixSelectBtn_clicked()
{
if (EditorUtility.DisplayDialog("提示", "修复勾选资源(包含白名单和隐藏元素", "Yes", "No"))
if (EditorUtility.DisplayDialog("提示", "修复所有选中资源(包含白名单", "Yes", "No"))
{
if (_reportCombiner != null)
_reportCombiner.FixSelect();
@ -319,16 +319,25 @@ namespace YooAsset.Editor
// 眼睛标题
{
var columnStyle = new ColumnStyle(20);
var columnStyle = new ColumnStyle();
columnStyle.Width = 20;
columnStyle.MinWidth = 20;
columnStyle.MaxWidth = 20;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = false;
columnStyle.TxtAnchor = TextAnchor.MiddleCenter;
var column = new TableColumn("眼睛框", string.Empty, columnStyle);
column.MakeCell = () =>
{
var toggle = new DisplayToggle();
toggle.text = string.Empty;
toggle.style.unityTextAlign = TextAnchor.MiddleCenter;
toggle.style.marginLeft = 3f;
toggle.style.unityTextAlign = columnStyle.TxtAnchor;
toggle.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
toggle.style.width = columnStyle.Width;
toggle.style.maxWidth = columnStyle.MaxWidth;
toggle.style.minWidth = columnStyle.MinWidth;
toggle.RegisterValueChangedCallback((evt) => { OnDisplayToggleValueChange(toggle, evt); });
return toggle;
};
@ -341,22 +350,29 @@ namespace YooAsset.Editor
toggle.RefreshIcon();
};
_elementTableView.AddColumn(column);
var headerElement = _elementTableView.GetHeaderElement("眼睛框");
headerElement.style.unityTextAlign = TextAnchor.MiddleCenter;
}
// 通过标题
{
var columnStyle = new ColumnStyle(70);
var columnStyle = new ColumnStyle();
columnStyle.Width = 70;
columnStyle.MinWidth = 70;
columnStyle.MaxWidth = 70;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
columnStyle.TxtAnchor = TextAnchor.MiddleCenter;
var column = new TableColumn("通过", "通过", columnStyle);
column.MakeCell = () =>
{
var button = new Button();
button.text = "通过";
button.style.unityTextAlign = TextAnchor.MiddleCenter;
button.style.marginLeft = 3f;
button.style.unityTextAlign = columnStyle.TxtAnchor;
button.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
button.style.width = columnStyle.Width;
button.style.maxWidth = columnStyle.MaxWidth;
button.style.minWidth = columnStyle.MinWidth;
button.SetEnabled(false);
return button;
};
@ -376,22 +392,29 @@ namespace YooAsset.Editor
}
};
_elementTableView.AddColumn(column);
var headerElement = _elementTableView.GetHeaderElement("通过");
headerElement.style.unityTextAlign = TextAnchor.MiddleCenter;
}
// 白名单标题
{
var columnStyle = new ColumnStyle(70);
var columnStyle = new ColumnStyle();
columnStyle.Width = 70;
columnStyle.MinWidth = 70;
columnStyle.MaxWidth = 70;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
columnStyle.TxtAnchor = TextAnchor.MiddleCenter;
var column = new TableColumn("白名单", "白名单", columnStyle);
column.MakeCell = () =>
{
Button button = new Button();
button.text = "白名单";
button.style.unityTextAlign = TextAnchor.MiddleCenter;
button.style.marginLeft = 3f;
button.style.unityTextAlign = columnStyle.TxtAnchor;
button.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
button.style.width = columnStyle.Width;
button.style.maxWidth = columnStyle.MaxWidth;
button.style.minWidth = columnStyle.MinWidth;
button.clickable.clickedWithEventInfo += OnClickWhitListButton;
return button;
};
@ -406,22 +429,29 @@ namespace YooAsset.Editor
button.style.backgroundColor = new StyleColor(new Color32(100, 100, 100, 255));
};
_elementTableView.AddColumn(column);
var headerElement = _elementTableView.GetHeaderElement("白名单");
headerElement.style.unityTextAlign = TextAnchor.MiddleCenter;
}
// 选中标题
{
var columnStyle = new ColumnStyle(20);
var columnStyle = new ColumnStyle();
columnStyle.Width = 20;
columnStyle.MinWidth = 20;
columnStyle.MaxWidth = 20;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = false;
columnStyle.TxtAnchor = TextAnchor.MiddleCenter;
var column = new TableColumn("选中框", string.Empty, columnStyle);
column.MakeCell = () =>
{
var toggle = new Toggle();
toggle.text = string.Empty;
toggle.style.unityTextAlign = TextAnchor.MiddleCenter;
toggle.style.marginLeft = 3f;
toggle.style.unityTextAlign = columnStyle.TxtAnchor;
toggle.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
toggle.style.width = columnStyle.Width;
toggle.style.maxWidth = columnStyle.MaxWidth;
toggle.style.minWidth = columnStyle.MinWidth;
toggle.RegisterValueChangedCallback((evt) => { OnSelectToggleValueChange(toggle, evt); });
return toggle;
};
@ -438,7 +468,10 @@ namespace YooAsset.Editor
// 自定义标题栏
foreach (var header in _reportCombiner.Headers)
{
var columnStyle = new ColumnStyle(header.Width, header.MinWidth, header.MaxWidth);
var columnStyle = new ColumnStyle();
columnStyle.Width = header.Width;
columnStyle.MinWidth = header.MinWidth;
columnStyle.MaxWidth = header.MaxWidth;
columnStyle.Stretchable = header.Stretchable;
columnStyle.Searchable = header.Searchable;
columnStyle.Sortable = header.Sortable;
@ -447,7 +480,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.marginLeft = 3f;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.unityTextAlign = columnStyle.TxtAnchor;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>

View File

@ -20,7 +20,7 @@ namespace YooAsset.Editor
/// <summary>
/// 单元列最小宽度
/// </summary>
public int MinWidth = 50;
public int MinWidth = 30;
/// <summary>
/// 单元列最大宽度
@ -52,17 +52,7 @@ namespace YooAsset.Editor
{
HeaderTitle = headerTitle;
Width = width;
MinWidth = width;
MaxWidth = width;
}
public ReportHeader(string headerTitle, int width, int minWidth, int maxWidth)
{
HeaderTitle = headerTitle;
Width = width;
MinWidth = minWidth;
MaxWidth = maxWidth;
}
public ReportHeader SetMinWidth(int value)
{
MinWidth = value;

View File

@ -61,11 +61,5 @@ namespace YooAsset.Editor
HeaderTitles.Add(reportHeader);
return reportHeader;
}
public ReportHeader AddHeader(string headerTitle, int width, int minWidth, int maxWidth)
{
var reportHeader = new ReportHeader(headerTitle, width, minWidth, maxWidth);
HeaderTitles.Add(reportHeader);
return reportHeader;
}
}
}

View File

@ -184,7 +184,7 @@ namespace YooAsset.Editor
/// <summary>
/// 修复选定元素
/// 注意:包含白名单和隐藏元素
/// 注意:排除白名单和隐藏元素
/// </summary>
public void FixSelect()
{
@ -196,7 +196,7 @@ namespace YooAsset.Editor
List<ReportElement> fixList = new List<ReportElement>(elements.Count);
foreach (var element in elements)
{
if (element.Passes)
if (element.Passes || element.IsWhiteList || element.Hidden)
continue;
if (element.IsSelected)
fixList.Add(element);

View File

@ -64,7 +64,8 @@ namespace YooAsset.Editor
{
// PackageName
{
var columnStyle = new ColumnStyle(200);
var columnStyle = new ColumnStyle();
columnStyle.Width = 150;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -73,6 +74,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -85,7 +91,8 @@ namespace YooAsset.Editor
// AssetPath
{
var columnStyle = new ColumnStyle(600, 500, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 300;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -94,6 +101,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -106,7 +118,8 @@ namespace YooAsset.Editor
// SpawnScene
{
var columnStyle = new ColumnStyle(150);
var columnStyle = new ColumnStyle();
columnStyle.Width = 150;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -115,6 +128,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -127,7 +145,8 @@ namespace YooAsset.Editor
// SpawnTime
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -136,6 +155,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -148,7 +172,8 @@ namespace YooAsset.Editor
// LoadingTime
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -157,6 +182,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -169,7 +199,8 @@ namespace YooAsset.Editor
// RefCount
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -178,6 +209,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -190,7 +226,8 @@ namespace YooAsset.Editor
// Status
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -199,6 +236,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -221,7 +263,8 @@ namespace YooAsset.Editor
{
//DependBundles
{
var columnStyle = new ColumnStyle(600, 500, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 300;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -230,6 +273,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -242,7 +290,8 @@ namespace YooAsset.Editor
// RefCount
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -251,6 +300,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -263,7 +317,8 @@ namespace YooAsset.Editor
// Status
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -272,6 +327,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>

View File

@ -6,6 +6,7 @@ using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
using System.Text;
namespace YooAsset.Editor
{
@ -64,7 +65,8 @@ namespace YooAsset.Editor
{
// PackageName
{
var columnStyle = new ColumnStyle(200);
var columnStyle = new ColumnStyle();
columnStyle.Width = 150;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -73,6 +75,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -85,7 +92,8 @@ namespace YooAsset.Editor
// BundleName
{
var columnStyle = new ColumnStyle(600, 500, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 300;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -94,6 +102,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -106,7 +119,8 @@ namespace YooAsset.Editor
// RefCount
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -115,6 +129,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -127,7 +146,8 @@ namespace YooAsset.Editor
// Status
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -136,6 +156,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -158,7 +183,8 @@ namespace YooAsset.Editor
{
// UsingAssets
{
var columnStyle = new ColumnStyle(600, 500, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 300;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -167,6 +193,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -179,7 +210,8 @@ namespace YooAsset.Editor
// SpawnScene
{
var columnStyle = new ColumnStyle(150);
var columnStyle = new ColumnStyle();
columnStyle.Width = 150;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -188,6 +220,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -200,7 +237,8 @@ namespace YooAsset.Editor
// SpawnTime
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -209,6 +247,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -221,7 +264,8 @@ namespace YooAsset.Editor
// RefCount
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -230,6 +274,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -242,7 +291,8 @@ namespace YooAsset.Editor
// Status
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -251,6 +301,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>

View File

@ -68,7 +68,8 @@ namespace YooAsset.Editor
{
// AssetPath
{
var columnStyle = new ColumnStyle(600, 500, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 300;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -77,6 +78,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -89,7 +95,8 @@ namespace YooAsset.Editor
//MainBundle
{
var columnStyle = new ColumnStyle(600, 500, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 150;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -98,6 +105,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -112,7 +124,8 @@ namespace YooAsset.Editor
{
// DependBundles
{
var columnStyle = new ColumnStyle(600, 500, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 280;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -121,6 +134,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -133,7 +151,8 @@ namespace YooAsset.Editor
// FileSize
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -142,6 +161,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -155,7 +179,8 @@ namespace YooAsset.Editor
// FileHash
{
var columnStyle = new ColumnStyle(250);
var columnStyle = new ColumnStyle();
columnStyle.Width = 250;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = false;
@ -164,6 +189,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>

View File

@ -68,7 +68,8 @@ namespace YooAsset.Editor
{
//BundleName
{
var columnStyle = new ColumnStyle(600, 500, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 300;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -77,6 +78,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -89,7 +95,8 @@ namespace YooAsset.Editor
// FileSize
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -98,6 +105,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -111,7 +123,8 @@ namespace YooAsset.Editor
// FileHash
{
var columnStyle = new ColumnStyle(250);
var columnStyle = new ColumnStyle();
columnStyle.Width = 250;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = false;
@ -120,6 +133,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -132,7 +150,8 @@ namespace YooAsset.Editor
//Encrypted
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
@ -141,6 +160,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -154,7 +178,8 @@ namespace YooAsset.Editor
//Tags
{
var columnStyle = new ColumnStyle(150, 100, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 150;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -163,6 +188,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -177,7 +207,8 @@ namespace YooAsset.Editor
{
//IncludeAssets
{
var columnStyle = new ColumnStyle(600, 500, 1000);
var columnStyle = new ColumnStyle();
columnStyle.Width = 300;
columnStyle.Stretchable = true;
columnStyle.Searchable = true;
columnStyle.Sortable = true;
@ -186,6 +217,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -198,7 +234,8 @@ namespace YooAsset.Editor
//AssetSource
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle();
columnStyle.Width = 100;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = false;
@ -207,6 +244,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
@ -219,7 +261,8 @@ namespace YooAsset.Editor
//AssetGUID
{
var columnStyle = new ColumnStyle(250);
var columnStyle = new ColumnStyle();
columnStyle.Width = 250;
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = false;
@ -228,6 +271,11 @@ namespace YooAsset.Editor
{
var label = new Label();
label.style.unityTextAlign = TextAnchor.MiddleLeft;
label.style.marginLeft = 3f;
label.style.flexGrow = columnStyle.Stretchable ? 1f : 0f;
label.style.width = columnStyle.Width;
label.style.maxWidth = columnStyle.MaxWidth;
label.style.minWidth = columnStyle.MinWidth;
return label;
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>

View File

@ -17,7 +17,7 @@ namespace YooAsset.Editor
{
}
#else
public new class UxmlFactory : UxmlFactory<PanelSplitView, UxmlTraits>
public new class UxmlFactory : UxmlFactory<PanelSplitView, TwoPaneSplitView.UxmlTraits>
{
}
#endif

View File

@ -1,111 +0,0 @@
#if UNITY_2019_4_OR_NEWER
using System;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
public class ResizeHandle : VisualElement
{
/// <summary>
/// Instantiates a TableView using data from a UXML file.
/// </summary>
public new class UxmlFactory : UxmlFactory<ResizeHandle, UxmlTraits>
{
}
private bool _isResizing = false;
private float _initialWidth;
private Vector2 _initialMousePos;
/// <summary>
/// 控制的UI元素
/// </summary>
public VisualElement ControlTarget { get; set; }
/// <summary>
/// 控制元素的最小宽度
/// </summary>
public int ControlMinWidth { get; set; }
/// <summary>
/// 控制元素的最大宽度
/// </summary>
public int ControlMaxWidth { get; set; }
/// <summary>
/// 尺寸发生变化
/// </summary>
public Action<float> ResizeChanged { get; set; }
public ResizeHandle()
{
int defaultWidth = 5;
this.style.width = defaultWidth;
this.style.minWidth = defaultWidth;
this.style.maxWidth = defaultWidth;
this.style.opacity = 0;
this.style.cursor = UIElementsCursor.CreateCursor(MouseCursor.ResizeHorizontal);
this.RegisterCallback<MouseDownEvent>(OnMouseDown);
this.RegisterCallback<MouseMoveEvent>(OnMouseMove);
this.RegisterCallback<MouseUpEvent>(OnMouseUp);
}
public ResizeHandle(int handleWidth, VisualElement controlTarget, int controlMinWidth, int controlMaxWidth)
{
ControlTarget = controlTarget;
ControlMinWidth = controlMinWidth;
ControlMaxWidth = controlMaxWidth;
this.style.width = handleWidth;
this.style.minWidth = handleWidth;
this.style.maxWidth = handleWidth;
this.style.opacity = 0;
this.style.cursor = UIElementsCursor.CreateCursor(MouseCursor.ResizeHorizontal);
this.RegisterCallback<MouseDownEvent>(OnMouseDown);
this.RegisterCallback<MouseMoveEvent>(OnMouseMove);
this.RegisterCallback<MouseUpEvent>(OnMouseUp);
}
private void OnMouseDown(MouseDownEvent evt)
{
// 鼠标左键按下
if (ControlTarget != null && evt.button == 0)
{
_isResizing = true;
_initialWidth = ControlTarget.resolvedStyle.width;
_initialMousePos = evt.mousePosition;
this.CaptureMouse();
}
}
private void OnMouseMove(MouseMoveEvent evt)
{
if (ControlTarget != null && _isResizing)
{
// 计算鼠标移动距离
float deltaX = evt.mousePosition.x - _initialMousePos.x;
// 更新控制元素尺寸
float newWidth = _initialWidth + deltaX;
float width = Mathf.Clamp(newWidth, ControlMinWidth, ControlMaxWidth);
ControlTarget.style.width = width;
ControlTarget.style.minWidth = width;
ControlTarget.style.maxWidth = width;
ResizeChanged?.Invoke(width);
}
}
private void OnMouseUp(MouseUpEvent evt)
{
// 鼠标左键释放
if (ControlTarget != null && evt.button == 0)
{
_isResizing = false;
this.ReleaseMouse();
}
}
}
}
#endif

View File

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

View File

@ -14,17 +14,22 @@ namespace YooAsset.Editor
/// <summary>
/// 单元列宽度
/// </summary>
public Length Width;
public Length Width = 100f;
/// <summary>
/// 单元列最小宽度
/// </summary>
public Length MinWidth;
public Length MinWidth = 30f;
/// <summary>
/// 单元列最大宽度
/// </summary>
public Length MaxWidth;
public Length MaxWidth = MaxValue;
/// <summary>
/// 文本的锚点类型
/// </summary>
public TextAnchor TxtAnchor = TextAnchor.MiddleLeft;
/// <summary>
/// 可伸缩
@ -40,25 +45,6 @@ namespace YooAsset.Editor
/// 可排序
/// </summary>
public bool Sortable = false;
public ColumnStyle(Length width)
{
if (width.value > MaxValue)
width = MaxValue;
Width = width;
MinWidth = width;
MaxWidth = width;
}
public ColumnStyle(Length width, Length minWidth, Length maxWidth)
{
if (maxWidth.value > MaxValue)
maxWidth = MaxValue;
Width = width;
MinWidth = minWidth;
MaxWidth = maxWidth;
}
}
}
#endif

View File

@ -1,6 +1,5 @@
#if UNITY_2019_4_OR_NEWER
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
@ -15,11 +14,6 @@ namespace YooAsset.Editor
/// </summary>
internal int ColumnIndex;
/// <summary>
/// 单元元素集合
/// </summary>
internal List<VisualElement> CellElements = new List<VisualElement>(1000);
/// <summary>
/// UI元素名称
/// </summary>

View File

@ -108,11 +108,13 @@ namespace YooAsset.Editor
}
/// <summary>
/// 获取标题UI元素
/// 设置标题
/// </summary>
public VisualElement GetHeaderElement(string elementName)
public void SetHeaderTitle(string elementName, string headerTitle)
{
return _toolbar.Q<ToolbarButton>(elementName);
var toolbarBtn = _toolbar.Q<ToolbarButton>(elementName);
if (toolbarBtn != null)
toolbarBtn.text = headerTitle;
}
/// <summary>
@ -124,37 +126,16 @@ namespace YooAsset.Editor
toolbarBtn.userData = column;
toolbarBtn.name = column.ElementName;
toolbarBtn.text = column.HeaderTitle;
toolbarBtn.style.flexGrow = 0;
toolbarBtn.style.unityTextAlign = column.ColumnStyle.TxtAnchor;
toolbarBtn.style.flexGrow = column.ColumnStyle.Stretchable ? 1f : 0f;
toolbarBtn.style.width = column.ColumnStyle.Width;
toolbarBtn.style.minWidth = column.ColumnStyle.Width;
toolbarBtn.style.maxWidth = column.ColumnStyle.Width;
toolbarBtn.style.minWidth = column.ColumnStyle.MinWidth;
toolbarBtn.style.maxWidth = column.ColumnStyle.MaxWidth;
toolbarBtn.clickable.clickedWithEventInfo += OnClickTableHead;
SetCellElementStyle(toolbarBtn);
_toolbar.Add(toolbarBtn);
_columns.Add(column);
// 可伸缩控制柄
if (column.ColumnStyle.Stretchable)
{
int handleWidth = 3;
int minWidth = (int)column.ColumnStyle.MinWidth.value;
int maxWidth = (int)column.ColumnStyle.MaxWidth.value;
var resizeHandle = new ResizeHandle(handleWidth, toolbarBtn, minWidth, maxWidth);
resizeHandle.ResizeChanged += (float value) =>
{
float width = Mathf.Clamp(value, column.ColumnStyle.MinWidth.value, column.ColumnStyle.MaxWidth.value);
column.ColumnStyle.Width = width;
foreach (var element in column.CellElements)
{
element.style.width = width;
element.style.minWidth = width;
element.style.maxWidth = width;
}
};
_toolbar.Add(resizeHandle);
}
// 计算索引值
column.ColumnIndex = _columns.Count - 1;
@ -308,17 +289,12 @@ namespace YooAsset.Editor
{
VisualElement listViewElement = new VisualElement();
listViewElement.style.flexDirection = FlexDirection.Row;
foreach (var column in _columns)
foreach (var colum in _columns)
{
var cellElement = column.MakeCell.Invoke();
cellElement.name = column.ElementName;
cellElement.style.flexGrow = 0f;
cellElement.style.width = column.ColumnStyle.Width;
cellElement.style.minWidth = column.ColumnStyle.Width;
cellElement.style.maxWidth = column.ColumnStyle.Width;
var cellElement = colum.MakeCell.Invoke();
cellElement.name = colum.ElementName;
SetCellElementStyle(cellElement);
listViewElement.Add(cellElement);
column.CellElements.Add(cellElement);
}
return listViewElement;
}
@ -338,13 +314,12 @@ namespace YooAsset.Editor
StyleLength defaultStyle = new StyleLength(1f);
element.style.paddingTop = defaultStyle;
element.style.paddingBottom = defaultStyle;
element.style.paddingLeft = defaultStyle;
element.style.paddingRight = defaultStyle;
element.style.marginTop = defaultStyle;
element.style.marginBottom = defaultStyle;
element.style.paddingLeft = 1;
element.style.paddingRight = 1;
element.style.marginLeft = 0;
element.style.marginRight = 0;
element.style.marginLeft = defaultStyle;
element.style.marginRight = defaultStyle;
}
}
}

View File

@ -1,30 +0,0 @@
#if UNITY_2019_4_OR_NEWER
using System.Reflection;
using UnityEditor;
namespace YooAsset.Editor
{
public static class UIElementsCursor
{
private static PropertyInfo _defaultCursorId;
private static PropertyInfo DefaultCursorId
{
get
{
if (_defaultCursorId != null)
return _defaultCursorId;
_defaultCursorId = typeof(UnityEngine.UIElements.Cursor).GetProperty("defaultCursorId", BindingFlags.NonPublic | BindingFlags.Instance);
return _defaultCursorId;
}
}
public static UnityEngine.UIElements.Cursor CreateCursor(MouseCursor cursorType)
{
var ret = (object)new UnityEngine.UIElements.Cursor();
DefaultCursorId.SetValue(ret, (int)cursorType);
return (UnityEngine.UIElements.Cursor)ret;
}
}
}
#endif

View File

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

View File

@ -40,13 +40,13 @@ public class TextureSchema : ScannerSchema
string title = "扫描所有纹理资产";
string desc = GetUserGuide();
var report = new ScanReport(title, desc);
report.AddHeader("资源路径", 600, 500, 1000).SetStretchable().SetSearchable().SetSortable().SetHeaderType(EHeaderType.AssetPath);
report.AddHeader("资源路径", 300).SetStretchable().SetSearchable().SetSortable().SetHeaderType(EHeaderType.AssetPath);
report.AddHeader("图片宽度", 100).SetSortable().SetHeaderType(EHeaderType.LongValue);
report.AddHeader("图片高度", 100).SetSortable().SetHeaderType(EHeaderType.LongValue);
report.AddHeader("内存大小", 100).SetSortable().SetHeaderType(EHeaderType.LongValue);
report.AddHeader("苹果格式", 100);
report.AddHeader("安卓格式", 100);
report.AddHeader("错误信息", 500).SetStretchable();
report.AddHeader("错误信息", 200).SetStretchable();
// 获取扫描资源集合
var searchDirectorys = scanner.Collectors.Select(c => { return c.CollectPath; });