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

Public Member Functions

virtual void BuildNote (UINote n, string idTopic)
 

Public Attributes

UIBook book
 
int idx
 
List< string > lines = new List<string>()
 

Detailed Description

Definition at line 31 of file UIBook.cs.

Member Function Documentation

◆ BuildNote()

virtual void UIBook.Page.BuildNote ( UINote  n,
string  idTopic 
)
inlinevirtual

Reimplemented in ContentGallery.Page.

Definition at line 39 of file UIBook.cs.

40 {
41 string text = "";
42 bool center = false;
43 bool hasSearchWord = !searchWord.IsEmpty();
44 bool skip = false;
45 UINote current = n;
46 ParseLines(lines, idTopic);
47 void Flush()
48 {
49 if (!text.IsEmpty())
50 {
51 UIItem uIItem = current.AddText(STR(text));
52 text = "";
53 if (center)
54 {
55 uIItem.text1.alignment = TextAnchor.UpperCenter;
56 }
57 LayoutElement component = uIItem.GetComponent<LayoutElement>();
58 if ((bool)component)
59 {
60 component.enabled = false;
61 }
62 }
63 }
64 void ParseLines(List<string> lines, string idTopic)
65 {
66 char c = 'a';
67 bool flag = false;
68 foreach (string line in lines)
69 {
70 string text2 = Lang.Parse(line, "test1", "test2");
71 if (text2.Length == 0)
72 {
73 if (!skip && (idTopic.IsEmpty() || flag))
74 {
75 text += Environment.NewLine;
76 }
77 }
78 else
79 {
80 c = text2[0];
81 if (!idTopic.IsEmpty())
82 {
83 if (c == '$')
84 {
85 if (flag)
86 {
87 break;
88 }
89 if (text2.Split('$')[1] == idTopic)
90 {
91 flag = true;
92 continue;
93 }
94 }
95 if (!flag)
96 {
97 continue;
98 }
99 }
100 if (book.mode == Mode.Announce)
101 {
102 switch (c)
103 {
104 case '■':
105 Flush();
106 current.AddHeader("HeaderPatch_header", line);
107 continue;
108 case '[':
109 text = text.TrimEnd(Environment.NewLine.ToCharArray());
110 Flush();
111 current.AddHeader("HeaderPatch_category", line);
112 continue;
113 case '*':
114 Flush();
115 text = line.TrimStart('*').TrimStart(' ').TrimEnd(Environment.NewLine.ToCharArray());
116 current.AddText("NoteText_list", text);
117 text = "";
118 continue;
119 }
120 }
121 if (c == '{')
122 {
123 Flush();
124 string[] array = text2.Split('}');
125 text = array[1];
126 string[] array2 = array[0].TrimStart('{').Split(array[0].Contains('|') ? '|' : ',');
127 if (!skip || !(array2[0] != "endif"))
128 {
129 switch (array2[0])
130 {
131 case "if":
132 {
133 string text5 = array2[1];
134 if (!(text5 == "cn"))
135 {
136 if (text5 == "!cn" && Lang.langCode == "CN")
137 {
138 skip = true;
139 }
140 }
141 else if (Lang.langCode != "CN")
142 {
143 skip = true;
144 }
145 break;
146 }
147 case "endif":
148 skip = false;
149 break;
150 case "include":
151 case "load":
152 {
153 string text3 = "";
154 string text4 = "";
155 if (array2[0] == "include")
156 {
157 text3 = array2[1];
158 text4 = "include";
159 }
160 else
161 {
162 text4 = array2[1];
163 text3 = array2[2];
164 }
165 text4 += ".txt";
166 string[] array3 = IO.LoadTextArray(CorePath.CorePackage.Help + text4);
167 if (array3.IsEmpty())
168 {
169 array3 = IO.LoadTextArray(CorePath.CorePackage.Text + text4);
170 }
171 if (array3.IsEmpty())
172 {
174 }
175 if (!array3.IsEmpty())
176 {
177 ParseLines(array3.ToList(), text3);
178 }
179 break;
180 }
181 case "center":
182 center = true;
183 break;
184 case "/center":
185 center = false;
186 break;
187 case "layout":
188 if (array2.Length == 1)
189 {
190 current = n;
191 }
192 else
193 {
194 current = n.AddNote(STR(array2[1]));
195 }
196 break;
197 case "nerun":
198 current.AddText("NoteText_nerun", STR(text));
199 break;
200 case "topic":
201 current.AddHeader("HeaderHelpTopic", array2[1]);
202 break;
203 case "Q":
204 current.AddText("NoteText_Q", STR(array2[1]));
205 break;
206 case "A":
207 current.AddText("NoteText_A", STR(array2[1]));
208 break;
209 case "pair":
210 current.AddTopic("TopicPair", STR(array2[1]), STR(array2[2]));
211 break;
212 case "image":
213 current.AddImage(array2[1]);
214 break;
215 case "link":
216 current.AddButtonLink(array2[1], array2[2]);
217 break;
218 case "button":
219 if (array2[1] == "close")
220 {
222 }
223 break;
224 }
225 text = "";
226 }
227 }
228 else if (!skip)
229 {
230 text = text + text2 + Environment.NewLine;
231 }
232 }
233 }
234 if (!text.IsEmpty())
235 {
236 text = text.Replace("#pc", str_pc);
237 UIItem uIItem2 = current.AddText("NoteText_help", STR(text));
238 if (center)
239 {
240 uIItem2.text1.alignment = TextAnchor.UpperCenter;
241 }
242 }
243 }
244 string STR(string s)
245 {
246 if (!hasSearchWord)
247 {
248 return s;
249 }
250 return Regex.Replace(s, searchWord, searchWord.TagColor(book.colorSearchHit), RegexOptions.IgnoreCase);
251 }
252 }
static string Help
Definition: CorePath.cs:75
static string Text
Definition: CorePath.cs:67
static string TextCommon
Definition: CorePath.cs:65
Definition: IO.cs:11
static string[] LoadTextArray(string _path)
Definition: IO.cs:470
Definition: Lang.cs:6
static string langCode
Definition: Lang.cs:28
static string Parse(string idLang, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
Definition: Lang.cs:147
UIBook book
Definition: UIBook.cs:33
List< string > lines
Definition: UIBook.cs:37
static string searchWord
Definition: UIBook.cs:257
Mode
Definition: UIBook.cs:11
string idTopic
Definition: UIBook.cs:288
Mode mode
Definition: UIBook.cs:261
void AddButtonClose()
Definition: UIBook.cs:613
static string str_pc
Definition: UIBook.cs:255
Color colorSearchHit
Definition: UIBook.cs:328
Definition: UIItem.cs:5
Definition: UINote.cs:6
UIButton AddButtonLink(string text, string url)
Definition: UINote.cs:193
UINote AddNote(string id)
Definition: UINote.cs:72
void AddImage(Sprite sprite)
Definition: UINote.cs:158
UIItem AddHeader(string text, Sprite sprite=null)
Definition: UINote.cs:79
UIItem AddTopic(string id, string text, string value=null)
Definition: UINote.cs:144
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113

References UIBook.AddButtonClose(), UINote.AddButtonLink(), UINote.AddHeader(), UINote.AddImage(), UINote.AddNote(), UINote.AddText(), UINote.AddTopic(), UIBook.Page.book, UIBook.colorSearchHit, CorePath.CorePackage.Help, UIBook.idTopic, Lang.langCode, UIBook.Page.lines, UIBook.mode, Lang.Parse(), UIBook.searchWord, UIBook.str_pc, CorePath.CorePackage.Text, and CorePath.CorePackage.TextCommon.

Member Data Documentation

◆ book

UIBook UIBook.Page.book

Definition at line 33 of file UIBook.cs.

Referenced by UIBook.Page.BuildNote().

◆ idx

int UIBook.Page.idx

Definition at line 35 of file UIBook.cs.

◆ lines

List<string> UIBook.Page.lines = new List<string>()

Definition at line 37 of file UIBook.cs.

Referenced by UIBook.Page.BuildNote().


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