mirror of https://github.com/tuyoogame/YooAsset
Compare commits
4 Commits
698d81a433
...
203b9994df
Author | SHA1 | Date |
---|---|---|
|
203b9994df | |
|
e76bbb6a85 | |
|
4e6c146bde | |
|
7e1dc7ef24 |
|
@ -242,7 +242,7 @@ namespace YooAsset.Editor
|
|||
}
|
||||
private void FixAllBtn_clicked()
|
||||
{
|
||||
if (EditorUtility.DisplayDialog("提示", "修复全部资源(白名单除外)", "Yes", "No"))
|
||||
if (EditorUtility.DisplayDialog("提示", "修复全部资源(排除白名单和隐藏元素)", "Yes", "No"))
|
||||
{
|
||||
if (_reportCombiner != null)
|
||||
_reportCombiner.FixAll();
|
||||
|
@ -250,7 +250,7 @@ namespace YooAsset.Editor
|
|||
}
|
||||
private void FixSelectBtn_clicked()
|
||||
{
|
||||
if (EditorUtility.DisplayDialog("提示", "修复所有选中资源(包含白名单)", "Yes", "No"))
|
||||
if (EditorUtility.DisplayDialog("提示", "修复勾选资源(包含白名单和隐藏元素)", "Yes", "No"))
|
||||
{
|
||||
if (_reportCombiner != null)
|
||||
_reportCombiner.FixSelect();
|
||||
|
@ -319,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) =>
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace YooAsset.Editor
|
|||
/// <summary>
|
||||
/// 单元列最小宽度
|
||||
/// </summary>
|
||||
public int MinWidth = 30;
|
||||
public int MinWidth = 50;
|
||||
|
||||
/// <summary>
|
||||
/// 单元列最大宽度
|
||||
|
@ -52,7 +52,17 @@ namespace YooAsset.Editor
|
|||
{
|
||||
HeaderTitle = headerTitle;
|
||||
Width = width;
|
||||
MinWidth = width;
|
||||
MaxWidth = width;
|
||||
}
|
||||
public ReportHeader(string headerTitle, int width, int minWidth, int maxWidth)
|
||||
{
|
||||
HeaderTitle = headerTitle;
|
||||
Width = width;
|
||||
MinWidth = minWidth;
|
||||
MaxWidth = maxWidth;
|
||||
}
|
||||
|
||||
public ReportHeader SetMinWidth(int value)
|
||||
{
|
||||
MinWidth = value;
|
||||
|
|
|
@ -61,5 +61,11 @@ namespace YooAsset.Editor
|
|||
HeaderTitles.Add(reportHeader);
|
||||
return reportHeader;
|
||||
}
|
||||
public ReportHeader AddHeader(string headerTitle, int width, int minWidth, int maxWidth)
|
||||
{
|
||||
var reportHeader = new ReportHeader(headerTitle, width, minWidth, maxWidth);
|
||||
HeaderTitles.Add(reportHeader);
|
||||
return reportHeader;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -184,7 +184,7 @@ namespace YooAsset.Editor
|
|||
|
||||
/// <summary>
|
||||
/// 修复选定元素
|
||||
/// 注意:排除白名单和隐藏元素
|
||||
/// 注意:包含白名单和隐藏元素
|
||||
/// </summary>
|
||||
public void FixSelect()
|
||||
{
|
||||
|
@ -196,7 +196,7 @@ namespace YooAsset.Editor
|
|||
List<ReportElement> fixList = new List<ReportElement>(elements.Count);
|
||||
foreach (var element in elements)
|
||||
{
|
||||
if (element.Passes || element.IsWhiteList || element.Hidden)
|
||||
if (element.Passes)
|
||||
continue;
|
||||
if (element.IsSelected)
|
||||
fixList.Add(element);
|
||||
|
|
|
@ -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) =>
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace YooAsset.Editor
|
|||
{
|
||||
}
|
||||
#else
|
||||
public new class UxmlFactory : UxmlFactory<PanelSplitView, TwoPaneSplitView.UxmlTraits>
|
||||
public new class UxmlFactory : UxmlFactory<PanelSplitView, UxmlTraits>
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: adb565f9b5e9fb3428e54d0cfd58676d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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
|
|
@ -1,5 +1,6 @@
|
|||
#if UNITY_2019_4_OR_NEWER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEditor.UIElements;
|
||||
|
@ -14,6 +15,11 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
internal int ColumnIndex;
|
||||
|
||||
/// <summary>
|
||||
/// 单元元素集合
|
||||
/// </summary>
|
||||
internal List<VisualElement> CellElements = new List<VisualElement>(1000);
|
||||
|
||||
/// <summary>
|
||||
/// UI元素名称
|
||||
/// </summary>
|
||||
|
|
|
@ -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,16 +124,37 @@ namespace YooAsset.Editor
|
|||
toolbarBtn.userData = column;
|
||||
toolbarBtn.name = column.ElementName;
|
||||
toolbarBtn.text = column.HeaderTitle;
|
||||
toolbarBtn.style.unityTextAlign = column.ColumnStyle.TxtAnchor;
|
||||
toolbarBtn.style.flexGrow = column.ColumnStyle.Stretchable ? 1f : 0f;
|
||||
toolbarBtn.style.flexGrow = 0;
|
||||
toolbarBtn.style.width = column.ColumnStyle.Width;
|
||||
toolbarBtn.style.minWidth = column.ColumnStyle.MinWidth;
|
||||
toolbarBtn.style.maxWidth = column.ColumnStyle.MaxWidth;
|
||||
toolbarBtn.style.minWidth = column.ColumnStyle.Width;
|
||||
toolbarBtn.style.maxWidth = column.ColumnStyle.Width;
|
||||
toolbarBtn.clickable.clickedWithEventInfo += OnClickTableHead;
|
||||
SetCellElementStyle(toolbarBtn);
|
||||
_toolbar.Add(toolbarBtn);
|
||||
_columns.Add(column);
|
||||
|
||||
// 可伸缩控制柄
|
||||
if (column.ColumnStyle.Stretchable)
|
||||
{
|
||||
int handleWidth = 3;
|
||||
int minWidth = (int)column.ColumnStyle.MinWidth.value;
|
||||
int maxWidth = (int)column.ColumnStyle.MaxWidth.value;
|
||||
var resizeHandle = new ResizeHandle(handleWidth, toolbarBtn, minWidth, maxWidth);
|
||||
resizeHandle.ResizeChanged += (float value) =>
|
||||
{
|
||||
float width = Mathf.Clamp(value, column.ColumnStyle.MinWidth.value, column.ColumnStyle.MaxWidth.value);
|
||||
column.ColumnStyle.Width = width;
|
||||
|
||||
foreach (var element in column.CellElements)
|
||||
{
|
||||
element.style.width = width;
|
||||
element.style.minWidth = width;
|
||||
element.style.maxWidth = width;
|
||||
}
|
||||
};
|
||||
_toolbar.Add(resizeHandle);
|
||||
}
|
||||
|
||||
// 计算索引值
|
||||
column.ColumnIndex = _columns.Count - 1;
|
||||
|
||||
|
@ -289,12 +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);
|
||||
column.CellElements.Add(cellElement);
|
||||
}
|
||||
return listViewElement;
|
||||
}
|
||||
|
@ -314,12 +338,13 @@ namespace YooAsset.Editor
|
|||
StyleLength defaultStyle = new StyleLength(1f);
|
||||
element.style.paddingTop = defaultStyle;
|
||||
element.style.paddingBottom = defaultStyle;
|
||||
element.style.paddingLeft = defaultStyle;
|
||||
element.style.paddingRight = defaultStyle;
|
||||
element.style.marginTop = defaultStyle;
|
||||
element.style.marginBottom = defaultStyle;
|
||||
element.style.marginLeft = defaultStyle;
|
||||
element.style.marginRight = defaultStyle;
|
||||
|
||||
element.style.paddingLeft = 1;
|
||||
element.style.paddingRight = 1;
|
||||
element.style.marginLeft = 0;
|
||||
element.style.marginRight = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 35d99a1727f773b46bc6a7bb1a2be970
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -40,13 +40,13 @@ public class TextureSchema : ScannerSchema
|
|||
string title = "扫描所有纹理资产";
|
||||
string desc = GetUserGuide();
|
||||
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);
|
||||
report.AddHeader("安卓格式", 100);
|
||||
report.AddHeader("错误信息", 200).SetStretchable();
|
||||
report.AddHeader("错误信息", 500).SetStretchable();
|
||||
|
||||
// 获取扫描资源集合
|
||||
var searchDirectorys = scanner.Collectors.Select(c => { return c.CollectPath; });
|
||||
|
|
Loading…
Reference in New Issue