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_Style.cs | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_Style.cs (limited to 'Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_Style.cs') diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_Style.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_Style.cs new file mode 100644 index 0000000..180911c --- /dev/null +++ b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_Style.cs @@ -0,0 +1,95 @@ +using UnityEngine; +using System.Collections; + +#pragma warning disable 0649 // Disabled warnings. + +namespace TMPro +{ + + [System.Serializable] + public class TMP_Style + { + // PUBLIC PROPERTIES + + /// + /// The name identifying this style. ex. . + /// + public string name + { get { return m_Name; } set { if (value != m_Name) m_Name = value; } } + + /// + /// The hash code corresponding to the name of this style. + /// + public int hashCode + { get { return m_HashCode; } set { if (value != m_HashCode) m_HashCode = value; } } + + /// + /// The initial definition of the style. ex. . + /// + public string styleOpeningDefinition + { get { return m_OpeningDefinition; } } + + /// + /// The closing definition of the style. ex. . + /// + public string styleClosingDefinition + { get { return m_ClosingDefinition; } } + + + public int[] styleOpeningTagArray + { get { return m_OpeningTagArray; } } + + + public int[] styleClosingTagArray + { get { return m_ClosingTagArray; } } + + + // PRIVATE FIELDS + [SerializeField] + private string m_Name; + + [SerializeField] + private int m_HashCode; + + [SerializeField] + private string m_OpeningDefinition; + + [SerializeField] + private string m_ClosingDefinition; + + [SerializeField] + private int[] m_OpeningTagArray; + + [SerializeField] + private int[] m_ClosingTagArray; + + + //public TMP_Style() + //{ + //Debug.Log("New Style with Name: " + m_Name + " was created. ID: "); + //} + + + /// + /// Function to update the content of the int[] resulting from changes to OpeningDefinition & ClosingDefinition. + /// + public void RefreshStyle() + { + m_HashCode = TMP_TextUtilities.GetSimpleHashCode(m_Name); + + m_OpeningTagArray = new int[m_OpeningDefinition.Length]; + for (int i = 0; i < m_OpeningDefinition.Length; i++) + m_OpeningTagArray[i] = m_OpeningDefinition[i]; + + m_ClosingTagArray = new int[m_ClosingDefinition.Length]; + for (int i = 0; i < m_ClosingDefinition.Length; i++) + m_ClosingTagArray[i] = m_ClosingDefinition[i]; + +#if UNITY_EDITOR + // Event to update objects when styles are changed in the editor. + TMPro_EventManager.ON_TEXT_STYLE_PROPERTY_CHANGED(true); +#endif + } + + } +} -- cgit v1.2.3