本项目演示如何创建自己的顶点动画着色器。场景不使用任何纹理或动画资源,所有内容都使用Shader Graph进行着色和动画处理。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

63 行
2.2 KiB

using UnityEngine;
namespace TMPro.Examples
{
public class TMP_TextEventCheck : MonoBehaviour
{
public TMP_TextEventHandler TextEventHandler;
void OnEnable()
{
if (TextEventHandler != null)
{
TextEventHandler.onCharacterSelection.AddListener(OnCharacterSelection);
TextEventHandler.onSpriteSelection.AddListener(OnSpriteSelection);
TextEventHandler.onWordSelection.AddListener(OnWordSelection);
TextEventHandler.onLineSelection.AddListener(OnLineSelection);
TextEventHandler.onLinkSelection.AddListener(OnLinkSelection);
}
}
void OnDisable()
{
if (TextEventHandler != null)
{
TextEventHandler.onCharacterSelection.RemoveListener(OnCharacterSelection);
TextEventHandler.onSpriteSelection.RemoveListener(OnSpriteSelection);
TextEventHandler.onWordSelection.RemoveListener(OnWordSelection);
TextEventHandler.onLineSelection.RemoveListener(OnLineSelection);
TextEventHandler.onLinkSelection.RemoveListener(OnLinkSelection);
}
}
void OnCharacterSelection(char c, int index)
{
Debug.Log("Character [" + c + "] at Index: " + index + " has been selected.");
}
void OnSpriteSelection(char c, int index)
{
Debug.Log("Sprite [" + c + "] at Index: " + index + " has been selected.");
}
void OnWordSelection(string word, int firstCharacterIndex, int length)
{
Debug.Log("Word [" + word + "] with first character index of " + firstCharacterIndex + " and length of " + length + " has been selected.");
}
void OnLineSelection(string lineText, int firstCharacterIndex, int length)
{
Debug.Log("Line [" + lineText + "] with first character index of " + firstCharacterIndex + " and length of " + length + " has been selected.");
}
void OnLinkSelection(string linkID, string linkText, int linkIndex)
{
Debug.Log("Link Index: " + linkIndex + " with ID [" + linkID + "] and Text \"" + linkText + "\" has been selected.");
}
}
}