update UIElements

pull/464/head
何冠峰 2025-01-22 15:16:44 +08:00
parent d72b0b10d4
commit a38b76eb8f
7 changed files with 39 additions and 9 deletions

View File

@ -32,7 +32,7 @@ namespace YooAsset.Editor
}
else
{
return 1;
return 0;
}
}
}

View File

@ -6,7 +6,12 @@ namespace YooAsset.Editor
public class ButtonCell : ITableCell, IComparable
{
public object CellValue { set; get; }
public string SearchTag { private set; get; }
public ButtonCell(string searchTag)
{
SearchTag = searchTag;
}
public object GetDisplayObject()
{
return string.Empty;

View File

@ -32,7 +32,7 @@ namespace YooAsset.Editor
}
else
{
return 1;
return 0;
}
}
}

View File

@ -32,7 +32,7 @@ namespace YooAsset.Editor
}
else
{
return 1;
return 0;
}
}
}

View File

@ -32,7 +32,7 @@ namespace YooAsset.Editor
}
else
{
return 1;
return 0;
}
}
}

View File

@ -1,8 +1,6 @@
#if UNITY_2019_4_OR_NEWER
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace YooAsset.Editor
{
@ -18,10 +16,19 @@ namespace YooAsset.Editor
/// </summary>
public IList<ITableCell> Cells { set; get; } = new List<ITableCell>();
#region 添加默认的单元格数据
public void AddButtonCell()
/// <summary>
/// 添加单元格数据
/// </summary>
public void AddCell(ITableCell cell)
{
var cell = new ButtonCell();
Cells.Add(cell);
}
#region 添加默认的单元格数据
public void AddButtonCell(string searchTag)
{
var cell = new ButtonCell(searchTag);
Cells.Add(cell);
}
public void AddAssetPathCell(string searchTag, string path)

View File

@ -52,6 +52,23 @@ namespace YooAsset.Editor
}
}
/// <summary>
/// 选中的数据列表
/// </summary>
public List<ITableData> selectedItems
{
get
{
#if UNITY_2020_3_OR_NEWER
return _listView.selectedItems.Cast<ITableData>().ToList();
#else
List<ITableData> result = new List<ITableData>();
result.Add(_listView.selectedItem as ITableData);
return result;
#endif
}
}
/// <summary>
/// 单元视图交互事件
/// </summary>
@ -76,6 +93,7 @@ namespace YooAsset.Editor
_listView = new ListView();
_listView.makeItem = MakeListViewElement;
_listView.bindItem = BindListViewElement;
_listView.selectionType = SelectionType.Multiple;
_listView.RegisterCallback<PointerDownEvent>(OnClickListItem);
#if UNITY_2022_3_OR_NEWER