diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-08-20 23:40:50 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-08-20 23:40:50 -0400 |
| commit | 3af4c218c0e70167db23a6303d2af30aff37d2fe (patch) | |
| tree | 927f29edcf54ab562f40f3d1c6cb69287c7f5980 /Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_StyleSheet.cs | |
| parent | b6daed0af784f4e9bc13329dd87c671b06ee1c65 (diff) | |
| download | Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.gz Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.bz2 Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.zip | |
Removed a bunch of stuff; Changes
Diffstat (limited to 'Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_StyleSheet.cs')
| -rw-r--r-- | Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_StyleSheet.cs | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_StyleSheet.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_StyleSheet.cs deleted file mode 100644 index 8d02a18..0000000 --- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_StyleSheet.cs +++ /dev/null @@ -1,131 +0,0 @@ -using UnityEngine;
-using System;
-using System.Collections.Generic;
-
-
-namespace TMPro
-{
-
- [Serializable]
- public class TMP_StyleSheet : ScriptableObject
- {
- private static TMP_StyleSheet s_Instance;
-
- [SerializeField]
- private List<TMP_Style> m_StyleList = new List<TMP_Style>(1);
- private Dictionary<int, TMP_Style> m_StyleDictionary = new Dictionary<int, TMP_Style>();
-
-
- /// <summary>
- /// Get a singleton instance of the TMP_StyleSheet
- /// </summary>
- public static TMP_StyleSheet instance
- {
- get
- {
- if (s_Instance == null)
- {
- s_Instance = TMP_Settings.defaultStyleSheet;
-
- if (s_Instance == null)
- s_Instance = Resources.Load<TMP_StyleSheet>("Style Sheets/Default Style Sheet");
-
- if (s_Instance == null) return null;
-
- // Load the style dictionary.
- s_Instance.LoadStyleDictionaryInternal();
- }
-
- return s_Instance;
- }
- }
-
-
- /// <summary>
- /// Static Function to load the Default Style Sheet.
- /// </summary>
- /// <returns></returns>
- public static TMP_StyleSheet LoadDefaultStyleSheet()
- {
- return instance;
- }
-
-
- /// <summary>
- /// Function to retrieve the Style matching the HashCode.
- /// </summary>
- /// <param name="hashCode"></param>
- /// <returns></returns>
- public static TMP_Style GetStyle(int hashCode)
- {
- return instance.GetStyleInternal(hashCode);
- }
-
-
- /// <summary>
- /// Internal method to retrieve the Style matching the Hashcode.
- /// </summary>
- /// <param name="hashCode"></param>
- /// <returns></returns>
- private TMP_Style GetStyleInternal(int hashCode)
- {
- if (m_StyleDictionary.TryGetValue(hashCode, out TMP_Style style))
- {
- return style;
- }
-
- return null;
- }
-
-
- public void UpdateStyleDictionaryKey(int old_key, int new_key)
- {
- if (m_StyleDictionary.ContainsKey(old_key))
- {
- TMP_Style style = m_StyleDictionary[old_key];
- m_StyleDictionary.Add(new_key, style);
- m_StyleDictionary.Remove(old_key);
- }
- }
-
-
- /// <summary>
- /// Function to update the internal reference to a newly assigned style sheet in the TMP Settings.
- /// </summary>
- public static void UpdateStyleSheet()
- {
- // Reset instance
- s_Instance = null;
-
- RefreshStyles();
- }
-
-
- /// <summary>
- /// Function to refresh the Style Dictionary.
- /// </summary>
- public static void RefreshStyles()
- {
- instance.LoadStyleDictionaryInternal();
- }
-
-
- /// <summary>
- ///
- /// </summary>
- private void LoadStyleDictionaryInternal()
- {
- m_StyleDictionary.Clear();
-
- // Read Styles from style list and store them into dictionary for faster access.
- for (int i = 0; i < m_StyleList.Count; i++)
- {
- m_StyleList[i].RefreshStyle();
-
- if (!m_StyleDictionary.ContainsKey(m_StyleList[i].hashCode))
- m_StyleDictionary.Add(m_StyleList[i].hashCode, m_StyleList[i]);
- }
- }
- }
-
-}
\ No newline at end of file |
