Compare commits

...

4 Commits

Author SHA1 Message Date
何冠峰 203b9994df update AssetArtReporter 2025-02-05 19:04:05 +08:00
何冠峰 e76bbb6a85 update space shooter 2025-02-05 18:49:20 +08:00
何冠峰 4e6c146bde update UIElements 2025-02-05 18:49:11 +08:00
何冠峰 7e1dc7ef24 update UIElements 2025-02-05 17:26:19 +08:00
17 changed files with 304 additions and 310 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,111 @@
#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

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

View File

@ -14,22 +14,17 @@ namespace YooAsset.Editor
/// <summary> /// <summary>
/// 单元列宽度 /// 单元列宽度
/// </summary> /// </summary>
public Length Width = 100f; public Length Width;
/// <summary> /// <summary>
/// 单元列最小宽度 /// 单元列最小宽度
/// </summary> /// </summary>
public Length MinWidth = 30f; public Length MinWidth;
/// <summary> /// <summary>
/// 单元列最大宽度 /// 单元列最大宽度
/// </summary> /// </summary>
public Length MaxWidth = MaxValue; public Length MaxWidth;
/// <summary>
/// 文本的锚点类型
/// </summary>
public TextAnchor TxtAnchor = TextAnchor.MiddleLeft;
/// <summary> /// <summary>
/// 可伸缩 /// 可伸缩
@ -45,6 +40,25 @@ namespace YooAsset.Editor
/// 可排序 /// 可排序
/// </summary> /// </summary>
public bool Sortable = false; 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 #endif

View File

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

View File

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

View File

@ -0,0 +1,30 @@
#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

@ -0,0 +1,11 @@
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 title = "扫描所有纹理资产";
string desc = GetUserGuide(); string desc = GetUserGuide();
var report = new ScanReport(title, desc); var report = new ScanReport(title, desc);
report.AddHeader("资源路径", 300).SetStretchable().SetSearchable().SetSortable().SetHeaderType(EHeaderType.AssetPath); report.AddHeader("资源路径", 600, 500, 1000).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).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("安卓格式", 100); report.AddHeader("安卓格式", 100);
report.AddHeader("错误信息", 200).SetStretchable(); report.AddHeader("错误信息", 500).SetStretchable();
// 获取扫描资源集合 // 获取扫描资源集合
var searchDirectorys = scanner.Collectors.Select(c => { return c.CollectPath; }); var searchDirectorys = scanner.Collectors.Select(c => { return c.CollectPath; });