Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerList.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.Events;
5
6// Token: 0x02000599 RID: 1433
7public class LayerList : ELayer
8{
9 // Token: 0x06002744 RID: 10052 RVA: 0x000DE724 File Offset: 0x000DC924
10 protected override void Awake()
11 {
12 base.Awake();
13 if (this.buttonReroll)
14 {
15 this.buttonReroll.SetActive(false);
16 }
17 }
18
19 // Token: 0x06002745 RID: 10053 RVA: 0x000DE745 File Offset: 0x000DC945
20 public override void OnInit()
21 {
22 if (this.highlightTarget)
23 {
24 this.highlightTarget.DoHighlightTransition(false);
25 }
26 EInput.WaitReleaseKey();
27 }
28
29 // Token: 0x06002746 RID: 10054 RVA: 0x000DE768 File Offset: 0x000DC968
30 public override void OnUpdateInput()
31 {
32 foreach (UIList.ButtonPair buttonPair in this.list.buttons)
33 {
34 ItemGeneral itemGeneral = buttonPair.component as ItemGeneral;
35 UIButton uibutton = itemGeneral ? itemGeneral.button1 : (buttonPair.component as UIButton);
36 if (uibutton && uibutton.interactable && !EInput.waitReleaseAnyKey && uibutton.keyText && !uibutton.keyText.text.IsEmpty() && uibutton.keyText.text == Input.inputString)
37 {
38 SE.ClickOk();
39 uibutton.onClick.Invoke();
40 return;
41 }
42 }
43 base.OnUpdateInput();
44 }
45
46 // Token: 0x06002747 RID: 10055 RVA: 0x000DE84C File Offset: 0x000DCA4C
47 public LayerList SetMold(int index)
48 {
49 if (index != 0)
50 {
51 if (index == 1)
52 {
53 this.list.moldItem = this.moldItemDetail;
54 }
55 }
56 else
57 {
58 this.list.moldItem = this.moldItemGeneral;
59 }
60 return this;
61 }
62
63 // Token: 0x06002748 RID: 10056 RVA: 0x000DE87C File Offset: 0x000DCA7C
64 public LayerList SetSize(float w = 450f, float h = -1f)
65 {
66 Vector2 sizeDelta = this.windows[0].Rect().sizeDelta;
67 this.windows[0].Rect().sizeDelta = new Vector2((w == -1f) ? sizeDelta.x : w, (h == -1f) ? sizeDelta.y : h);
68 if (w != -1f)
69 {
70 this.autoX = false;
71 }
72 if (h != -1f)
73 {
74 this.autoY = false;
75 }
76 return this;
77 }
78
79 // Token: 0x06002749 RID: 10057 RVA: 0x000DE8FC File Offset: 0x000DCAFC
80 public LayerList SetPivot(float x, float y = -1f)
81 {
82 this.windows[0].Rect().pivot = new Vector2(x, y);
83 return this;
84 }
85
86 // Token: 0x0600274A RID: 10058 RVA: 0x000DE91C File Offset: 0x000DCB1C
87 public void RefreshSize()
88 {
89 RectTransform rectTransform = this.windows[0].Rect();
90 float x = rectTransform.sizeDelta.x;
91 float y = rectTransform.sizeDelta.y;
92 this.RebuildLayout(true);
93 Vector2 sizeDelta = this.scroll.content.Rect().sizeDelta;
94 if (this.autoX)
95 {
96 x = Mathf.Clamp(sizeDelta.x, this.sizeMin.x, this.sizeMax.x) + this.paddings.x;
97 }
98 if (this.autoY)
99 {
100 y = Mathf.Clamp(sizeDelta.y, this.sizeMin.y, this.sizeMax.y) + this.paddings.y;
101 }
102 rectTransform.sizeDelta = new Vector2(x, y);
103 }
104
105 // Token: 0x0600274B RID: 10059 RVA: 0x000DE9E8 File Offset: 0x000DCBE8
106 public LayerList SetList<TValue>(ICollection<TValue> items, Func<TValue, string> getString, Action<int, string> onSelect, bool autoClose = true)
107 {
108 List<string> strs = new List<string>();
109 foreach (TValue arg in items)
110 {
111 strs.Add(getString(arg));
112 }
113 this.SetStringList(() => strs, onSelect, autoClose);
114 return this;
115 }
116
117 // Token: 0x0600274C RID: 10060 RVA: 0x000DEA64 File Offset: 0x000DCC64
118 public LayerList SetStringList(Func<ICollection<string>> getList, Action<int, string> onSelect, bool autoClose = true)
119 {
120 this.list.callbacks = new UIList.Callback<string, ItemGeneral>
121 {
122 onClick = delegate(string a, ItemGeneral b)
123 {
124 onSelect(this.list.items.IndexOf(a), a);
125 if (autoClose)
126 {
127 this.Close();
128 }
129 },
130 onInstantiate = delegate(string a, ItemGeneral item)
131 {
132 item.button1.mainText.text = a;
133 item.DisableIcon();
134 item.Build();
135 if (this.noSound)
136 {
137 item.button1.soundClick = null;
138 }
139 },
140 onList = delegate(UIList.SortMode m)
141 {
142 foreach (string o in getList())
143 {
144 this.list.Add(o);
145 }
146 }
147 };
148 this.list.List(false);
149 this.RefreshSize();
150 return this;
151 }
152
153 // Token: 0x0600274D RID: 10061 RVA: 0x000DEAEC File Offset: 0x000DCCEC
154 public LayerList SetList2<TValue>(ICollection<TValue> _list, Func<TValue, string> getText, Action<TValue, ItemGeneral> onClick, Action<TValue, ItemGeneral> onInstantiate, bool autoClose = true)
155 {
156 this.list.callbacks = new UIList.Callback<TValue, ItemGeneral>
157 {
158 onClick = delegate(TValue a, ItemGeneral b)
159 {
160 onClick(a, b);
161 if (autoClose)
162 {
163 this.Close();
164 }
165 },
166 onInstantiate = delegate(TValue a, ItemGeneral item)
167 {
168 item.button1.mainText.text = getText(a);
169 item.DisableIcon();
170 item.Build();
171 onInstantiate(a, item);
172 },
173 onList = delegate(UIList.SortMode m)
174 {
175 foreach (TValue tvalue in _list)
176 {
177 this.list.Add(tvalue);
178 }
179 }
180 };
181 this.list.List(false);
182 this.RefreshSize();
183 UIButton.TryShowTip(base.transform, true, true);
184 return this;
185 }
186
187 // Token: 0x0600274E RID: 10062 RVA: 0x000DEB94 File Offset: 0x000DCD94
188 public LayerList SetListCheck<TValue>(ICollection<TValue> _list, Func<TValue, string> getText, Action<TValue, ItemGeneral> onClick, Action<List<UIList.ButtonPair>> onValidate)
189 {
190 LayerList.<>c__DisplayClass24_0<TValue> CS$<>8__locals1 = new LayerList.<>c__DisplayClass24_0<TValue>();
191 CS$<>8__locals1.onValidate = onValidate;
192 CS$<>8__locals1.<>4__this = this;
193 CS$<>8__locals1.getText = getText;
194 CS$<>8__locals1.onClick = onClick;
195 CS$<>8__locals1._list = _list;
196 this.list.moldItem = this.moldItemCheck.transform;
197 BaseList baseList = this.list;
198 UIList.Callback<TValue, ItemGeneral> callback = new UIList.Callback<TValue, ItemGeneral>();
199 callback.onClick = delegate(TValue a, ItemGeneral b)
200 {
201 };
202 callback.onInstantiate = delegate(TValue a, ItemGeneral item)
203 {
204 item.button1.mainText.text = CS$<>8__locals1.getText(a);
205 item.DisableIcon();
206 item.Build();
207 item.button1.SetOnClick(delegate
208 {
209 CS$<>8__locals1.onClick(a, item);
210 CS$<>8__locals1.<SetListCheck>g__Validate|0();
211 });
212 };
213 callback.onList = delegate(UIList.SortMode m)
214 {
215 foreach (TValue tvalue in CS$<>8__locals1._list)
216 {
217 CS$<>8__locals1.<>4__this.list.Add(tvalue);
218 }
219 };
220 baseList.callbacks = callback;
221 this.list.List(false);
222 CS$<>8__locals1.<SetListCheck>g__Validate|0();
223 this.RefreshSize();
224 UIButton.TryShowTip(base.transform, true, true);
225 return this;
226 }
227
228 // Token: 0x0600274F RID: 10063 RVA: 0x000DEC64 File Offset: 0x000DCE64
229 public LayerList EnableReroll()
230 {
231 this.buttonReroll.SetActive(true);
232 this.buttonReroll.onClick.RemoveAllListeners();
233 this.buttonReroll.onClick.AddListener(delegate()
234 {
235 this.list.List(false);
236 });
237 this.list.RebuildLayout(true);
238 this.RefreshSize();
239 return this;
240 }
241
242 // Token: 0x06002750 RID: 10064 RVA: 0x000DECBC File Offset: 0x000DCEBC
243 public LayerList ManualList(Action<UIList, LayerList> onInit)
244 {
245 this.buttonReroll.SetActive(false);
246 this.list.moldItem = this.moldItemGeneral;
247 onInit(this.list, this);
248 this.list.List(false);
249 this.RefreshSize();
250 return this;
251 }
252
253 // Token: 0x06002751 RID: 10065 RVA: 0x000DECFB File Offset: 0x000DCEFB
254 public LayerList SetHeader(string lang)
255 {
256 this.windows[0].SetCaption(lang.lang());
257 return this;
258 }
259
260 // Token: 0x06002752 RID: 10066 RVA: 0x000DED15 File Offset: 0x000DCF15
261 public LayerList SetNoSound()
262 {
263 this.noSound = true;
264 return this;
265 }
266
267 // Token: 0x06002753 RID: 10067 RVA: 0x000DED1F File Offset: 0x000DCF1F
268 public void SetHighlightTarget(UIButton _target)
269 {
270 this.highlightTarget = _target;
271 this.highlightTarget.DoHighlightTransition(false);
272 }
273
274 // Token: 0x06002754 RID: 10068 RVA: 0x000DED34 File Offset: 0x000DCF34
275 private void Update()
276 {
277 if (this.highlightTarget)
278 {
279 this.highlightTarget.DoHighlightTransition(false);
280 }
281 }
282
283 // Token: 0x06002755 RID: 10069 RVA: 0x000DED4F File Offset: 0x000DCF4F
284 private void LateUpdate()
285 {
286 if (this.highlightTarget)
287 {
288 this.highlightTarget.DoHighlightTransition(false);
289 }
290 }
291
292 // Token: 0x06002756 RID: 10070 RVA: 0x000DED6A File Offset: 0x000DCF6A
293 public override void OnKill()
294 {
295 if (this.highlightTarget)
296 {
297 ELayer.core.WaitForEndOfFrame(delegate
298 {
299 if (this.highlightTarget)
300 {
301 if (!InputModuleEX.IsPointerOver(this.highlightTarget))
302 {
303 this.highlightTarget.DoNormalTransition(true);
304 return;
305 }
306 this.highlightTarget.DoHighlightTransition(false);
307 }
308 });
309 }
310 TooltipManager.Instance.HideTooltips(true);
311 TooltipManager.Instance.disableHide = null;
312 EInput.WaitReleaseKey();
313 }
314
315 // Token: 0x06002757 RID: 10071 RVA: 0x000DEDAA File Offset: 0x000DCFAA
316 public void Add(string lang, Action<int> action)
317 {
318 if (!this.initialized)
319 {
320 this.initialized = true;
321 }
322 this.customItems.Add(new LayerList.CustomItem
323 {
324 lang = lang,
325 action = action,
326 id = this.customItems.Count
327 });
328 }
329
330 // Token: 0x06002758 RID: 10072 RVA: 0x000DEDEC File Offset: 0x000DCFEC
331 public void Show(bool autoClose = true)
332 {
333 BaseList baseList = this.list;
334 UIList.Callback<LayerList.CustomItem, ItemGeneral> callback = new UIList.Callback<LayerList.CustomItem, ItemGeneral>();
335 callback.onClick = delegate(LayerList.CustomItem a, ItemGeneral b)
336 {
337 a.action(a.id);
338 if (autoClose)
339 {
340 this.Close();
341 }
342 };
343 callback.onInstantiate = delegate(LayerList.CustomItem a, ItemGeneral item)
344 {
345 item.button1.mainText.text = a.lang.lang();
346 item.DisableIcon();
347 item.Build();
348 };
349 callback.onList = delegate(UIList.SortMode m)
350 {
351 foreach (LayerList.CustomItem o in this.customItems)
352 {
353 this.list.Add(o);
354 }
355 };
356 baseList.callbacks = callback;
357 this.buttonReroll.SetActive(false);
358 this.list.List(false);
359 this.RefreshSize();
360 if (!autoClose)
361 {
362 this.windows[0].AddBottomButton("back", new UnityAction(this.Close), true);
363 }
364 }
365
366 // Token: 0x040015BF RID: 5567
367 public UIList list;
368
369 // Token: 0x040015C0 RID: 5568
370 public UIButton buttonReroll;
371
372 // Token: 0x040015C1 RID: 5569
373 public UIButton highlightTarget;
374
375 // Token: 0x040015C2 RID: 5570
376 public UIItem moldItemCheck;
377
378 // Token: 0x040015C3 RID: 5571
379 public Transform moldItemGeneral;
380
381 // Token: 0x040015C4 RID: 5572
382 public Transform moldItemDetail;
383
384 // Token: 0x040015C5 RID: 5573
385 public bool useItem;
386
387 // Token: 0x040015C6 RID: 5574
388 public bool autoX;
389
390 // Token: 0x040015C7 RID: 5575
391 public bool autoY;
392
393 // Token: 0x040015C8 RID: 5576
394 public bool noSound;
395
396 // Token: 0x040015C9 RID: 5577
397 public UIScrollView scroll;
398
399 // Token: 0x040015CA RID: 5578
400 public Vector2 sizeMin;
401
402 // Token: 0x040015CB RID: 5579
403 public Vector2 sizeMax;
404
405 // Token: 0x040015CC RID: 5580
406 public Vector2 paddings;
407
408 // Token: 0x040015CD RID: 5581
409 private bool initialized;
410
411 // Token: 0x040015CE RID: 5582
412 public List<LayerList.CustomItem> customItems = new List<LayerList.CustomItem>();
413
414 // Token: 0x02000ADB RID: 2779
415 public class CustomItem
416 {
417 // Token: 0x04002C14 RID: 11284
418 public string lang;
419
420 // Token: 0x04002C15 RID: 11285
421 public Action<int> action;
422
423 // Token: 0x04002C16 RID: 11286
424 public int id;
425 }
426}