mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEditor.IMGUI.Controls;
|
|
|
|
namespace TEngine.Editor
|
|
{
|
|
internal sealed class ClickColumn : MultiColumnHeader
|
|
{
|
|
public delegate void SortInColumn();
|
|
|
|
public static Dictionary<int, SortInColumn> SortWithIndex = new Dictionary<int, SortInColumn>
|
|
{
|
|
{ 0, SortByName },
|
|
{ 1, SortByPath }
|
|
};
|
|
|
|
public ClickColumn(MultiColumnHeaderState state) : base(state) => canSort = true;
|
|
|
|
protected override void ColumnHeaderClicked(MultiColumnHeaderState.Column column, int columnIndex)
|
|
{
|
|
base.ColumnHeaderClicked(column, columnIndex);
|
|
if (SortWithIndex.ContainsKey(columnIndex))
|
|
{
|
|
SortWithIndex[columnIndex].Invoke();
|
|
ResourceReferenceInfo curWindow = EditorWindow.GetWindow<ResourceReferenceInfo>();
|
|
curWindow.mAssetTreeView.SortExpandItem();
|
|
}
|
|
}
|
|
|
|
public static void SortByName() => SortHelper.SortByName();
|
|
|
|
public static void SortByPath() => SortHelper.SortByPath();
|
|
}
|
|
} |