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

TilePaletteClipboardErrorElement.cs 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using UnityEngine.UIElements;
  2. namespace UnityEditor.Tilemaps
  3. {
  4. [UxmlElement]
  5. public partial class TilePaletteClipboardErrorElement : VisualElement
  6. {
  7. private static readonly string ussClassName = "unity-tilepalette-clipboard-error-element";
  8. private static readonly string k_Name = L10n.Tr("Tile Palette Clipboard Error Element");
  9. static class Styles
  10. {
  11. public static readonly string emptyPaletteInfo = L10n.Tr("Drag Tile, Sprite or Texture (Sprite type) asset/s here.");
  12. public static readonly string invalidPaletteInfo = L10n.Tr("This is an invalid palette. Did you delete the palette asset?");
  13. public static readonly string invalidGridInfo = L10n.Tr("The palette has an invalid Grid. Did you add a Grid to the palette asset?");
  14. public static readonly string invalidDragAndDropInfo = L10n.Tr("You have dragged invalid items to the palette.");
  15. }
  16. private Label m_LabelElement;
  17. public TilePaletteClipboardErrorElement()
  18. {
  19. AddToClassList(ussClassName);
  20. name = k_Name;
  21. TilePaletteOverlayUtility.SetStyleSheet(this);
  22. m_LabelElement = new Label();
  23. Add(m_LabelElement);
  24. }
  25. public void SetEmptyPaletteText()
  26. {
  27. m_LabelElement.text = Styles.emptyPaletteInfo;
  28. }
  29. public void SetInvalidPaletteText()
  30. {
  31. m_LabelElement.text = Styles.invalidPaletteInfo;
  32. }
  33. public void SetInvalidGridText()
  34. {
  35. m_LabelElement.text = Styles.invalidGridInfo;
  36. }
  37. public void SetInvalidDragAndDropText()
  38. {
  39. m_LabelElement.text = Styles.invalidDragAndDropInfo;
  40. }
  41. public void ClearText()
  42. {
  43. m_LabelElement.text = null;
  44. }
  45. }
  46. }