Elin Modding Docs Doc
Loading...
Searching...
No Matches
WindowCharaMini.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using UnityEngine;
5
6// Token: 0x02000653 RID: 1619
7public class WindowCharaMini : WindowController
8{
9 // Token: 0x06002D94 RID: 11668 RVA: 0x000FEE6A File Offset: 0x000FD06A
10 public void SetChara(Chara c)
11 {
12 this.chara = c;
13 this.Refresh(0);
14 }
15
16 // Token: 0x06002D95 RID: 11669 RVA: 0x000FEE7A File Offset: 0x000FD07A
17 public override void OnSwitchContent(Window window)
18 {
19 if (this.chara == null)
20 {
21 return;
22 }
23 this.Refresh(window.idTab);
24 }
25
26 // Token: 0x06002D96 RID: 11670 RVA: 0x000FEE94 File Offset: 0x000FD094
27 public void Refresh(int idTab)
28 {
29 WindowCharaMini.<>c__DisplayClass16_0 CS$<>8__locals1 = new WindowCharaMini.<>c__DisplayClass16_0();
30 CS$<>8__locals1.<>4__this = this;
31 CS$<>8__locals1.idTab = idTab;
32 if (this.chara == null)
33 {
34 return;
35 }
36 this.contentList.DestroyChildren(false, true);
37 this.note.Clear();
38 this.note.SetActive(false);
39 this.textName.SetText(this.chara.NameSimple);
40 this.textInfo1.text = "_DV".lang(this.chara.DV.ToString() ?? "", this.chara.PV.ToString() ?? "", null, null, null);
41 this.textInfo2.text = "_style".lang(Lang._weight(this.chara.body.GetWeight(true), true, 0) ?? "", this.chara.elements.GetOrCreateElement(this.chara.GetArmorSkill()).Name, ("style" + this.chara.body.GetAttackStyle().ToString()).lang(), null, null);
42 if (CS$<>8__locals1.idTab == 0)
43 {
44 CS$<>8__locals1.<Refresh>g__Header|0("resistance", null);
45 CS$<>8__locals1.<Refresh>g__ListResist|1();
46 CS$<>8__locals1.list.callbacks = new UIList.Callback<Element, ButtonElement>
47 {
48 onInstantiate = delegate(Element a, ButtonElement b)
49 {
50 b.SetGrid(a, CS$<>8__locals1.<>4__this.chara);
51 },
52 onList = delegate(UIList.SortMode m)
53 {
54 IEnumerable<SourceElement.Row> rows = EClass.sources.elements.rows;
55 Func<SourceElement.Row, bool> predicate;
56 if ((predicate = CS$<>8__locals1.<>9__5) == null)
57 {
58 predicate = (CS$<>8__locals1.<>9__5 = ((SourceElement.Row a) => a.category == "resist" && ((!a.tag.Contains("hidden") && !a.tag.Contains("high")) || CS$<>8__locals1.<>4__this.chara.Evalue(a.id) != 0)));
59 }
60 foreach (SourceElement.Row row in rows.Where(predicate))
61 {
62 CS$<>8__locals1.list.Add(CS$<>8__locals1.<>4__this.chara.elements.GetOrCreateElement(row.id));
63 }
64 }
65 };
66 CS$<>8__locals1.list.List(false);
67 }
68 else if (CS$<>8__locals1.idTab == 1)
69 {
70 CS$<>8__locals1.<Refresh>g__Header|0("mutation", null);
71 CS$<>8__locals1.<Refresh>g__ListFeat|2();
72 BaseList list = CS$<>8__locals1.list;
73 UIList.Callback<Feat, ButtonElement> callback = new UIList.Callback<Feat, ButtonElement>();
74 callback.onClick = delegate(Feat a, ButtonElement b)
75 {
76 WidgetTracker.Toggle(a);
77 };
78 callback.onInstantiate = delegate(Feat a, ButtonElement b)
79 {
80 b.SetElement(a, CS$<>8__locals1.<>4__this.chara.elements, ButtonElement.Mode.FeatMini);
81 };
82 callback.onList = delegate(UIList.SortMode m)
83 {
84 foreach (Element o in CS$<>8__locals1.<>4__this.chara.elements.ListElements((Element a) => a.source.category == "mutation" && a.Value != 0, null))
85 {
86 CS$<>8__locals1.list.Add(o);
87 }
88 };
89 list.callbacks = callback;
90 CS$<>8__locals1.list.List(false);
91 if (CS$<>8__locals1.list.items.Count == 0)
92 {
93 this._header.SetActive(false);
94 CS$<>8__locals1.list.SetActive(false);
95 }
96 CS$<>8__locals1.<Refresh>g__Header|0("etherDisease", null);
97 CS$<>8__locals1.<Refresh>g__ListFeat|2();
98 BaseList list2 = CS$<>8__locals1.list;
99 UIList.Callback<Feat, ButtonElement> callback2 = new UIList.Callback<Feat, ButtonElement>();
100 callback2.onClick = delegate(Feat a, ButtonElement b)
101 {
102 WidgetTracker.Toggle(a);
103 };
104 callback2.onInstantiate = delegate(Feat a, ButtonElement b)
105 {
106 b.SetElement(a, CS$<>8__locals1.<>4__this.chara.elements, ButtonElement.Mode.FeatMini);
107 };
108 callback2.onList = delegate(UIList.SortMode m)
109 {
110 foreach (Element o in CS$<>8__locals1.<>4__this.chara.elements.ListElements((Element a) => a.source.category == "ether" && a.Value != 0, null))
111 {
112 CS$<>8__locals1.list.Add(o);
113 }
114 };
115 list2.callbacks = callback2;
116 CS$<>8__locals1.list.List(false);
117 if (CS$<>8__locals1.list.items.Count == 0)
118 {
119 this._header.SetActive(false);
120 CS$<>8__locals1.list.SetActive(false);
121 }
122 CS$<>8__locals1.<Refresh>g__Header|0("innateFeats", null);
123 CS$<>8__locals1.<Refresh>g__ListFeat|2();
124 BaseList list3 = CS$<>8__locals1.list;
125 UIList.Callback<Feat, ButtonElement> callback3 = new UIList.Callback<Feat, ButtonElement>();
126 callback3.onClick = delegate(Feat a, ButtonElement b)
127 {
128 WidgetTracker.Toggle(a);
129 };
130 callback3.onInstantiate = delegate(Feat a, ButtonElement b)
131 {
132 b.SetElement(a, CS$<>8__locals1.<>4__this.chara.elements, ButtonElement.Mode.FeatMini);
133 };
134 callback3.onList = delegate(UIList.SortMode m)
135 {
136 foreach (Element o in CS$<>8__locals1.<>4__this.chara.elements.ListElements((Element a) => a.source.category == "feat" && a.HasTag("innate") && a.Value != 0, null))
137 {
138 CS$<>8__locals1.list.Add(o);
139 }
140 };
141 list3.callbacks = callback3;
142 CS$<>8__locals1.list.List(false);
143 CS$<>8__locals1.<Refresh>g__Header|0("feats", null);
144 CS$<>8__locals1.<Refresh>g__ListFeat|2();
145 BaseList list4 = CS$<>8__locals1.list;
146 UIList.Callback<Feat, ButtonElement> callback4 = new UIList.Callback<Feat, ButtonElement>();
147 callback4.onClick = delegate(Feat a, ButtonElement b)
148 {
149 WidgetTracker.Toggle(a);
150 };
151 callback4.onInstantiate = delegate(Feat a, ButtonElement b)
152 {
153 b.SetElement(a, CS$<>8__locals1.<>4__this.chara.elements, ButtonElement.Mode.FeatMini);
154 };
155 callback4.onList = delegate(UIList.SortMode m)
156 {
157 foreach (Element o in CS$<>8__locals1.<>4__this.chara.elements.ListElements((Element a) => a.source.category == "feat" && !a.HasTag("innate") && a.Value != 0, null))
158 {
159 CS$<>8__locals1.list.Add(o);
160 }
161 };
162 callback4.onSort = ((Feat a, UIList.SortMode m) => a.GetSortVal(m));
163 list4.callbacks = callback4;
164 CS$<>8__locals1.list.ChangeSort(UIList.SortMode.ByID);
165 CS$<>8__locals1.list.List(false);
166 }
167 else if (CS$<>8__locals1.idTab == 2)
168 {
169 if (this.chara.c_upgrades == null)
170 {
171 this.chara.c_upgrades = new CharaUpgrade();
172 }
173 CharaUpgrade upgrades = this.chara.c_upgrades;
174 CharaGenes genes = this.chara.c_genes;
175 int num = upgrades.spent;
176 if (genes != null)
177 {
178 num += genes.GetTotalCost();
179 }
180 this.note.SetActive(true);
181 this.note.AddText("feat_pet".lang(this.chara.feat.ToString() ?? "", num.ToString() ?? "", null, null, null), FontColor.DontChange);
182 this.note.AddText("feat_inferior".lang(((genes == null) ? 0 : genes.items.Count).ToString() ?? "", this.chara.MaxGene.ToString() ?? "", ((genes == null) ? 0 : genes.inferior).ToString() ?? "", null, null), FontColor.DontChange);
183 this.note.Space(8, 1);
184 foreach (CharaUpgrade.Item item in upgrades.items)
185 {
186 if (!Element.List_MainAttributesMajor.Contains(item.idEle))
187 {
188 Element element = Element.Create(item.idEle, item.value);
189 this.note.AddText("upgraded".lang(element.Name.ToTitleCase(false), item.value.ToString() ?? "", item.cost.ToString() ?? "", null, null), FontColor.DontChange);
190 }
191 }
192 if (this.chara.c_genes != null)
193 {
194 using (List<DNA>.Enumerator enumerator2 = genes.items.GetEnumerator())
195 {
196 while (enumerator2.MoveNext())
197 {
198 DNA g = enumerator2.Current;
199 UIItem uiitem = this.note.AddItem("ItemGene");
200 uiitem.button1.mainText.SetText(g.GetText());
201 uiitem.button1.SetTooltip(delegate(UITooltip t)
202 {
203 UINote uinote = t.note;
204 uinote.Clear();
205 uinote.AddHeader(g.GetText(), null);
206 g.WriteNote(uinote);
207 t.note.Build();
208 }, true);
209 Action <>9__28;
210 uiitem.button2.SetOnClick(delegate
211 {
212 string langDetail = "dialog_removeGene";
213 Action actionYes;
214 if ((actionYes = <>9__28) == null)
215 {
216 actionYes = (<>9__28 = delegate()
217 {
218 genes.inferior--;
219 SE.Trash();
220 genes.Remove(CS$<>8__locals1.<>4__this.chara, g);
221 CS$<>8__locals1.<>4__this.Refresh(CS$<>8__locals1.idTab);
222 });
223 }
224 Dialog.YesNo(langDetail, actionYes, null, "yes", "no");
225 });
226 uiitem.button2.SetActive(genes != null && genes.inferior > 0);
227 }
228 }
229 }
230 if (EClass.debug.enable)
231 {
232 this.note.AddButton("add 20".lang(), delegate
233 {
234 CS$<>8__locals1.<>4__this.chara.feat += 20;
235 CS$<>8__locals1.<>4__this.Refresh(CS$<>8__locals1.idTab);
236 });
237 this.note.AddButton("grow 100".lang(), delegate
238 {
239 CS$<>8__locals1.<>4__this.chara.feat += 100;
240 CS$<>8__locals1.<>4__this.chara.TryUpgrade(true);
241 CS$<>8__locals1.<>4__this.Refresh(CS$<>8__locals1.idTab);
242 });
243 }
244 if (upgrades.count > 0)
245 {
246 this.note.AddButton("feat_reset".lang(), delegate
247 {
248 upgrades.Reset(CS$<>8__locals1.<>4__this.chara);
249 SE.Trash();
250 CS$<>8__locals1.<>4__this.Refresh(CS$<>8__locals1.idTab);
251 });
252 }
253 this.note.Build();
254 }
255 else if (CS$<>8__locals1.idTab == 3)
256 {
257 this.note.SetActive(true);
258 WindowChara.RefreshNote(this.chara, this.note, true);
259 }
260 this.RefreshEquipment();
261 }
262
263 // Token: 0x06002D97 RID: 11671 RVA: 0x000FF68C File Offset: 0x000FD88C
264 public void RefreshEquipment()
265 {
266 UIList uilist = this.listEq;
267 uilist.Clear();
268 BaseList baseList = uilist;
269 UIList.Callback<BodySlot, UIItem> callback = new UIList.Callback<BodySlot, UIItem>();
270 callback.onClick = delegate(BodySlot a, UIItem b)
271 {
272 };
273 callback.onInstantiate = delegate(BodySlot a, UIItem b)
274 {
275 if (a.elementId == 0)
276 {
277 b.button1.interactable = false;
278 return;
279 }
280 Thing thing = a.thing;
281 b.refObj = thing;
282 if (thing != null)
283 {
284 b.button1.icon.material = this.matItem;
285 thing.SetImage(b.button1.icon);
286 }
287 else
288 {
289 b.button1.icon.material = null;
290 b.button1.icon.sprite = SpriteSheet.Get("Media/Graphics/Icon/Element/", "eq_" + a.element.alias);
291 b.button1.icon.color = this.colorUnequipped;
292 b.button1.icon.SetNativeSize();
293 }
294 b.button1.SetTooltip(delegate(UITooltip tt)
295 {
296 if (a.thing != null)
297 {
298 a.thing.WriteNote(tt.note, null, IInspect.NoteMode.Default, null);
299 }
300 else
301 {
302 tt.note.Clear();
303 tt.note.AddHeader(a.name, null);
304 tt.note.AddText("noEQ".lang(), FontColor.DontChange);
305 if (a.elementId == 35)
306 {
307 Thing.AddAttackEvaluation(tt.note, this.chara, null);
308 }
309 }
310 tt.note.Build();
311 }, true);
312 };
313 baseList.callbacks = callback;
314 foreach (BodySlot bodySlot in this.chara.body.slots)
315 {
316 if (bodySlot.elementId != 44)
317 {
318 uilist.Add(bodySlot);
319 }
320 }
321 uilist.Refresh(false);
322 }
323
324 // Token: 0x04001999 RID: 6553
325 public Chara chara;
326
327 // Token: 0x0400199A RID: 6554
328 public UIHeader moldHeader;
329
330 // Token: 0x0400199B RID: 6555
331 public UIHeader moldHeader2;
332
333 // Token: 0x0400199C RID: 6556
334 public UIText textName;
335
336 // Token: 0x0400199D RID: 6557
337 public UIText textInfo1;
338
339 // Token: 0x0400199E RID: 6558
340 public UIText textInfo2;
341
342 // Token: 0x0400199F RID: 6559
343 public UIList moldListResist;
344
345 // Token: 0x040019A0 RID: 6560
346 public UIList moldListFeat;
347
348 // Token: 0x040019A1 RID: 6561
349 public Transform contentList;
350
351 // Token: 0x040019A2 RID: 6562
352 public UINote note;
353
354 // Token: 0x040019A3 RID: 6563
355 public UIList listEq;
356
357 // Token: 0x040019A4 RID: 6564
358 public Material matItem;
359
360 // Token: 0x040019A5 RID: 6565
361 public Color colorUnequipped;
362
363 // Token: 0x040019A6 RID: 6566
364 private UIHeader _header;
365}
Definition Chara.cs:12
Definition DNA.cs:9
Definition Feat.2.cs:8
Definition Thing.cs:10