From c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 19 Apr 2020 17:19:32 -0400 Subject: Inital commit --- .../Scripts/Runtime/TMP_SpriteCharacter.cs | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_SpriteCharacter.cs (limited to 'Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_SpriteCharacter.cs') diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_SpriteCharacter.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_SpriteCharacter.cs new file mode 100644 index 0000000..48af7a5 --- /dev/null +++ b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_SpriteCharacter.cs @@ -0,0 +1,74 @@ +using System; +using UnityEngine; + +namespace TMPro +{ + /// + /// A basic element of text representing a pictograph, image, sprite or emoji. + /// + [Serializable] + public class TMP_SpriteCharacter : TMP_TextElement + { + /// + /// The name of the sprite element. + /// + public string name + { + get { return m_Name; } + set + { + if (value == m_Name) + return; + + m_Name = value; + m_HashCode = TMP_TextParsingUtilities.GetHashCodeCaseSensitive(m_Name); + } + } + + /// + /// The hashcode value which is computed from the name of the sprite element. + /// This value is read-only and updated when the name of the text sprite is changed. + /// + public int hashCode { get { return m_HashCode; } } + + + // ============================================= + // Private backing fields for public properties. + // ============================================= + + [SerializeField] + private string m_Name; + + [SerializeField] + private int m_HashCode; + + + // ******************** + // CONSTRUCTORS + // ******************** + + /// + /// Default constructor. + /// + public TMP_SpriteCharacter() + { + m_ElementType = TextElementType.Sprite; + } + + /// + /// Constructor for new sprite character. + /// + /// Unicode value of the sprite character. + /// Glyph used by the sprite character. + public TMP_SpriteCharacter(uint unicode, TMP_SpriteGlyph glyph) + { + m_ElementType = TextElementType.Sprite; + + this.unicode = unicode; + this.glyphIndex = glyph.index; + this.glyph = glyph; + this.scale = 1.0f; + } + + } +} \ No newline at end of file -- cgit v1.2.3