暫無描述
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.

TilePaletteBrushPickButton.cs 1.2KB

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEditor.Toolbars;
  2. using UnityEngine;
  3. using UnityEngine.UIElements;
  4. namespace UnityEditor.Tilemaps
  5. {
  6. [EditorToolbarElement(k_ToolbarId)]
  7. internal class TilePaletteBrushPickButton : EditorToolbarToggle
  8. {
  9. internal const string k_ToolbarId = "Tile Palette/BrushPick Button";
  10. private const string k_IconPath = "Packages/com.unity.2d.tilemap/Editor/Icons/Tilemap.BrushPicks.png";
  11. public TilePaletteBrushPickButton()
  12. {
  13. TilePaletteOverlayUtility.SetStyleSheet(this);
  14. icon = EditorGUIUtility.LoadIcon(k_IconPath);
  15. var input = this.Q<VisualElement>(className: Toggle.inputUssClassName);
  16. var arrow = new VisualElement();
  17. arrow.AddToClassList("unity-icon-arrow");
  18. arrow.pickingMode = PickingMode.Ignore;
  19. input.Add(arrow);
  20. }
  21. protected override void ToggleValue()
  22. {
  23. base.ToggleValue();
  24. if (value)
  25. BoolFieldOverlayPopupWindow.ShowOverlayPopup<TilePaletteBrushPickPanelPopup>(this, new Vector2(370, 320), false);
  26. else
  27. BoolFieldOverlayPopupWindow.CloseAllWindows<TilePaletteBrushPickPanelPopup>();
  28. }
  29. }
  30. }