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

Public Member Functions

override void ModifyMesh (VertexHelper vh)
 

Protected Member Functions

 CharacterSpacing ()
 

Properties

float offset [get, set]
 

Private Member Functions

MatchCollection GetRegexMatchedTags (string text, out int lengthWithoutTags)
 

Private Attributes

float m_Offset
 
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 CharacterSpacing.cs.

Constructor & Destructor Documentation

◆ CharacterSpacing()

CharacterSpacing.CharacterSpacing ( )
inlineprotected

Definition at line 37 of file CharacterSpacing.cs.

38 {
39 }

Member Function Documentation

◆ GetRegexMatchedTags()

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

Definition at line 136 of file CharacterSpacing.cs.

137 {
138 MatchCollection matchCollection = Regex.Matches(text, "<b>|</b>|<i>|</i>|<size=.*?>|</size>|<color=.*?>|</color>|<material=.*?>|</material>");
139 lengthWithoutTags = 0;
140 int num = 0;
141 foreach (Match item in matchCollection)
142 {
143 num += item.Length;
144 }
145 lengthWithoutTags = text.Length - num;
146 return matchCollection;
147 }

References item.

Referenced by ModifyMesh().

◆ ModifyMesh()

override void CharacterSpacing.ModifyMesh ( VertexHelper  vh)
inline

Definition at line 41 of file CharacterSpacing.cs.

42 {
43 if (!IsActive())
44 {
45 return;
46 }
47 vh.GetUIVertexStream(m_Verts);
48 Text component = GetComponent<Text>();
49 List<string> list = new List<string>();
50 for (int i = 0; i < component.cachedTextGenerator.lineCount; i++)
51 {
52 int startCharIdx = component.cachedTextGenerator.lines[i].startCharIdx;
53 int num = ((i < component.cachedTextGenerator.lineCount - 1) ? component.cachedTextGenerator.lines[i + 1].startCharIdx : component.text.Length);
54 list.Add(component.text.Substring(startCharIdx, num - startCharIdx));
55 }
56 float num2 = offset * (float)component.fontSize / 100f;
57 float num3 = 0f;
58 IEnumerator enumerator = null;
59 Match match = null;
60 if (component.alignment == TextAnchor.LowerLeft || component.alignment == TextAnchor.MiddleLeft || component.alignment == TextAnchor.UpperLeft)
61 {
62 num3 = 0f;
63 }
64 else if (component.alignment == TextAnchor.LowerCenter || component.alignment == TextAnchor.MiddleCenter || component.alignment == TextAnchor.UpperCenter)
65 {
66 num3 = 0.5f;
67 }
68 else if (component.alignment == TextAnchor.LowerRight || component.alignment == TextAnchor.MiddleRight || component.alignment == TextAnchor.UpperRight)
69 {
70 num3 = 1f;
71 }
72 bool flag = true;
73 int num4 = 0;
74 for (int j = 0; j < list.Count; j++)
75 {
76 if (!flag)
77 {
78 break;
79 }
80 string text = list[j];
81 int lengthWithoutTags = text.Length;
82 if (lengthWithoutTags > component.cachedTextGenerator.characterCountVisible - num4)
83 {
84 lengthWithoutTags = component.cachedTextGenerator.characterCountVisible - num4;
85 text = text.Substring(0, lengthWithoutTags) + " ";
86 lengthWithoutTags++;
87 }
88 if (component.supportRichText)
89 {
90 enumerator = GetRegexMatchedTags(text, out lengthWithoutTags).GetEnumerator();
91 match = null;
92 if (enumerator.MoveNext())
93 {
94 match = (Match)enumerator.Current;
95 }
96 }
97 bool flag2 = list[j].Length > 0 && (list[j][list[j].Length - 1] == ' ' || list[j][list[j].Length - 1] == '\n');
98 float num5 = (float)(-(lengthWithoutTags - 1 - (flag2 ? 1 : 0))) * num2 * num3;
99 float num6 = 0f;
100 for (int k = 0; k < text.Length; k++)
101 {
102 if (!flag)
103 {
104 break;
105 }
106 if (component.supportRichText && match != null && match.Index == k)
107 {
108 k += match.Length - 1;
109 num4 += match.Length - 1;
110 num6 -= 1f;
111 match = null;
112 if (enumerator.MoveNext())
113 {
114 match = (Match)enumerator.Current;
115 }
116 }
117 if (num4 * 6 + 5 >= m_Verts.Count)
118 {
119 flag = false;
120 break;
121 }
122 for (int l = 0; l < 6; l++)
123 {
124 UIVertex value = m_Verts[num4 * 6 + l];
125 value.position += Vector3.right * (num2 * num6 + num5);
126 m_Verts[num4 * 6 + l] = value;
127 }
128 num4++;
129 num6 += 1f;
130 }
131 }
132 vh.Clear();
133 vh.AddUIVertexTriangleStream(m_Verts);
134 }
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
MatchCollection GetRegexMatchedTags(string text, out int lengthWithoutTags)
List< UIVertex > m_Verts

References GetRegexMatchedTags(), if(), m_Verts, and offset.

Member Data Documentation

◆ m_Offset

float CharacterSpacing.m_Offset
private

Definition at line 14 of file CharacterSpacing.cs.

◆ m_Verts

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

Definition at line 16 of file CharacterSpacing.cs.

Referenced by ModifyMesh().

◆ REGEX_TAGS

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

Definition at line 11 of file CharacterSpacing.cs.

Property Documentation

◆ offset

float CharacterSpacing.offset
getset

Definition at line 18 of file CharacterSpacing.cs.

19 {
20 get
21 {
22 return m_Offset;
23 }
24 set
25 {
26 if (m_Offset != value)
27 {
28 m_Offset = value;
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: