mirror of https://github.com/tuyoogame/YooAsset
update UIElements
parent
5e2fc84ebf
commit
7c435f6dc0
|
@ -0,0 +1,40 @@
|
||||||
|
#if UNITY_2019_4_OR_NEWER
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class BooleanValueCell : ITableCell, IComparable
|
||||||
|
{
|
||||||
|
public object CellValue { set; get; }
|
||||||
|
public string HeaderTitle { private set; get; }
|
||||||
|
public bool BooleanValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (bool)CellValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BooleanValueCell(string headerTitle, object cellValue)
|
||||||
|
{
|
||||||
|
HeaderTitle = headerTitle;
|
||||||
|
CellValue = cellValue;
|
||||||
|
}
|
||||||
|
public object GetDisplayObject()
|
||||||
|
{
|
||||||
|
return CellValue.ToString();
|
||||||
|
}
|
||||||
|
public int CompareTo(object other)
|
||||||
|
{
|
||||||
|
if (other is BooleanValueCell cell)
|
||||||
|
{
|
||||||
|
return this.BooleanValue.CompareTo(cell.BooleanValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f7b1e743b81646b49b2c05721edcf9b4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -34,16 +34,21 @@ namespace YooAsset.Editor
|
||||||
var cell = new StringValueCell(headerTitle, value);
|
var cell = new StringValueCell(headerTitle, value);
|
||||||
Cells.Add(cell);
|
Cells.Add(cell);
|
||||||
}
|
}
|
||||||
public void AddIntegerValueCell(string headerTitle, long value)
|
public void AddLongValueCell(string headerTitle, long value)
|
||||||
{
|
{
|
||||||
var cell = new IntegerValueCell(headerTitle, value);
|
var cell = new IntegerValueCell(headerTitle, value);
|
||||||
Cells.Add(cell);
|
Cells.Add(cell);
|
||||||
}
|
}
|
||||||
public void AddSingleValueCell(string headerTitle, double value)
|
public void AddDoubleValueCell(string headerTitle, double value)
|
||||||
{
|
{
|
||||||
var cell = new SingleValueCell(headerTitle, value);
|
var cell = new SingleValueCell(headerTitle, value);
|
||||||
Cells.Add(cell);
|
Cells.Add(cell);
|
||||||
}
|
}
|
||||||
|
public void AddBoolValueCell(string headerTitle, bool value)
|
||||||
|
{
|
||||||
|
var cell = new BooleanValueCell(headerTitle, value);
|
||||||
|
Cells.Add(cell);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,16 @@ namespace YooAsset.Editor
|
||||||
this.Add(_listView);
|
this.Add(_listView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置标题
|
||||||
|
/// </summary>
|
||||||
|
public void SetHeaderTitle(string elementName, string headerTitle)
|
||||||
|
{
|
||||||
|
var toolbarBtn = _toolbar.Q<ToolbarButton>(elementName);
|
||||||
|
if (toolbarBtn != null)
|
||||||
|
toolbarBtn.text = headerTitle;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加单元列
|
/// 添加单元列
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue