Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
LimitVisibleCharacters Class Reference
Inheritance diagram for LimitVisibleCharacters:

Public Member Functions

override void ModifyMesh (VertexHelper vh)
 

Protected Member Functions

 LimitVisibleCharacters ()
 

Properties

int visibleCharacterCount [get, set]
 

Private Member Functions

MatchCollection GetRegexMatchedTags (string text, out int lengthWithoutTags)
 

Private Attributes

int m_VisibleCharacterCount
 
List< UIVertex > m_Verts = new List<UIVertex>()
 

Static Private Attributes

const string REGEX_TAGS = "<b>|</b>|<i>|</i>|<size=.*?>|</size>|<color=.*?>|</color>|<material=.*?>|</material>"
 

Detailed Description

Definition at line 9 of file LimitVisibleCharacters.cs.

Constructor & Destructor Documentation

◆ LimitVisibleCharacters()

LimitVisibleCharacters.LimitVisibleCharacters ( )
inlineprotected

Definition at line 37 of file LimitVisibleCharacters.cs.

38 {
39 }

Member Function Documentation

◆ GetRegexMatchedTags()

MatchCollection LimitVisibleCharacters.GetRegexMatchedTags ( string  text,
out int  lengthWithoutTags 
)
inlineprivate

Definition at line 95 of file LimitVisibleCharacters.cs.

96 {
97 MatchCollection matchCollection = Regex.Matches(text, "<b>|</b>|<i>|</i>|<size=.*?>|</size>|<color=.*?>|</color>|<material=.*?>|</material>");
98 lengthWithoutTags = 0;
99 int num = 0;
100 foreach (Match item in matchCollection)
101 {
102 num += item.Length;
103 }
104 lengthWithoutTags = text.Length - num;
105 return matchCollection;
106 }

References item.

Referenced by ModifyMesh().

◆ ModifyMesh()

override void LimitVisibleCharacters.ModifyMesh ( VertexHelper  vh)
inline

Definition at line 41 of file LimitVisibleCharacters.cs.

42 {
43 if (!IsActive())
44 {
45 return;
46 }
47 vh.GetUIVertexStream(m_Verts);
48 Text component = GetComponent<Text>();
49 List<UIVertex> list = new List<UIVertex>();
50 IEnumerator enumerator = null;
51 Match match = null;
52 string text = component.text.Substring(0, component.cachedTextGenerator.characterCountVisible);
53 int lengthWithoutTags = text.Length;
54 if (component.supportRichText)
55 {
56 enumerator = GetRegexMatchedTags(text, out lengthWithoutTags).GetEnumerator();
57 match = null;
58 if (enumerator.MoveNext())
59 {
60 match = (Match)enumerator.Current;
61 }
62 }
63 if (visibleCharacterCount >= lengthWithoutTags)
64 {
65 return;
66 }
67 int num = 0;
68 while (list.Count < visibleCharacterCount * 6)
69 {
70 bool flag = false;
71 if (component.supportRichText && match != null && match.Index == num)
72 {
73 num += match.Length - 1;
74 match = null;
75 if (enumerator.MoveNext())
76 {
77 match = (Match)enumerator.Current;
78 }
79 flag = true;
80 }
81 if (!flag)
82 {
83 for (int i = 0; i < 6; i++)
84 {
85 UIVertex item = m_Verts[num * 6 + i];
86 list.Add(item);
87 }
88 }
89 num++;
90 }
91 vh.Clear();
92 vh.AddUIVertexTriangleStream(list);
93 }
MatchCollection GetRegexMatchedTags(string text, out int lengthWithoutTags)

References GetRegexMatchedTags(), item, m_Verts, and visibleCharacterCount.

Member Data Documentation

◆ m_Verts

List<UIVertex> LimitVisibleCharacters.m_Verts = new List<UIVertex>()
private

Definition at line 16 of file LimitVisibleCharacters.cs.

Referenced by ModifyMesh().

◆ m_VisibleCharacterCount

int LimitVisibleCharacters.m_VisibleCharacterCount
private

Definition at line 14 of file LimitVisibleCharacters.cs.

◆ REGEX_TAGS

const string LimitVisibleCharacters.REGEX_TAGS = "<b>|</b>|<i>|</i>|<size=.*?>|</size>|<color=.*?>|</color>|<material=.*?>|</material>"
staticprivate

Definition at line 11 of file LimitVisibleCharacters.cs.

Property Documentation

◆ visibleCharacterCount

int LimitVisibleCharacters.visibleCharacterCount
getset

Definition at line 18 of file LimitVisibleCharacters.cs.

19 {
20 get
21 {
23 }
24 set
25 {
26 if (m_VisibleCharacterCount != value)
27 {
29 if (base.graphic != null)
30 {
31 base.graphic.SetVerticesDirty();
32 }
33 }
34 }
35 }

Referenced by ModifyMesh().


The documentation for this class was generated from the following file: