No Description
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.

TMP_SpriteCharacter.cs 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using UnityEngine;
  3. namespace TMPro
  4. {
  5. /// <summary>
  6. /// A basic element of text representing a pictograph, image, sprite or emoji.
  7. /// </summary>
  8. [Serializable]
  9. public class TMP_SpriteCharacter : TMP_TextElement
  10. {
  11. /// <summary>
  12. /// The name of the sprite element.
  13. /// </summary>
  14. public string name
  15. {
  16. get { return m_Name; }
  17. set { m_Name = value; }
  18. }
  19. // =============================================
  20. // Private backing fields for public properties.
  21. // =============================================
  22. [SerializeField]
  23. private string m_Name;
  24. // ********************
  25. // CONSTRUCTORS
  26. // ********************
  27. /// <summary>
  28. /// Default constructor.
  29. /// </summary>
  30. public TMP_SpriteCharacter()
  31. {
  32. m_ElementType = TextElementType.Sprite;
  33. }
  34. /// <summary>
  35. /// Constructor for new sprite character.
  36. /// </summary>
  37. /// <param name="unicode">Unicode value of the sprite character.</param>
  38. /// <param name="glyph">Glyph used by the sprite character.</param>
  39. public TMP_SpriteCharacter(uint unicode, TMP_SpriteGlyph glyph)
  40. {
  41. m_ElementType = TextElementType.Sprite;
  42. this.unicode = unicode;
  43. this.glyphIndex = glyph.index;
  44. this.glyph = glyph;
  45. this.scale = 1.0f;
  46. }
  47. /// <summary>
  48. /// Constructor for new sprite character.
  49. /// </summary>
  50. /// <param name="unicode">Unicode value of the sprite character.</param>
  51. /// <param name="spriteAsset">Sprite Asset used by this sprite character.</param>
  52. /// <param name="glyph">Glyph used by the sprite character.</param>
  53. public TMP_SpriteCharacter(uint unicode, TMP_SpriteAsset spriteAsset, TMP_SpriteGlyph glyph)
  54. {
  55. m_ElementType = TextElementType.Sprite;
  56. this.unicode = unicode;
  57. this.textAsset = spriteAsset;
  58. this.glyph = glyph;
  59. this.glyphIndex = glyph.index;
  60. this.scale = 1.0f;
  61. }
  62. /// <summary>
  63. ///
  64. /// </summary>
  65. /// <param name="unicode"></param>
  66. /// <param name="glyphIndex"></param>
  67. internal TMP_SpriteCharacter(uint unicode, uint glyphIndex)
  68. {
  69. m_ElementType = TextElementType.Sprite;
  70. this.unicode = unicode;
  71. this.textAsset = null;
  72. this.glyph = null;
  73. this.glyphIndex = glyphIndex;
  74. this.scale = 1.0f;
  75. }
  76. }
  77. }