Elin Modding Docs Doc
Loading...
Searching...
No Matches
WidgetMainText.cs
1using System;
2using UnityEngine;
3
4// Token: 0x0200061E RID: 1566
5public class WidgetMainText : Widget
6{
7 // Token: 0x06002BA8 RID: 11176 RVA: 0x000F561B File Offset: 0x000F381B
8 public override object CreateExtra()
9 {
10 return new WidgetMainText.Extra();
11 }
12
13 // Token: 0x17000C8B RID: 3211
14 // (get) Token: 0x06002BA9 RID: 11177 RVA: 0x000F5622 File Offset: 0x000F3822
15 public WidgetMainText.Extra extra
16 {
17 get
18 {
19 return base.config.extra as WidgetMainText.Extra;
20 }
21 }
22
23 // Token: 0x17000C8C RID: 3212
24 // (get) Token: 0x06002BAA RID: 11178 RVA: 0x000F5634 File Offset: 0x000F3834
25 public override bool ShowStyleMenu
26 {
27 get
28 {
29 return false;
30 }
31 }
32
33 // Token: 0x17000C8D RID: 3213
34 // (get) Token: 0x06002BAB RID: 11179 RVA: 0x000F5637 File Offset: 0x000F3837
35 public override bool AlwaysTop
36 {
37 get
38 {
39 return true;
40 }
41 }
42
43 // Token: 0x06002BAC RID: 11180 RVA: 0x000F563C File Offset: 0x000F383C
44 public override void OnActivate()
45 {
46 bool flag = true;
47 if (WidgetMainText.boxBk)
48 {
49 UnityEngine.Object.DestroyImmediate(this.box.gameObject);
50 this.box = WidgetMainText.boxBk;
51 WidgetMainText.boxBk.transform.SetParent(base.transform, false);
52 WidgetMainText.boxBk.GetComponentInChildren<UIDragPanel>(true).SetTarget(this.Rect());
53 WidgetMainText.boxBk = null;
54 flag = false;
55 }
56 this.dragPanel = this.box.dragPanel;
57 this.imageBG = this.box.imageBg;
58 WidgetMainText.Instance = this;
59 this.box.maxBlock = this.extra.maxLine;
60 this.box.fadeLines = this.extra.fadeLines;
61 if (base.config.skin.bgColor.Equals(new Color(0f, 0f, 0f, 0f)))
62 {
63 base.config.skin.bgColor = EMono.core.refs.bg_msg[this.extra.bg].color;
64 }
65 this.RefreshBG();
66 this.OnChangeResolution();
67 this.box.Init();
68 if (flag)
69 {
70 this.Append("welcome_intro".langGame(EMono.core.version.GetText(), null, null, null), null);
71 this.Append(this.spriteElin);
72 this.NewLine();
73 this.Append("welcome".langGame(EInput.keys.report.key.ToString() ?? "", null, null, null), null);
74 this.NewLine();
75 }
76 this._Refresh();
77 }
78
79 // Token: 0x06002BAD RID: 11181 RVA: 0x000F57F3 File Offset: 0x000F39F3
80 public void RefreshBG()
81 {
82 this.box.SetBG(EMono.core.refs.bg_msg[this.extra.bg], base.config.skin.bgColor);
83 }
84
85 // Token: 0x06002BAE RID: 11182 RVA: 0x000F582F File Offset: 0x000F3A2F
86 public void Append(string s, Point pos = null)
87 {
88 this.Append(s, Msg.colors.Default, pos);
89 }
90
91 // Token: 0x06002BAF RID: 11183 RVA: 0x000F5844 File Offset: 0x000F3A44
92 public void Append(string s, Color col, Point pos = null)
93 {
94 if (s.IsEmpty() || s == " ")
95 {
96 return;
97 }
98 if (pos != null)
99 {
100 this.box.Load("MsgFocus").button1.onClick.AddListener(delegate()
101 {
102 EMono.screen.Focus(pos);
103 });
104 }
105 if (s.StartsWith("*"))
106 {
107 s = " " + s;
108 }
109 if (Lang.setting.useSpace)
110 {
111 s += " ";
112 if (s[0] == ' ')
113 {
114 s = s.TrimStart(' ');
115 }
116 }
117 else if (s.EndsWith("*"))
118 {
119 s += " ";
120 }
121 if (MsgBlock.lastBlock != null && MsgBlock.lastText == s)
122 {
123 MsgBlock lastBlock = MsgBlock.lastBlock;
124 if (lastBlock.txt != null)
125 {
126 UIText txt = lastBlock.txt;
127 lastBlock.repeat++;
128 string text = txt.text;
129 if (text.EndsWith(") ") && text.Contains("(x"))
130 {
131 text = text.Substring(0, text.IndexOf("(x"));
132 }
133 txt.text = text + "(x" + (lastBlock.repeat + 1).ToString() + ") ";
134 if (lastBlock.repeat == 1)
135 {
136 txt.RebuildLayout(false);
137 this.box.RebuildLayout(true);
138 }
139 return;
140 }
141 }
142 this.box.Append(s, col);
143 this._Refresh();
144 }
145
146 // Token: 0x06002BB0 RID: 11184 RVA: 0x000F59E2 File Offset: 0x000F3BE2
147 public void Append(Sprite sprite)
148 {
149 this.box.Append(sprite, false);
150 this._Refresh();
151 }
152
153 // Token: 0x06002BB1 RID: 11185 RVA: 0x000F59F7 File Offset: 0x000F3BF7
154 public static void HideLog()
155 {
156 if (!WidgetMainText.Instance || !WidgetMainText.Instance.box.isShowingLog)
157 {
158 return;
159 }
160 WidgetMainText.Instance._ToggleLog();
161 }
162
163 // Token: 0x06002BB2 RID: 11186 RVA: 0x000F5A21 File Offset: 0x000F3C21
164 public static void ToggleLog()
165 {
166 if (!WidgetMainText.Instance)
167 {
168 EMono.ui.widgets.Activate("MainText");
169 }
170 WidgetMainText.Instance._ToggleLog();
171 SE.ClickGeneral();
172 }
173
174 // Token: 0x06002BB3 RID: 11187 RVA: 0x000F5A54 File Offset: 0x000F3C54
175 public void _ToggleLog()
176 {
177 this.box.ToggleLog();
178 this._Refresh();
179 if (this.box.isShowingLog)
180 {
181 if (WidgetFeed.Instance)
182 {
183 WidgetFeed.Instance.pop.KillAll(false);
184 }
185 this.box.RebuildLayout(true);
186 }
187 }
188
189 // Token: 0x06002BB4 RID: 11188 RVA: 0x000F5AA7 File Offset: 0x000F3CA7
190 public void NewLine()
191 {
192 this.box.MarkNewBlock();
193 }
194
195 // Token: 0x06002BB5 RID: 11189 RVA: 0x000F5AB4 File Offset: 0x000F3CB4
196 public static void Refresh()
197 {
198 if (WidgetMainText.Instance)
199 {
200 WidgetMainText.Instance._Refresh();
201 }
202 }
203
204 // Token: 0x06002BB6 RID: 11190 RVA: 0x000F5ACC File Offset: 0x000F3CCC
205 private void _Refresh()
206 {
207 this.box.SetActive(this.box.isShowingLog || !WidgetFeed.Intercept, delegate(bool enabled)
208 {
209 if (enabled)
210 {
211 this.box.RebuildLayout(true);
212 }
213 });
214 }
215
216 // Token: 0x06002BB7 RID: 11191 RVA: 0x000F5B00 File Offset: 0x000F3D00
217 public override void OnSetContextMenu(UIContextMenu m)
218 {
219 SkinConfig cfg = base.config.skin;
220 UIContextMenu uicontextMenu = m.AddChild("setting");
221 uicontextMenu.AddSlider("msgLines", (float n) => n.ToString() ?? "", (float)this.box.maxBlock, delegate(float a)
222 {
223 this.box.maxBlock = (int)a;
224 this.extra.maxLine = (int)a;
225 }, 2f, 10f, true, false, false);
226 uicontextMenu.AddSlider("width", (float a) => a.ToString() ?? "", (float)this.extra.width, delegate(float a)
227 {
228 this.extra.width = (int)a;
229 this.OnChangeResolution();
230 }, 30f, 100f, true, true, false);
231 UIContextMenu uicontextMenu2 = m.AddChild("style");
232 uicontextMenu2.AddToggle("fadeLines", this.extra.fadeLines, delegate(bool a)
233 {
234 WidgetMainText.Extra extra = this.extra;
235 this.box.fadeLines = a;
236 extra.fadeLines = a;
237 this.box.RefreshAlpha();
238 });
239 uicontextMenu2.AddSlider("changeBG", (float n) => n.ToString() + "/" + (EMono.core.refs.bg_msg.Count - 1).ToString(), (float)this.extra.bg, delegate(float a)
240 {
241 this.extra.bg = (int)a;
242 cfg.bgColor = EMono.core.refs.bg_msg[this.extra.bg].color;
243 this.RefreshBG();
244 }, 0f, (float)(EMono.core.refs.bg_msg.Count - 1), true, true, false);
245 Action<PickerState, Color> <>9__8;
246 uicontextMenu2.AddButton("colorBG", delegate()
247 {
248 LayerColorPicker layerColorPicker = EMono.ui.AddLayer<LayerColorPicker>();
249 Color bgColor = cfg.bgColor;
250 Color color = EMono.ui.skins.skinSets[cfg.id].bgs[cfg.bg].color;
251 Action<PickerState, Color> onChangeColor;
252 if ((onChangeColor = <>9__8) == null)
253 {
254 onChangeColor = (<>9__8 = delegate(PickerState state, Color _c)
255 {
256 cfg.bgColor = _c;
257 this.RefreshBG();
258 });
259 }
260 layerColorPicker.SetColor(bgColor, color, onChangeColor);
261 }, true);
262 base.SetBaseContextMenu(m);
263 }
264
265 // Token: 0x06002BB8 RID: 11192 RVA: 0x000F5C84 File Offset: 0x000F3E84
266 public override void OnChangeResolution()
267 {
268 base.OnChangeResolution();
269 RectTransform rectTransform = this.Rect();
270 rectTransform.sizeDelta = new Vector2(0.01f * (float)Screen.width * (float)this.extra.width, rectTransform.sizeDelta.y);
271 }
272
273 // Token: 0x04001859 RID: 6233
274 public static WidgetMainText Instance;
275
276 // Token: 0x0400185A RID: 6234
277 public static MsgBox boxBk;
278
279 // Token: 0x0400185B RID: 6235
280 public MsgBox box;
281
282 // Token: 0x0400185C RID: 6236
283 private UIItem currentItem;
284
285 // Token: 0x0400185D RID: 6237
286 public UIItem moldLine;
287
288 // Token: 0x0400185E RID: 6238
289 public int visibleLines;
290
291 // Token: 0x0400185F RID: 6239
292 public Transform layout;
293
294 // Token: 0x04001860 RID: 6240
295 public Sprite spriteElin;
296
297 // Token: 0x04001861 RID: 6241
298 public Sprite spriteDestroy;
299
300 // Token: 0x04001862 RID: 6242
301 public Sprite spriteEther;
302
303 // Token: 0x04001863 RID: 6243
304 [NonSerialized]
305 public bool newLine = true;
306
307 // Token: 0x02000B8C RID: 2956
308 public class Extra
309 {
310 // Token: 0x04002E5F RID: 11871
311 public int maxLine;
312
313 // Token: 0x04002E60 RID: 11872
314 public int bg;
315
316 // Token: 0x04002E61 RID: 11873
317 public int width;
318
319 // Token: 0x04002E62 RID: 11874
320 public bool fadeLines;
321 }
322}
Definition EMono.cs:6
Definition Msg.cs:7
Definition Point.cs:11