暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TilePaletteBrushesDropdownMenu.cs 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using UnityEngine;
  2. using UnityEngine.UIElements;
  3. namespace UnityEditor.Tilemaps
  4. {
  5. internal class TilePaletteBrushesDropdownMenu : IGenericMenu
  6. {
  7. private const float k_BrushDropdownWidth = 150f;
  8. private GridBrushesDropdown m_Dropdown;
  9. public TilePaletteBrushesDropdownMenu()
  10. {
  11. m_Dropdown = new GridBrushesDropdown(SelectBrush, k_BrushDropdownWidth);
  12. }
  13. public void AddItem(string itemName, bool isChecked, System.Action action)
  14. {
  15. }
  16. public void AddItem(string itemName, bool isChecked, System.Action<object> action, object data)
  17. {
  18. }
  19. public void AddDisabledItem(string itemName, bool isChecked)
  20. {
  21. }
  22. public void AddSeparator(string path)
  23. {
  24. }
  25. public void DropDown(Rect position, VisualElement targetElement = null, bool anchored = false)
  26. {
  27. PopupWindow.Show(position, m_Dropdown);
  28. }
  29. private void SelectBrush(int i, object o)
  30. {
  31. GridPaintingState.gridBrush = GridPaletteBrushes.brushes[i];
  32. }
  33. }
  34. }