update UIElements

This commit is contained in:
何冠峰
2025-01-20 10:07:16 +08:00
parent 793a57647d
commit 5e2fc84ebf
8 changed files with 174 additions and 28 deletions
@@ -1,12 +1,33 @@
#if UNITY_2019_4_OR_NEWER
using UnityEditor;
namespace YooAsset.Editor
{
public class AssetPathCell : StringValueCell
{
public AssetPathCell(string headerTitle) : base(headerTitle)
public AssetPathCell(string headerTitle, object cellValue) : base(headerTitle, cellValue)
{
}
/// <summary>
/// 检视资源对象
/// Ping an asset object in the Scene like clicking it in an inspector.
/// </summary>
public bool PingAssetObject()
{
var assetPath = StringValue;
var assetGUID = AssetDatabase.AssetPathToGUID(assetPath);
if (string.IsNullOrEmpty(assetGUID))
return false;
UnityEngine.Object asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(assetPath);
if (asset == null)
return false;
Selection.activeObject = asset;
EditorGUIUtility.PingObject(asset);
return true;
}
}
}
#endif
@@ -15,9 +15,10 @@ namespace YooAsset.Editor
}
}
public IntegerValueCell(string headerTitle)
public IntegerValueCell(string headerTitle, object cellValue)
{
HeaderTitle = headerTitle;
CellValue = cellValue;
}
public object GetDisplayObject()
{
@@ -15,9 +15,10 @@ namespace YooAsset.Editor
}
}
public SingleValueCell(string headerTitle)
public SingleValueCell(string headerTitle, object cellValue)
{
HeaderTitle = headerTitle;
CellValue = cellValue;
}
public object GetDisplayObject()
{
@@ -15,9 +15,10 @@ namespace YooAsset.Editor
}
}
public StringValueCell(string headerTitle)
public StringValueCell(string headerTitle, object cellValue)
{
HeaderTitle = headerTitle;
CellValue = cellValue;
}
public object GetDisplayObject()
{