Ei kuvausta
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.

TilePaletteBrushPanelButton.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 TilePaletteBrushPanelButton : EditorToolbarToggle
  8. {
  9. internal const string k_ToolbarId = "Tile Palette/Brush Panel Button";
  10. private const string k_IconPath = "Packages/com.unity.2d.tilemap/Editor/Icons/Tilemap.BrushSettings.png";
  11. public TilePaletteBrushPanelButton()
  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<TilePaletteBrushInspectorPopup>(this, new Vector2(300, 180), false);
  26. else
  27. BoolFieldOverlayPopupWindow.CloseAllWindows<TilePaletteBrushInspectorPopup>();
  28. }
  29. }
  30. }