com.alicizax.unity.editor.e.../Editor/Toolbar/GroupDefinitions/GroupElement.cs
2025-08-01 19:32:29 +08:00

29 lines
749 B
C#

using System.Linq;
using UnityEditor.Toolbars;
using UnityEngine.UIElements;
namespace Paps.UnityToolbarExtenderUIToolkit
{
internal class GroupElement : EditorToolbarDropdown
{
private VisualElement[] _groupedElements;
public VisualElement[] GroupedElements => _groupedElements.ToArray();
public GroupElement(string name)
{
this.name = name;
text = name;
clicked += ShowDropdown;
}
public void Initialize(VisualElement[] groupedElements)
{
_groupedElements = groupedElements;
}
private void ShowDropdown()
{
GroupDropdownWindowPopupManager.Show(worldBound, _groupedElements);
}
}
}