Elin Modding Docs Doc
Loading...
Searching...
No Matches
UICharaMaker.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using DG.Tweening;
5using UnityEngine;
6using UnityEngine.UI;
7
8// Token: 0x020005E3 RID: 1507
9public class UICharaMaker : EMono
10{
11 // Token: 0x17000BFE RID: 3070
12 // (get) Token: 0x06002967 RID: 10599 RVA: 0x000E978D File Offset: 0x000E798D
13 public Biography bio
14 {
15 get
16 {
17 return this.chara.bio;
18 }
19 }
20
21 // Token: 0x17000BFF RID: 3071
22 // (get) Token: 0x06002968 RID: 10600 RVA: 0x000E979A File Offset: 0x000E799A
23 public string TextUnknown
24 {
25 get
26 {
27 return "lore_unknown".lang();
28 }
29 }
30
31 // Token: 0x06002969 RID: 10601 RVA: 0x000E97A8 File Offset: 0x000E79A8
32 public void SetChara(Chara c)
33 {
34 this.listMode = Lang.GetList("startMode");
35 this.listDifficulties = Lang.GetList("difficulties");
36 this.textMode.SetText(this.listMode[EMono.game.idPrologue]);
37 this.textDifficulty.SetText(this.listDifficulties[EMono.game.idDifficulty]);
38 this.chara = c;
39 this.BuildRaces();
40 this.SetPortraitSlider();
41 this.Refresh();
42 this.toggleExtra.SetToggle(this.extraRace, delegate(bool a)
43 {
44 this.extraRace = a;
45 this.BuildRaces();
46 SE.Tab();
47 });
48 }
49
50 // Token: 0x0600296A RID: 10602 RVA: 0x000E9844 File Offset: 0x000E7A44
51 public void BuildRaces()
52 {
53 this.races.Clear();
54 this.jobs.Clear();
55 bool flag = EMono.core.config.test.extraRace;
56 foreach (SourceRace.Row row in EMono.sources.races.rows)
57 {
58 if (row.playable == 1 || (row.playable <= 6 && this.extraRace) || (flag && row.playable != 9))
59 {
60 this.races.Add(row);
61 }
62 }
63 foreach (SourceJob.Row row2 in EMono.sources.jobs.rows)
64 {
65 if (row2.playable == 1 || (row2.playable <= 6 && this.extraRace) || (flag && row2.playable != 9))
66 {
67 this.jobs.Add(row2);
68 }
69 }
70 this.races.Sort((SourceRace.Row a, SourceRace.Row b) => (a.playable - b.playable) * 10000 + a._index - b._index);
71 this.jobs.Sort((SourceJob.Row a, SourceJob.Row b) => (a.playable - b.playable) * 10000 + a._index - b._index);
72 }
73
74 // Token: 0x0600296B RID: 10603 RVA: 0x000E99C8 File Offset: 0x000E7BC8
75 private void Update()
76 {
77 this.RefreshPortraitZoom(false);
78 }
79
80 // Token: 0x0600296C RID: 10604 RVA: 0x000E99D4 File Offset: 0x000E7BD4
81 public void RefreshPortraitZoom(bool force = false)
82 {
83 if (!this.portraitZoom)
84 {
85 return;
86 }
87 List<GameObject> hovered = InputModuleEX.GetPointerEventData(-1).hovered;
88 bool enable = false;
89 using (List<GameObject>.Enumerator enumerator = hovered.GetEnumerator())
90 {
91 while (enumerator.MoveNext())
92 {
93 if (enumerator.Current.transform.IsChildOf(this.portrait.transform))
94 {
95 enable = true;
96 break;
97 }
98 }
99 }
100 this.portraitZoom.SetActive(enable);
101 }
102
103 // Token: 0x0600296D RID: 10605 RVA: 0x000E9A5C File Offset: 0x000E7C5C
104 public void Refresh()
105 {
106 this.chara.elements.ApplyPotential(0);
107 Prologue prologue = EMono.game.Prologue;
108 this.textSign.SetText("signDisembark".lang(prologue.month.ToString() ?? "", prologue.day.ToString() ?? "", prologue.year.ToString() ?? "", null, null));
109 this.RefreshPortraitZoom(false);
110 this.inputAlias.text = this.chara.Aka;
111 this.inputName.text = this.chara.c_altName;
112 this.inputRace.text = this.chara.race.GetText("name", false).ToTitleCase(true);
113 this.inputJob.text = this.chara.job.GetText("name", false).ToTitleCase(true);
114 this.inputGender.text = Lang._gender(this.chara.bio.gender);
115 this.inputAge.text = Lang.GetList("ages")[this.ageIndex];
116 this.note.Clear();
117 this.note.AddTopic("name".lang(), "nameBio".lang(this.chara.NameSimple, this.chara.Aka, null, null, null));
118 this.note.AddTopic("birthday".lang(), this.bio.TextBirthDate(this.chara, true) + ((this.ageIndex == 0) ? "" : (" (" + Lang.GetList("ages")[this.ageIndex] + ")")));
119 this.note.AddTopic("appearance".lang(), this.bio.TextAppearance());
120 this.note.AddTopic("dad".lang(), this.bio.nameDad.ToTitleCase(false));
121 this.note.AddTopic("mom".lang(), this.bio.nameMom.ToTitleCase(false));
122 this.note.AddTopic("birthLoc".lang(), this.bio.nameBirthplace.ToTitleCase(false));
123 this.note.Build();
124 this.noteRace.Clear();
125 this.noteRace.AddHeaderTopic("race".lang() + ": " + this.chara.race.GetText("name", false).ToTitleCase(true), null);
126 this.noteRace.Space(8, 1);
127 this.noteRace.AddText("NoteText_long", this.chara.race.GetDetail().IsEmpty(this.TextUnknown), FontColor.DontChange).Hyphenate();
128 this.noteRace.Build();
129 this.noteJob.Clear();
130 this.noteJob.AddHeaderTopic("job".lang() + ": " + this.chara.job.GetText("name", false).ToTitleCase(true), null);
131 this.noteJob.Space(8, 1);
132 this.noteJob.AddText("NoteText_long", this.chara.job.GetDetail().IsEmpty(this.TextUnknown), FontColor.DontChange).Hyphenate();
133 this.AddDomain(this.noteJob, EMono.player.GetDomains(), true);
134 this.noteJob.Build();
135 this.note2.Clear();
136 this.note2.AddHeaderTopic("attributes".lang(), null);
137 this.chara.elements.AddNote(this.note2, (Element e) => e.HasTag("primary"), null, ElementContainer.NoteMode.CharaMake, false, null, null);
138 this.note2.Space(0, 1);
139 this.note2.AddHeaderTopic("skills".lang(), null);
140 this.chara.elements.AddNote(this.note2, (Element e) => e.source.category == "skill" && e.ValueWithoutLink > 1 && e.source.categorySub != "weapon", null, ElementContainer.NoteMode.CharaMake, false, null, null);
141 this.note2.Space(0, 1);
142 this.note2.AddHeaderTopic("feats".lang(), null);
143 this.chara.elements.AddNote(this.note2, (Element e) => e is Feat, null, ElementContainer.NoteMode.CharaMake, true, null, null);
144 this.note2.Build();
145 if (this.addShadow)
146 {
147 foreach (Text text in this.note2.gameObject.GetComponentsInChildren<Text>())
148 {
149 Shadow shadow = text.GetComponent<Shadow>();
150 if (!shadow)
151 {
152 shadow = text.gameObject.AddComponent<Shadow>();
153 }
154 shadow.effectColor = Color.black;
155 }
156 }
157 }
158
159 // Token: 0x0600296E RID: 10606 RVA: 0x000E9F88 File Offset: 0x000E8188
160 public void ListModes()
161 {
162 EMono.ui.AddLayer<LayerList>().SetStringList(() => this.listMode, delegate(int a, string b)
163 {
164 EMono.game.idPrologue = a;
165 Prologue prologue = EMono.game.Prologue;
166 EMono.world.date.year = prologue.year;
167 EMono.world.date.month = prologue.month;
168 EMono.world.date.day = prologue.day;
169 EMono.world.weather._currentCondition = prologue.weather;
170 this.textMode.SetText(this.listMode[EMono.game.idPrologue]);
171 this.Refresh();
172 }, true).SetSize(450f, -1f).SetTitles("wStartMode", null);
173 }
174
175 // Token: 0x0600296F RID: 10607 RVA: 0x000E9FD8 File Offset: 0x000E81D8
176 public void ListDifficulties()
177 {
178 TooltipManager.Instance.HideTooltips(true);
179 TooltipManager.Instance.disableHide = "note";
180 bool first = true;
181 EMono.ui.AddLayer<LayerList>().SetPivot(0.5f, 0.2f).SetSize(260f, -1f).SetList2<GameDifficulty>(EMono.setting.start.difficulties, (GameDifficulty a) => a.Name, delegate(GameDifficulty a, ItemGeneral b)
182 {
183 EMono.game.idDifficulty = a.ID;
184 this.textDifficulty.SetText(this.listDifficulties[EMono.game.idDifficulty]);
185 this.Refresh();
186 }, delegate(GameDifficulty a, ItemGeneral item)
187 {
188 UIButton b = item.button1;
189 b.SetTooltip(delegate(UITooltip t)
190 {
191 t.note.Clear();
192 t.note.AddHeader(a.Name, null);
193 t.note.Space(8, 1);
194 t.note.AddText("NoteText_medium", "vow_" + a.ID.ToString(), FontColor.DontChange).Hyphenate();
195 t.note.Space(8, 1);
196 t.note.Build();
197 }, true);
198 if (first)
199 {
200 TooltipManager.Instance.GetComponent<CanvasGroup>().alpha = 0f;
201 TooltipManager.Instance.GetComponent<CanvasGroup>().DOFade(1f, 0.3f);
202 EMono.core.actionsNextFrame.Add(delegate
203 {
204 b.ShowTooltipForced(true);
205 });
206 }
207 first = false;
208 }, true).SetTitles("wDifficulty", null);
209 RectTransform rectTransform = EMono.ui.GetLayer<LayerList>(false).windows[0].Rect();
210 rectTransform.pivot = new Vector2(0.5f, 0.5f);
211 rectTransform.anchoredPosition = this.posList2;
212 TweenUtil.Tween(0.3f, null, delegate()
213 {
214 UIButton.TryShowTip(null, true, true);
215 });
216 }
217
218 // Token: 0x06002970 RID: 10608 RVA: 0x000EA0F9 File Offset: 0x000E82F9
219 public void RerollAlias()
220 {
221 this.chara._alias = AliasGen.GetRandomAlias();
222 this.Refresh();
223 }
224
225 // Token: 0x06002971 RID: 10609 RVA: 0x000EA114 File Offset: 0x000E8314
226 public void ListAlias()
227 {
228 EMono.ui.AddLayer<LayerList>().SetStringList(delegate
229 {
230 List<string> list = new List<string>();
231 for (int i = 0; i < 10; i++)
232 {
233 list.Add(AliasGen.GetRandomAlias());
234 }
235 return list;
236 }, delegate(int a, string b)
237 {
238 this.chara._alias = b;
239 this.Refresh();
240 }, true).SetSize(450f, -1f).EnableReroll().SetTitles("wAlias", null);
241 }
242
243 // Token: 0x06002972 RID: 10610 RVA: 0x000EA17C File Offset: 0x000E837C
244 public void RerollName()
245 {
246 this.chara.c_altName = NameGen.getRandomName();
247 this.Refresh();
248 }
249
250 // Token: 0x06002973 RID: 10611 RVA: 0x000EA194 File Offset: 0x000E8394
251 public void EditName()
252 {
253 Dialog.InputName("dialogChangeName", this.chara.c_altName.IsEmpty(this.chara.NameSimple), delegate(bool cancel, string text)
254 {
255 if (!cancel)
256 {
257 this.chara.c_altName = text;
258 this.Refresh();
259 }
260 }, Dialog.InputType.Default).SetOnKill(delegate
261 {
262 EMono.ui.hud.hint.Show("hintEmbarkTop".lang(), false);
263 });
264 }
265
266 // Token: 0x06002974 RID: 10612 RVA: 0x000EA1F8 File Offset: 0x000E83F8
267 public void OnEndEditName()
268 {
269 this.chara.c_altName = this.inputName.text;
270 }
271
272 // Token: 0x06002975 RID: 10613 RVA: 0x000EA210 File Offset: 0x000E8410
273 public void RerollRace()
274 {
275 this.chara.ChangeRace(this.races.RandomItem(this.chara.race).id);
276 this.RerollBio(true);
277 }
278
279 // Token: 0x06002976 RID: 10614 RVA: 0x000EA240 File Offset: 0x000E8440
280 public void ListRace()
281 {
282 TooltipManager.Instance.HideTooltips(true);
283 TooltipManager.Instance.disableHide = "note";
284 bool first = true;
285 EMono.ui.AddLayer<LayerList>().SetPivot(0.5f, 0.2f).SetSize(260f, -1f).SetList2<SourceRace.Row>(this.races, (SourceRace.Row a) => a.GetText("name", false).ToTitleCase(true), delegate(SourceRace.Row a, ItemGeneral b)
286 {
287 this.chara.ChangeRace(a.id);
288 this.RerollBio(true);
289 }, delegate(SourceRace.Row a, ItemGeneral item)
290 {
291 UIButton b = item.button1;
292 b.SetTooltip(delegate(UITooltip t)
293 {
294 ElementContainer elementContainer = new ElementContainer();
295 elementContainer.ApplyElementMap(EMono.pc.uid, SourceValueType.Chara, a.elementMap, 1, false, false);
296 elementContainer.ApplyPotential(1);
297 t.note.Clear();
298 t.note.AddHeader(a.GetText("name", false).ToTitleCase(true), null);
299 elementContainer.AddNoteAll(t.note);
300 t.note.AddHeader("lore", null);
301 t.note.AddText("NoteText_long", a.GetDetail().IsEmpty(this.TextUnknown), FontColor.DontChange).Hyphenate();
302 t.note.Space(8, 1);
303 t.note.Build();
304 }, true);
305 if (first)
306 {
307 TooltipManager.Instance.GetComponent<CanvasGroup>().alpha = 0f;
308 TooltipManager.Instance.GetComponent<CanvasGroup>().DOFade(1f, 0.3f);
309 EMono.core.actionsNextFrame.Add(delegate
310 {
311 b.ShowTooltipForced(true);
312 });
313 }
314 first = false;
315 }, true).SetTitles("wRace", null);
316 RectTransform rectTransform = EMono.ui.GetLayer<LayerList>(false).windows[0].Rect();
317 rectTransform.pivot = new Vector2(0.5f, 0.5f);
318 rectTransform.anchoredPosition = this.posList;
319 TweenUtil.Tween(0.3f, null, delegate()
320 {
321 UIButton.TryShowTip(null, true, true);
322 });
323 }
324
325 // Token: 0x06002977 RID: 10615 RVA: 0x000EA358 File Offset: 0x000E8558
326 public void RerollJob()
327 {
328 this.chara.ChangeJob(this.jobs.RandomItem(this.chara.job).id);
329 EMono.player.RefreshDomain();
330 this.Refresh();
331 }
332
333 // Token: 0x06002978 RID: 10616 RVA: 0x000EA390 File Offset: 0x000E8590
334 public void ListJob()
335 {
336 TooltipManager.Instance.HideTooltips(true);
337 TooltipManager.Instance.disableHide = "note";
338 bool first = true;
339 EMono.ui.AddLayer<LayerList>().SetPivot(0.5f, 0.1f).SetSize(260f, -1f).SetList2<SourceJob.Row>(this.jobs, (SourceJob.Row a) => a.GetText("name", false).ToTitleCase(true), delegate(SourceJob.Row a, ItemGeneral b)
340 {
341 this.chara.ChangeJob(a.id);
342 EMono.player.RefreshDomain();
343 this.RerollBio(true);
344 }, delegate(SourceJob.Row a, ItemGeneral item)
345 {
346 UIButton b = item.button1;
347 b.SetTooltip(delegate(UITooltip t)
348 {
349 ElementContainer elementContainer = new ElementContainer();
350 elementContainer.ApplyElementMap(EMono.pc.uid, SourceValueType.Chara, a.elementMap, 1, false, false);
351 elementContainer.ApplyPotential(2);
352 t.note.Clear();
353 t.note.AddHeader(a.GetText("name", false).ToTitleCase(true), null);
354 elementContainer.AddNoteAll(t.note);
355 t.note.AddHeader("lore", null);
356 t.note.AddText("NoteText_long", a.GetDetail().IsEmpty(this.TextUnknown), FontColor.DontChange).Hyphenate();
357 this.AddDomain(t.note, new ElementContainer().ImportElementMap(a.domain), false);
358 t.note.Build();
359 }, true);
360 if (first)
361 {
362 TooltipManager.Instance.GetComponent<CanvasGroup>().alpha = 0f;
363 TooltipManager.Instance.GetComponent<CanvasGroup>().DOFade(1f, 0.3f);
364 EMono.core.actionsNextFrame.Add(delegate
365 {
366 b.ShowTooltipForced(true);
367 });
368 }
369 first = false;
370 }, true).SetTitles("wClass", null);
371 RectTransform rectTransform = EMono.ui.GetLayer<LayerList>(false).windows[0].Rect();
372 rectTransform.pivot = new Vector2(0.5f, 0.5f);
373 rectTransform.anchoredPosition = this.posList;
374 TweenUtil.Tween(0.3f, null, delegate()
375 {
376 UIButton.TryShowTip(null, true, true);
377 });
378 }
379
380 // Token: 0x06002979 RID: 10617 RVA: 0x000EA4A8 File Offset: 0x000E86A8
381 public void AddDomain(UINote n, ElementContainer domains, bool button)
382 {
383 n.Space(8, 1);
384 string text = "";
385 foreach (Element element in domains.dict.Values)
386 {
387 text = text + ((element == domains.dict.Values.First<Element>()) ? "" : ", ") + element.Name;
388 }
389 UIItem uiitem = n.AddTopic("TopicDomain", "domain".lang(), text);
390 uiitem.button1.SetActive(button && EMono.pc.HasElement(1402, 1));
391 uiitem.button1.SetOnClick(delegate
392 {
393 EMono.player.SelectDomain(new Action(this.Refresh));
394 });
395 }
396
397 // Token: 0x0600297A RID: 10618 RVA: 0x000EA580 File Offset: 0x000E8780
398 public void ListGender()
399 {
400 EMono.ui.AddLayer<LayerList>().SetStringList(() => Lang.GetList("genders"), delegate(int a, string b)
401 {
402 if (this.chara.bio.gender != a)
403 {
404 this.chara.bio.SetGender(a);
405 this.chara.c_idPortrait = Portrait.GetRandomPortrait(this.chara.bio.gender, this.chara.GetIdPortraitCat());
406 this.portrait.SetChara(this.chara, null);
407 this.portraitZoom.SetChara(this.chara, null);
408 }
409 this.SetPortraitSlider();
410 this.Refresh();
411 }, true).SetTitles("wGender", null);
412 }
413
414 // Token: 0x0600297B RID: 10619 RVA: 0x000EA5D4 File Offset: 0x000E87D4
415 public void ListAge()
416 {
417 EMono.ui.AddLayer<LayerList>().SetStringList(() => Lang.GetList("ages"), delegate(int a, string b)
418 {
419 if (this.ageIndex != a)
420 {
421 this.ageIndex = a;
422 this.RerollBio(true);
423 }
424 this.Refresh();
425 }, true).SetTitles("wAge", null);
426 }
427
428 // Token: 0x0600297C RID: 10620 RVA: 0x000EA628 File Offset: 0x000E8828
429 public void SetPortraitSlider()
430 {
431 if (!this.sliderPortrait)
432 {
433 return;
434 }
435 List<ModItem<Sprite>> list = Portrait.ListPlayerPortraits(this.chara.bio.gender, false);
436 this.sliderPortrait.SetList<ModItem<Sprite>>(list.Find((ModItem<Sprite> a) => a.id == this.chara.c_idPortrait), list, delegate(int a, ModItem<Sprite> b)
437 {
438 this.chara.c_idPortrait = b.id;
439 this.portrait.SetChara(this.chara, null);
440 this.portraitZoom.SetChara(this.chara, null);
441 }, (ModItem<Sprite> a) => a.id);
442 }
443
444 // Token: 0x0600297D RID: 10621 RVA: 0x000EA6A3 File Offset: 0x000E88A3
445 public void RerollPCC()
446 {
447 this.chara.pccData.Randomize(null, null, false);
448 this.portrait.SetChara(this.chara, null);
449 this.portraitZoom.SetChara(this.chara, null);
450 }
451
452 // Token: 0x0600297E RID: 10622 RVA: 0x000EA6DC File Offset: 0x000E88DC
453 public void RerollHair()
454 {
455 this.chara.pccData.SetRandomColor("hair");
456 this.portrait.SetChara(this.chara, null);
457 this.portraitZoom.SetChara(this.chara, null);
458 }
459
460 // Token: 0x0600297F RID: 10623 RVA: 0x000EA717 File Offset: 0x000E8917
461 public void RerollBio()
462 {
463 this.RerollBio(false);
464 }
465
466 // Token: 0x06002980 RID: 10624 RVA: 0x000EA720 File Offset: 0x000E8920
467 public void RerollBio(bool keepParent)
468 {
469 this.bio.RerollBio(this.chara, this.ageIndex, keepParent);
470 this.Refresh();
471 }
472
473 // Token: 0x06002981 RID: 10625 RVA: 0x000EA740 File Offset: 0x000E8940
474 public void EditPCC()
475 {
476 EMono.ui.AddLayer<LayerEditPCC>().Activate(this.chara, UIPCC.Mode.Body, null, delegate
477 {
478 this.portrait.SetChara(this.chara, null);
479 this.SetPortraitSlider();
480 });
481 }
482
483 // Token: 0x04001753 RID: 5971
484 public Chara chara;
485
486 // Token: 0x04001754 RID: 5972
487 public Portrait portrait;
488
489 // Token: 0x04001755 RID: 5973
490 public Portrait portraitZoom;
491
492 // Token: 0x04001756 RID: 5974
493 public InputField inputName;
494
495 // Token: 0x04001757 RID: 5975
496 public InputField inputAlias;
497
498 // Token: 0x04001758 RID: 5976
499 public InputField inputJob;
500
501 // Token: 0x04001759 RID: 5977
502 public InputField inputRace;
503
504 // Token: 0x0400175A RID: 5978
505 public InputField inputGender;
506
507 // Token: 0x0400175B RID: 5979
508 public InputField inputAge;
509
510 // Token: 0x0400175C RID: 5980
511 public UISlider sliderPortrait;
512
513 // Token: 0x0400175D RID: 5981
514 public List<SourceRace.Row> races = new List<SourceRace.Row>();
515
516 // Token: 0x0400175E RID: 5982
517 public List<SourceJob.Row> jobs = new List<SourceJob.Row>();
518
519 // Token: 0x0400175F RID: 5983
520 public UIButton toggleExtra;
521
522 // Token: 0x04001760 RID: 5984
523 public UIButton toggleParentLock;
524
525 // Token: 0x04001761 RID: 5985
526 public UINote note;
527
528 // Token: 0x04001762 RID: 5986
529 public UINote note2;
530
531 // Token: 0x04001763 RID: 5987
532 public UINote noteJob;
533
534 // Token: 0x04001764 RID: 5988
535 public UINote noteRace;
536
537 // Token: 0x04001765 RID: 5989
538 public bool addShadow;
539
540 // Token: 0x04001766 RID: 5990
541 public bool extraRace;
542
543 // Token: 0x04001767 RID: 5991
544 public UIText textSign;
545
546 // Token: 0x04001768 RID: 5992
547 public UIText textMode;
548
549 // Token: 0x04001769 RID: 5993
550 public UIText textDifficulty;
551
552 // Token: 0x0400176A RID: 5994
553 public int ageIndex;
554
555 // Token: 0x0400176B RID: 5995
556 public Vector2 posList;
557
558 // Token: 0x0400176C RID: 5996
559 public Vector2 posList2;
560
561 // Token: 0x0400176D RID: 5997
562 [NonSerialized]
563 public string[] listMode;
564
565 // Token: 0x0400176E RID: 5998
566 [NonSerialized]
567 public string[] listDifficulties;
568}
Definition Chara.cs:12
Definition EMono.cs:6
Definition Feat.2.cs:8