mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-19 14:50:10 +00:00
update UIElements
This commit is contained in:
@@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user