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

SceneViewOpenTilePaletteOverlay.cs 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using UnityEditor.Overlays;
  2. using UnityEditor.Toolbars;
  3. using UnityEngine;
  4. using UnityEngine.UIElements;
  5. namespace UnityEditor.Tilemaps
  6. {
  7. [Overlay(typeof(SceneView), k_OverlayId, k_DisplayName
  8. , defaultDockZone = DockZone.RightColumn
  9. , defaultDockPosition = DockPosition.Bottom
  10. , defaultDockIndex = 0
  11. , defaultLayout = Layout.Panel)]
  12. internal class SceneViewOpenTilePaletteOverlay : ToolbarOverlay, ITransientOverlay
  13. {
  14. internal const string k_OverlayId = "Scene View/Open Tile Palette";
  15. private const string k_DisplayName = "Open Tile Palette";
  16. public SceneViewOpenTilePaletteOverlay() : base(TilePaletteOpenPalette.k_ToolbarId) {}
  17. public bool visible => SceneViewOpenTilePaletteHelper.showInSceneViewActive && SceneViewOpenTilePaletteHelper.IsActive();
  18. }
  19. [EditorToolbarElement(k_ToolbarId)]
  20. sealed class TilePaletteOpenPalette : EditorToolbarButton
  21. {
  22. internal const string k_ToolbarId = "Tile Palette/Open Palette";
  23. const string k_ToolSettingsClass = "unity-tool-settings";
  24. private static string k_LabelText = L10n.Tr("Open Tile Palette");
  25. private static string k_TooltipText = L10n.Tr("Opens the Tile Palette Window");
  26. private const string k_IconPath = "Packages/com.unity.2d.tilemap/Editor/Icons/Tilemap.TilePalette.png";
  27. public TilePaletteOpenPalette() : base(SceneViewOpenTilePaletteHelper.OpenTilePalette)
  28. {
  29. name = "Open Tile Palette";
  30. AddToClassList(k_ToolSettingsClass);
  31. icon = EditorGUIUtility.LoadIconRequired(k_IconPath);
  32. text = k_LabelText;
  33. tooltip = k_TooltipText;
  34. }
  35. }
  36. }