mirror of https://github.com/tuyoogame/YooAsset
update UIElements
parent
d72b0b10d4
commit
a38b76eb8f
|
@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,12 @@ namespace YooAsset.Editor
|
||||||
public class ButtonCell : ITableCell, IComparable
|
public class ButtonCell : ITableCell, IComparable
|
||||||
{
|
{
|
||||||
public object CellValue { set; get; }
|
public object CellValue { set; get; }
|
||||||
|
public string SearchTag { private set; get; }
|
||||||
|
|
||||||
|
public ButtonCell(string searchTag)
|
||||||
|
{
|
||||||
|
SearchTag = searchTag;
|
||||||
|
}
|
||||||
public object GetDisplayObject()
|
public object GetDisplayObject()
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#if UNITY_2019_4_OR_NEWER
|
#if UNITY_2019_4_OR_NEWER
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
|
@ -18,10 +16,19 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<ITableCell> Cells { set; get; } = new List<ITableCell>();
|
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);
|
Cells.Add(cell);
|
||||||
}
|
}
|
||||||
public void AddAssetPathCell(string searchTag, string path)
|
public void AddAssetPathCell(string searchTag, string path)
|
||||||
|
|
|
@ -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>
|
||||||
/// 单元视图交互事件
|
/// 单元视图交互事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -76,6 +93,7 @@ namespace YooAsset.Editor
|
||||||
_listView = new ListView();
|
_listView = new ListView();
|
||||||
_listView.makeItem = MakeListViewElement;
|
_listView.makeItem = MakeListViewElement;
|
||||||
_listView.bindItem = BindListViewElement;
|
_listView.bindItem = BindListViewElement;
|
||||||
|
_listView.selectionType = SelectionType.Multiple;
|
||||||
_listView.RegisterCallback<PointerDownEvent>(OnClickListItem);
|
_listView.RegisterCallback<PointerDownEvent>(OnClickListItem);
|
||||||
|
|
||||||
#if UNITY_2022_3_OR_NEWER
|
#if UNITY_2022_3_OR_NEWER
|
||||||
|
|
Loading…
Reference in New Issue