update UIElements

展示单位Units
pull/497/head
何冠峰 2025-03-06 14:31:26 +08:00
parent d03bca5512
commit a7cafcb328
6 changed files with 44 additions and 5 deletions

View File

@ -441,6 +441,8 @@ namespace YooAsset.Editor
columnStyle.Stretchable = header.Stretchable;
columnStyle.Searchable = header.Searchable;
columnStyle.Sortable = header.Sortable;
columnStyle.Counter = header.Counter;
columnStyle.Units = header.Units;
var column = new TableColumn(header.HeaderTitle, header.HeaderTitle, columnStyle);
column.MakeCell = () =>
{

View File

@ -43,6 +43,16 @@ namespace YooAsset.Editor
/// </summary>
public bool Sortable = false;
/// <summary>
/// 统计数量
/// </summary>
public bool Counter = false;
/// <summary>
/// 展示单位
/// </summary>
public string Units = string.Empty;
/// <summary>
/// 数值类型
/// </summary>
@ -89,6 +99,16 @@ namespace YooAsset.Editor
Sortable = true;
return this;
}
public ReportHeader SetCounter()
{
Counter = true;
return this;
}
public ReportHeader SetUnits(string units)
{
Units = units;
return this;
}
public ReportHeader SetHeaderType(EHeaderType value)
{
HeaderType = value;

View File

@ -148,10 +148,11 @@ namespace YooAsset.Editor
// LoadingTime
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle(130);
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
columnStyle.Units = "ms";
var column = new TableColumn("LoadingTime", "Loading Time", columnStyle);
column.MakeCell = () =>
{

View File

@ -170,10 +170,11 @@ namespace YooAsset.Editor
// ProcessTime
{
var columnStyle = new ColumnStyle(100);
var columnStyle = new ColumnStyle(130);
columnStyle.Stretchable = false;
columnStyle.Searchable = false;
columnStyle.Sortable = true;
columnStyle.Units = "ms";
var column = new TableColumn("ProcessTime", "Process Time", columnStyle);
column.MakeCell = () =>
{
@ -270,9 +271,9 @@ namespace YooAsset.Editor
// ProcessTime
{
ToolbarButton button = new ToolbarButton();
button.text = "ProcessTime";
button.text = "ProcessTime (ms)";
button.style.flexGrow = 0;
button.style.width = 100;
button.style.width = 130;
_bottomToolbar.Add(button);
}
@ -422,7 +423,7 @@ namespace YooAsset.Editor
var label = new Label();
label.name = "ProcessTime";
label.style.flexGrow = 0f;
label.style.width = 100;
label.style.width = 130;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
container.Add(label);
}

View File

@ -46,6 +46,11 @@ namespace YooAsset.Editor
/// </summary>
public bool Counter = false;
/// <summary>
/// 展示单位
/// </summary>
public string Units = string.Empty;
public ColumnStyle(Length width)
{
if (width.value > MaxValue)

View File

@ -214,6 +214,16 @@ namespace YooAsset.Editor
}
}
// 设置展示单位
foreach (var column in _columns)
{
if (string.IsNullOrEmpty(column.ColumnStyle.Units) == false)
{
var toobarButton = GetHeaderElement(column.ElementName) as ToolbarButton;
toobarButton.text = $"{toobarButton.text} ({column.ColumnStyle.Units})";
}
}
// 设置升降符号
if (string.IsNullOrEmpty(_sortingHeader) == false)
{