1using System.Collections;
2using System.Collections.Generic;
3using System.Text.RegularExpressions;
7[AddComponentMenu(
"UI/ToJ Effects/Limit Visible Characters", 8)]
8[RequireComponent(typeof(Text))]
11 private const string REGEX_TAGS =
"<b>|</b>|<i>|</i>|<size=.*?>|</size>|<color=.*?>|</color>|<material=.*?>|</material>";
16 private List<UIVertex>
m_Verts =
new List<UIVertex>();
29 if (base.graphic !=
null)
31 base.graphic.SetVerticesDirty();
48 Text component = GetComponent<Text>();
49 List<UIVertex> list =
new List<UIVertex>();
50 IEnumerator enumerator =
null;
52 string text = component.text.Substring(0, component.cachedTextGenerator.characterCountVisible);
53 int lengthWithoutTags = text.Length;
54 if (component.supportRichText)
58 if (enumerator.MoveNext())
60 match = (Match)enumerator.Current;
71 if (component.supportRichText && match !=
null && match.Index == num)
73 num += match.Length - 1;
75 if (enumerator.MoveNext())
77 match = (Match)enumerator.Current;
83 for (
int i = 0; i < 6; i++)
92 vh.AddUIVertexTriangleStream(list);
97 MatchCollection matchCollection = Regex.Matches(text,
"<b>|</b>|<i>|</i>|<size=.*?>|</size>|<color=.*?>|</color>|<material=.*?>|</material>");
98 lengthWithoutTags = 0;
100 foreach (Match
item in matchCollection)
104 lengthWithoutTags = text.Length - num;
105 return matchCollection;
MatchCollection GetRegexMatchedTags(string text, out int lengthWithoutTags)
int visibleCharacterCount
int m_VisibleCharacterCount
override void ModifyMesh(VertexHelper vh)