1 Color
(1)<color=yellow>Yellow</color> (2)<#00ff00>Green (3)透明度:<alpha=#CC> <alpha=#30>
2 Style
2.1 粗体(Blod)
<b>Bold</b>
2.2 斜体(Italics)
<i>Italics</i>
3 Line
3.2 下划线(Underline)
<u>Underline</u>
3.2 删除线(Strikethrough)
<s>Strikethrough</s>
4 Superscript and Subscript
4.1 上标(Sup)
Superscript - X<sup>3</sup>
4.2 下标(Sub)
Subscript - v<sub>x</sub>
5 标记(Highlighting)
<mark=#00000060>Highlighting</mark>
颜色为8位,支持a通道。
6 大小写
6.1 all caps
<allcaps>all caps</allcaps>
6.2 small caps
The <smallcaps>small caps</smallcaps>
6.3 upper case
<uppercase>upper case</uppercase>
6.4 lower case
<lowercase>LOWER CASE</lowercase>
7 字间距(Character spacing)
<cspace=0.3em>Character spacing</cspace> em是一个相对单位
8 等宽字(Mono spaced)
<mspace=1em>Character spacing</cspace>
9 行高 line height
<line-height=75>line height<line-height=75>
10 nobr(不换行)
<nobr>No Line-Break</nobr>
11 Size
<size=20>Size 20</size> <size=80%>Size 80%</size> <size=1.2em>Size 1.2em</size>
12 图文混排
<sprite="DropCap Numbers" index=11>
13 缩进、偏移
缩进: <indent=3em>indent</indent> 偏移:<pos=110>
14 布局
居中:<align=center>center</align> 居左:<align=center>left</align> 居右:<align=right>right</align> 两端对齐尾行居左:<align=justified>justified</align> 两端对齐:<align=flush>flush</align>
15 超链接
<link="linkID">link</link>
C#代码:
public class Test : MonoBehaviour, IPointerClickHandler
{
private TextMeshProUGUI textMeshPro;
private void Start()
{
textMeshPro = GetComponent<TextMeshProUGUI>();
}
public void OnPointerClick(PointerEventData eventData)
{
Vector3 pos = new Vector3(eventData.position.x, eventData.position.y, 0);
int linkIndex = TMP_TextUtilities.FindIntersectingLink(textMeshPro, pos, null);
if (linkIndex > -1)
{
TMP_LinkInfo linkInfo = textMeshPro.textInfo.linkInfo[linkIndex];
Debug.Log(linkInfo.GetLinkID());
}
}
}
|