mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-19 14:50:10 +00:00
update UIElements
This commit is contained in:
@@ -319,25 +319,16 @@ namespace YooAsset.Editor
|
||||
|
||||
// 眼睛标题
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 20;
|
||||
columnStyle.MinWidth = 20;
|
||||
columnStyle.MaxWidth = 20;
|
||||
var columnStyle = new ColumnStyle(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.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.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
toggle.RegisterValueChangedCallback((evt) => { OnDisplayToggleValueChange(toggle, evt); });
|
||||
return toggle;
|
||||
};
|
||||
@@ -350,29 +341,22 @@ namespace YooAsset.Editor
|
||||
toggle.RefreshIcon();
|
||||
};
|
||||
_elementTableView.AddColumn(column);
|
||||
var headerElement = _elementTableView.GetHeaderElement("眼睛框");
|
||||
headerElement.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
}
|
||||
|
||||
// 通过标题
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 70;
|
||||
columnStyle.MinWidth = 70;
|
||||
columnStyle.MaxWidth = 70;
|
||||
var columnStyle = new ColumnStyle(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.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.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
button.SetEnabled(false);
|
||||
return button;
|
||||
};
|
||||
@@ -392,29 +376,22 @@ namespace YooAsset.Editor
|
||||
}
|
||||
};
|
||||
_elementTableView.AddColumn(column);
|
||||
var headerElement = _elementTableView.GetHeaderElement("通过");
|
||||
headerElement.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
}
|
||||
|
||||
// 白名单标题
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 70;
|
||||
columnStyle.MinWidth = 70;
|
||||
columnStyle.MaxWidth = 70;
|
||||
var columnStyle = new ColumnStyle(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.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.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
button.clickable.clickedWithEventInfo += OnClickWhitListButton;
|
||||
return button;
|
||||
};
|
||||
@@ -429,29 +406,22 @@ 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();
|
||||
columnStyle.Width = 20;
|
||||
columnStyle.MinWidth = 20;
|
||||
columnStyle.MaxWidth = 20;
|
||||
var columnStyle = new ColumnStyle(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.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.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
toggle.RegisterValueChangedCallback((evt) => { OnSelectToggleValueChange(toggle, evt); });
|
||||
return toggle;
|
||||
};
|
||||
@@ -468,10 +438,7 @@ namespace YooAsset.Editor
|
||||
// 自定义标题栏
|
||||
foreach (var header in _reportCombiner.Headers)
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = header.Width;
|
||||
columnStyle.MinWidth = header.MinWidth;
|
||||
columnStyle.MaxWidth = header.MaxWidth;
|
||||
var columnStyle = new ColumnStyle(header.Width, header.MinWidth, header.MaxWidth);
|
||||
columnStyle.Stretchable = header.Stretchable;
|
||||
columnStyle.Searchable = header.Searchable;
|
||||
columnStyle.Sortable = header.Sortable;
|
||||
@@ -480,11 +447,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
var label = new Label();
|
||||
label.style.marginLeft = 3f;
|
||||
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;
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
return label;
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
|
||||
@@ -64,8 +64,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
// PackageName
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 150;
|
||||
var columnStyle = new ColumnStyle(200);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -74,11 +73,6 @@ 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) =>
|
||||
@@ -91,8 +85,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// AssetPath
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 300;
|
||||
var columnStyle = new ColumnStyle(600, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -101,11 +94,6 @@ 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) =>
|
||||
@@ -118,8 +106,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// SpawnScene
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 150;
|
||||
var columnStyle = new ColumnStyle(150);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -128,11 +115,6 @@ 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) =>
|
||||
@@ -145,8 +127,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// SpawnTime
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -155,11 +136,6 @@ 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) =>
|
||||
@@ -172,8 +148,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// LoadingTime
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -182,11 +157,6 @@ 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) =>
|
||||
@@ -199,8 +169,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// RefCount
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -209,11 +178,6 @@ 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) =>
|
||||
@@ -226,8 +190,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// Status
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -236,11 +199,6 @@ 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,8 +221,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
//DependBundles
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 300;
|
||||
var columnStyle = new ColumnStyle(600, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -273,11 +230,6 @@ 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) =>
|
||||
@@ -290,8 +242,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// RefCount
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -300,11 +251,6 @@ 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) =>
|
||||
@@ -317,8 +263,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// Status
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -327,11 +272,6 @@ 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) =>
|
||||
|
||||
@@ -6,7 +6,6 @@ using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
using System.Text;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
@@ -65,8 +64,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
// PackageName
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 150;
|
||||
var columnStyle = new ColumnStyle(200);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -75,11 +73,6 @@ 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) =>
|
||||
@@ -92,8 +85,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// BundleName
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 300;
|
||||
var columnStyle = new ColumnStyle(600, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -102,11 +94,6 @@ 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) =>
|
||||
@@ -119,8 +106,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// RefCount
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -129,11 +115,6 @@ 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) =>
|
||||
@@ -146,8 +127,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// Status
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -156,11 +136,6 @@ 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) =>
|
||||
@@ -183,8 +158,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
// UsingAssets
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 300;
|
||||
var columnStyle = new ColumnStyle(600, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -193,11 +167,6 @@ 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) =>
|
||||
@@ -210,8 +179,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// SpawnScene
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 150;
|
||||
var columnStyle = new ColumnStyle(150);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -220,11 +188,6 @@ 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) =>
|
||||
@@ -237,8 +200,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// SpawnTime
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -247,11 +209,6 @@ 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) =>
|
||||
@@ -264,8 +221,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// RefCount
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -274,11 +230,6 @@ 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) =>
|
||||
@@ -291,8 +242,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// Status
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -301,11 +251,6 @@ 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) =>
|
||||
|
||||
@@ -68,8 +68,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
// AssetPath
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 300;
|
||||
var columnStyle = new ColumnStyle(600, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -78,11 +77,6 @@ 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) =>
|
||||
@@ -95,8 +89,7 @@ namespace YooAsset.Editor
|
||||
|
||||
//MainBundle
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 150;
|
||||
var columnStyle = new ColumnStyle(600, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -105,11 +98,6 @@ 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) =>
|
||||
@@ -124,8 +112,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
// DependBundles
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 280;
|
||||
var columnStyle = new ColumnStyle(600, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -134,11 +121,6 @@ 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) =>
|
||||
@@ -151,8 +133,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// FileSize
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -161,11 +142,6 @@ 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,8 +155,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// FileHash
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 250;
|
||||
var columnStyle = new ColumnStyle(250);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = false;
|
||||
@@ -189,11 +164,6 @@ 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) =>
|
||||
|
||||
@@ -68,8 +68,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
//BundleName
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 300;
|
||||
var columnStyle = new ColumnStyle(600, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -78,11 +77,6 @@ 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) =>
|
||||
@@ -95,8 +89,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// FileSize
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -105,11 +98,6 @@ 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) =>
|
||||
@@ -123,8 +111,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// FileHash
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 250;
|
||||
var columnStyle = new ColumnStyle(250);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = false;
|
||||
@@ -133,11 +120,6 @@ 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) =>
|
||||
@@ -150,8 +132,7 @@ namespace YooAsset.Editor
|
||||
|
||||
//Encrypted
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -160,11 +141,6 @@ 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) =>
|
||||
@@ -178,8 +154,7 @@ namespace YooAsset.Editor
|
||||
|
||||
//Tags
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 150;
|
||||
var columnStyle = new ColumnStyle(150, 100, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -188,11 +163,6 @@ 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) =>
|
||||
@@ -207,8 +177,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
//IncludeAssets
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 300;
|
||||
var columnStyle = new ColumnStyle(600, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
@@ -217,11 +186,6 @@ 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) =>
|
||||
@@ -234,8 +198,7 @@ namespace YooAsset.Editor
|
||||
|
||||
//AssetSource
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 100;
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = false;
|
||||
@@ -244,11 +207,6 @@ 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) =>
|
||||
@@ -261,8 +219,7 @@ namespace YooAsset.Editor
|
||||
|
||||
//AssetGUID
|
||||
{
|
||||
var columnStyle = new ColumnStyle();
|
||||
columnStyle.Width = 250;
|
||||
var columnStyle = new ColumnStyle(250);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = false;
|
||||
@@ -271,11 +228,6 @@ 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) =>
|
||||
|
||||
@@ -14,22 +14,17 @@ namespace YooAsset.Editor
|
||||
/// <summary>
|
||||
/// 单元列宽度
|
||||
/// </summary>
|
||||
public Length Width = 100f;
|
||||
public Length Width;
|
||||
|
||||
/// <summary>
|
||||
/// 单元列最小宽度
|
||||
/// </summary>
|
||||
public Length MinWidth = 30f;
|
||||
public Length MinWidth;
|
||||
|
||||
/// <summary>
|
||||
/// 单元列最大宽度
|
||||
/// </summary>
|
||||
public Length MaxWidth = MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// 文本的锚点类型
|
||||
/// </summary>
|
||||
public TextAnchor TxtAnchor = TextAnchor.MiddleLeft;
|
||||
public Length MaxWidth;
|
||||
|
||||
/// <summary>
|
||||
/// 可伸缩
|
||||
@@ -45,6 +40,25 @@ 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
|
||||
@@ -108,13 +108,11 @@ namespace YooAsset.Editor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置标题
|
||||
/// 获取标题UI元素
|
||||
/// </summary>
|
||||
public void SetHeaderTitle(string elementName, string headerTitle)
|
||||
public VisualElement GetHeaderElement(string elementName)
|
||||
{
|
||||
var toolbarBtn = _toolbar.Q<ToolbarButton>(elementName);
|
||||
if (toolbarBtn != null)
|
||||
toolbarBtn.text = headerTitle;
|
||||
return _toolbar.Q<ToolbarButton>(elementName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -126,7 +124,6 @@ namespace YooAsset.Editor
|
||||
toolbarBtn.userData = column;
|
||||
toolbarBtn.name = column.ElementName;
|
||||
toolbarBtn.text = column.HeaderTitle;
|
||||
toolbarBtn.style.unityTextAlign = column.ColumnStyle.TxtAnchor;
|
||||
toolbarBtn.style.flexGrow = 0;
|
||||
toolbarBtn.style.width = column.ColumnStyle.Width;
|
||||
toolbarBtn.style.minWidth = column.ColumnStyle.Width;
|
||||
@@ -311,14 +308,17 @@ namespace YooAsset.Editor
|
||||
{
|
||||
VisualElement listViewElement = new VisualElement();
|
||||
listViewElement.style.flexDirection = FlexDirection.Row;
|
||||
foreach (var colum in _columns)
|
||||
foreach (var column in _columns)
|
||||
{
|
||||
var cellElement = colum.MakeCell.Invoke();
|
||||
cellElement.name = colum.ElementName;
|
||||
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;
|
||||
SetCellElementStyle(cellElement);
|
||||
listViewElement.Add(cellElement);
|
||||
colum.CellElements.Add(cellElement);
|
||||
column.CellElements.Add(cellElement);
|
||||
}
|
||||
return listViewElement;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user