暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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