58 lines
2.0 KiB
C#
58 lines
2.0 KiB
C#
#if UNITY_EDITOR
|
|
using System.Collections.Generic;
|
|
using Sirenix.OdinInspector.Editor;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace SLSUtilities.WwiseAssistance.Editor
|
|
{
|
|
public class WwiseEventSelector : GenericSelector<string>
|
|
{
|
|
public WwiseEventSelector(IEnumerable<string> items)
|
|
: base("Wwise Events", false, x => x, items)
|
|
{
|
|
this.EnableSingleClickToSelect();
|
|
|
|
// 【核心修改】禁用 Odin 自动绘制逻辑,防止它自作多情画第二个框
|
|
this.SelectionTree.Config.DrawSearchToolbar = false;
|
|
}
|
|
|
|
protected override void DrawSelectionTree()
|
|
{
|
|
// 1. 【手动绘制搜索框】
|
|
// 我们自己调用 SearchField 的绘制方法,确保只出现一次
|
|
// 放在最上面,符合默认习惯
|
|
this.SelectionTree.DrawSearchToolbar();
|
|
|
|
// 获取当前的搜索词
|
|
string currentTerm = this.SelectionTree.Config.SearchTerm;
|
|
|
|
// 2. 控制列表显示逻辑
|
|
if (string.IsNullOrEmpty(currentTerm))
|
|
{
|
|
// --- 空状态:显示提示 ---
|
|
GUILayout.FlexibleSpace();
|
|
|
|
var style = new GUIStyle(EditorStyles.centeredGreyMiniLabel)
|
|
{
|
|
fontSize = 12,
|
|
wordWrap = true
|
|
};
|
|
GUILayout.Label("Type to search Wwise Event...", style);
|
|
|
|
GUILayout.FlexibleSpace();
|
|
}
|
|
else
|
|
{
|
|
// --- 有内容:绘制列表 ---
|
|
// 绘制一根细线做分割(可选,为了美观)
|
|
Sirenix.Utilities.Editor.SirenixEditorGUI.HorizontalLineSeparator();
|
|
|
|
// 绘制列表树
|
|
// 因为 DrawSearchToolbar 已经是 false 了,这里只会画纯粹的列表
|
|
this.SelectionTree.DrawMenuTree();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif |