Beispiel #1
0
 public static void ON_TEXTMESHPRO_UGUI_PROPERTY_CHANGED(bool isChanged, TextMeshProUGUI obj)
 {
     if (TMPro_EventManager.TEXTMESHPRO_UGUI_PROPERTY_EVENT != null)
     {
         TMPro_EventManager.TEXTMESHPRO_UGUI_PROPERTY_EVENT(isChanged, obj);
     }
 }
Beispiel #2
0
 public static void ON_BASE_MATERIAL_CHANGED(Material mat)
 {
     if (TMPro_EventManager.BASE_MATERIAL_EVENT != null)
     {
         TMPro_EventManager.BASE_MATERIAL_EVENT(mat);
     }
 }
Beispiel #3
0
 public static void ON_DRAG_AND_DROP_MATERIAL_CHANGED(GameObject sender, Material currentMaterial, Material newMaterial)
 {
     if (TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT != null)
     {
         TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT(sender, currentMaterial, newMaterial);
     }
 }
Beispiel #4
0
 public static void ON_SPRITE_ASSET_PROPERTY_CHANGED(bool isChanged, Object obj)
 {
     if (TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT != null)
     {
         TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT(isChanged, obj);
     }
 }
Beispiel #5
0
 public static void ON_FONT_PROPERTY_CHANGED(bool isChanged, TextMeshProFont font)
 {
     if (TMPro_EventManager.FONT_PROPERTY_EVENT != null)
     {
         TMPro_EventManager.FONT_PROPERTY_EVENT(isChanged, font);
     }
 }
Beispiel #6
0
 public static void ON_COMPUTE_DT_EVENT(object Sender, Compute_DT_EventArgs e)
 {
     if (TMPro_EventManager.COMPUTE_DT_EVENT != null)
     {
         TMPro_EventManager.COMPUTE_DT_EVENT(Sender, e);
     }
 }
Beispiel #7
0
        //public TMP_Style()

        //{

        //Debug.Log("New Style with Name: " + m_Name + " was created. ID: ");

        //}



        /// <summary>

        /// Function to update the content of the int[] resulting from changes to OpeningDefinition & ClosingDefinition.

        /// </summary>

        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
        }
Beispiel #8
0
 public static void ON_PRE_RENDER_OBJECT_CHANGED()
 {
     if (TMPro_EventManager.OnPreRenderObject_Event != null)
     {
         TMPro_EventManager.OnPreRenderObject_Event();
     }
 }
Beispiel #9
0
        void DoUpdates()
        {
            // Handle objects that need updating
            int objUpdateCount = m_ObjectUpdateQueue.Count;

            for (int i = 0; i < objUpdateCount; i++)
            {
                Object obj = m_ObjectUpdateQueue[i];
                if (obj != null)
                {
                    EditorUtility.SetDirty(obj);
                }
            }

            if (objUpdateCount > 0)
            {
                //Debug.Log("Saving assets");
                //AssetDatabase.SaveAssets();

                m_ObjectUpdateQueue.Clear();
                m_ObjectUpdateQueueLookup.Clear();
            }

            // Handle objects that need re-importing
            int objReImportCount = m_ObjectReImportQueue.Count;

            for (int i = 0; i < objReImportCount; i++)
            {
                Object obj = m_ObjectReImportQueue[i];
                if (obj != null)
                {
                    //Debug.Log("Re-importing [" + obj.name + "]");
                    AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(obj));
                }
            }

            if (objReImportCount > 0)
            {
                m_ObjectReImportQueue.Clear();
                m_ObjectReImportQueueLookup.Clear();
            }

            // Handle Font Asset Definition Refresh
            for (int i = 0; i < m_FontAssetDefinitionRefreshQueue.Count; i++)
            {
                TMP_FontAsset fontAsset = m_FontAssetDefinitionRefreshQueue[i];

                if (fontAsset != null)
                {
                    fontAsset.ReadFontAssetDefinition();
                    TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, fontAsset);
                }
            }

            if (m_FontAssetDefinitionRefreshQueue.Count > 0)
            {
                m_FontAssetDefinitionRefreshQueue.Clear();
                m_FontAssetDefinitionRefreshQueueLookup.Clear();
            }
        }
        /// <summary>
        ///
        /// </summary>
        private void LoadStyleDictionaryInternal()
        {
            if (m_StyleLookupDictionary == null)
            {
                m_StyleLookupDictionary = new Dictionary <int, TMP_Style>();
            }
            else
            {
                m_StyleLookupDictionary.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_StyleLookupDictionary.ContainsKey(m_StyleList[i].hashCode))
                {
                    m_StyleLookupDictionary.Add(m_StyleList[i].hashCode, m_StyleList[i]);
                }
            }

            #if UNITY_EDITOR
            //// Event to update objects when styles are changed in the editor.
            TMPro_EventManager.ON_TEXT_STYLE_PROPERTY_CHANGED(true);
            #endif
        }
