1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using UnityEngine;
- using System.Collections;
- namespace TMPro.Examples
- {
-
- public class TeleType : MonoBehaviour
- {
-
-
- private string label01 = "Example <sprite=2> of using <sprite=7> <#ffa000>Graphics Inline</color> <sprite=5> with Text in <font=\"Bangers SDF\" material=\"Bangers SDF - Drop Shadow\">TextMesh<#40a0ff>Pro</color></font><sprite=0> and Unity<sprite=1>";
- private string label02 = "Example <sprite=2> of using <sprite=7> <#ffa000>Graphics Inline</color> <sprite=5> with Text in <font=\"Bangers SDF\" material=\"Bangers SDF - Drop Shadow\">TextMesh<#40a0ff>Pro</color></font><sprite=0> and Unity<sprite=2>";
- private TMP_Text m_textMeshPro;
- void Awake()
- {
-
- m_textMeshPro = GetComponent<TMP_Text>();
- m_textMeshPro.text = label01;
- m_textMeshPro.enableWordWrapping = true;
- m_textMeshPro.alignment = TextAlignmentOptions.Top;
-
-
-
-
-
-
-
-
-
- }
- IEnumerator Start()
- {
-
- m_textMeshPro.ForceMeshUpdate();
- int totalVisibleCharacters = m_textMeshPro.textInfo.characterCount;
- int counter = 0;
- int visibleCount = 0;
- while (true)
- {
- visibleCount = counter % (totalVisibleCharacters + 1);
- m_textMeshPro.maxVisibleCharacters = visibleCount;
-
- if (visibleCount >= totalVisibleCharacters)
- {
- yield return new WaitForSeconds(1.0f);
- m_textMeshPro.text = label02;
- yield return new WaitForSeconds(1.0f);
- m_textMeshPro.text = label01;
- yield return new WaitForSeconds(1.0f);
- }
- counter += 1;
- yield return new WaitForSeconds(0.05f);
- }
-
- }
- }
- }
|