update UIElements

pull/497/head
何冠峰 2025-02-28 19:06:17 +08:00
parent 3069b1d1f1
commit 56ae1a8f95
4 changed files with 23 additions and 3 deletions

View File

@ -590,7 +590,8 @@ namespace YooAsset.Editor
foreach (var selectedItem in selectedItems)
{
var selectElement = selectedItem as ElementTableData;
selectElement.Element.Hidden = e.newValue;
if (selectElement != null)
selectElement.Element.Hidden = e.newValue;
}
// 重绘视图

View File

@ -22,7 +22,9 @@ namespace YooAsset.Editor
private TableView _operationTableView;
private Toolbar _bottomToolbar;
#if UNITY_2022_3_OR_NEWER
private TreeView _childTreeView;
#endif
private int _treeItemID = 0;
private List<ITableData> _sourceDatas;
@ -51,9 +53,11 @@ namespace YooAsset.Editor
CreateBottomToolbarHeaders();
// 子列表
#if UNITY_2022_3_OR_NEWER
_childTreeView = _root.Q<TreeView>("BottomTreeView");
_childTreeView.makeItem = MakeTreeViewItem;
_childTreeView.bindItem = BindTreeViewItem;
#endif
// 面板分屏
var topGroup = _root.Q<VisualElement>("TopGroup");
@ -303,8 +307,11 @@ namespace YooAsset.Editor
{
// 清空旧数据
_operationTableView.ClearAll(false, true);
#if UNITY_2022_3_OR_NEWER
_childTreeView.SetRootItems(new List<TreeViewItemData<DebugOperationInfo>>());
_childTreeView.Rebuild();
#endif
// 填充数据源
_sourceDatas = new List<ITableData>(1000);
@ -338,8 +345,10 @@ namespace YooAsset.Editor
public void ClearView()
{
_operationTableView.ClearAll(false, true);
#if UNITY_2022_3_OR_NEWER
_childTreeView.SetRootItems(new List<TreeViewItemData<DebugOperationInfo>>());
_childTreeView.Rebuild();
#endif
RebuildView(null);
}
@ -371,7 +380,7 @@ namespace YooAsset.Editor
_root.RemoveFromHierarchy();
}
#region 树状列表
#if UNITY_2022_3_OR_NEWER
private void OnOperationTableViewSelectionChanged(ITableData data)
{
var operationTableData = data as OperationTableData;
@ -508,7 +517,11 @@ namespace YooAsset.Editor
}
return rootItemList;
}
#endregion
#else
private void OnOperationTableViewSelectionChanged(ITableData data)
{
}
#endif
}
}
#endif

View File

@ -28,11 +28,14 @@ namespace YooAsset.Editor
base.SetValueWithoutNotify(newValue);
RefreshIcon();
}
#if UNITY_2021_3_OR_NEWER
protected override void ToggleValue()
{
base.ToggleValue();
RefreshIcon();
}
#endif
private void RefreshIcon()
{

View File

@ -28,11 +28,14 @@ namespace YooAsset.Editor
base.SetValueWithoutNotify(newValue);
RefreshIcon();
}
#if UNITY_2021_3_OR_NEWER
protected override void ToggleValue()
{
base.ToggleValue();
RefreshIcon();
}
#endif
private void RefreshIcon()
{