Beispiel #11
0
 public static void ON_MATERIAL_PROPERTY_CHANGED(bool isChanged, Material mat)
 {
     if (TMPro_EventManager.MATERIAL_PROPERTY_EVENT != null)
     {
         TMPro_EventManager.MATERIAL_PROPERTY_EVENT(isChanged, mat);
     }
 }
        void OnValidate()
        {
            //Debug.Log("OnValidate called on SpriteAsset.");

            //if (updateSprite)
            //{
            //UpdateSpriteArray();
            //    updateSprite = false;
            //}

            TMPro_EventManager.ON_SPRITE_ASSET_PROPERTY_CHANGED(true, this);
        }
 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 j = 0; j < m_ClosingDefinition.Length; j++)
     {
         m_ClosingTagArray[j] = m_ClosingDefinition[j];
     }
     TMPro_EventManager.ON_TEXT_STYLE_PROPERTY_CHANGED(/*isChanged:*/ true);
 }
Beispiel #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="packageName"></param>
        void ImportCallback(string packageName)
        {
            if (packageName == "TMP Essential Resources")
            {
                k_EssentialResourcesImported = true;
                TMPro_EventManager.ON_RESOURCES_LOADED();
            }
            else if (packageName == "TMP Examples & Extras")
            {
                k_ExamplesAndExtrasResourcesImported = true;
                k_IsImportingExamples = false;
            }

            Debug.Log("[" + packageName + "] have been imported.");

            AssetDatabase.importPackageCompleted -= ImportCallback;
        }
        void DoPreRenderUpdates()
        {
            // Handle Font Asset Definition Refresh
            for (int i = 0; i < m_FontAssetDefinitionRefreshQueue.Count; i++)
            {
                TMP_FontAsset fontAsset = m_FontAssetDefinitionRefreshQueue[i];

                if (fontAsset != null)
                {
                    fontAsset.ReadFontAssetDefinition();
                    TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, fontAsset);
                }
            }

            if (m_FontAssetDefinitionRefreshQueue.Count > 0)
            {
                m_FontAssetDefinitionRefreshQueue.Clear();
                m_FontAssetDefinitionRefreshQueueLookup.Clear();
            }
        }
Beispiel #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="packageName"></param>
        void ImportCallback(string packageName)
        {
            if (packageName == "TMP Essential Resources")
            {
                m_EssentialResourcesImported = true;
                TMPro_EventManager.ON_RESOURCES_LOADED();

                #if UNITY_2018_3_OR_NEWER
                SettingsService.NotifySettingsProviderChanged();
                #endif
            }
            else if (packageName == "TMP Examples & Extras")
            {
                m_ExamplesAndExtrasResourcesImported = true;
                m_IsImportingExamples = false;
            }

            Debug.Log("[" + packageName + "] have been imported.");

            AssetDatabase.importPackageCompleted -= ImportCallback;
        }
Beispiel #17
0
        /// <summary>
        ///
        /// </summary>
        private void LoadStyleDictionaryInternal()
        {
            if (m_StyleLookupDictionary == null)
            {
                m_StyleLookupDictionary = new Dictionary <int, TMP_Style>();
            }
            else
            {
                m_StyleLookupDictionary.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_StyleLookupDictionary.ContainsKey(m_StyleList[i].hashCode))
                {
                    m_StyleLookupDictionary.Add(m_StyleList[i].hashCode, m_StyleList[i]);
                }
            }

            // Add Normal Style if it does not already exists
            int normalStyleHashCode = TMP_TextParsingUtilities.GetHashCode("Normal");

            if (!m_StyleLookupDictionary.ContainsKey(normalStyleHashCode))
            {
                TMP_Style style = new TMP_Style("Normal", string.Empty, string.Empty);
                m_StyleList.Add(style);
                m_StyleLookupDictionary.Add(normalStyleHashCode, style);
            }

            #if UNITY_EDITOR
            //// Event to update objects when styles are changed in the editor.
            TMPro_EventManager.ON_TEXT_STYLE_PROPERTY_CHANGED(true);
            #endif
        }
Beispiel #18
0
 void OnPreRender()
 {
     TMPro_EventManager.ON_PRE_RENDER_OBJECT_CHANGED();
 }
Beispiel #19
0
 /// <summary>
 ///
 /// </summary>
 void OnValidate()
 {
     TMPro_EventManager.ON_SPRITE_ASSET_PROPERTY_CHANGED(true, this);
 }
Beispiel #20
0
        /// <summary>
        ///
        /// </summary>
        void OnValidate()
        {
            UpdateLookupTables();

            TMPro_EventManager.ON_SPRITE_ASSET_PROPERTY_CHANGED(true, this);
        }
Beispiel #21
0
 private void OnValidate()
 {
     TMPro_EventManager.ON_SPRITE_ASSET_PROPERTY_CHANGED(/*isChanged:*/ true, this);
 }