Elin Modding Docs Doc
Loading...
Searching...
No Matches
ContentCodex.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x02000581 RID: 1409
6public class ContentCodex : EContent
7{
8 // Token: 0x060026CA RID: 9930 RVA: 0x000DC058 File Offset: 0x000DA258
9 public override void OnSwitchContent(int idTab)
10 {
11 if (this.list.isBuilt)
12 {
13 if (this.currentCodex != null)
14 {
15 this.list.Select(this.currentCodex, false);
16 this.RefreshInfo();
17 }
18 return;
19 }
20 this.RefreshList();
21 this.buttonToggleCollect.SetToggle(EClass.game.config.autoCollectCard, delegate(bool a)
22 {
23 EClass.game.config.autoCollectCard = a;
24 });
25 }
26
27 // Token: 0x060026CB RID: 9931 RVA: 0x000DC0D4 File Offset: 0x000DA2D4
28 public void RefreshList()
29 {
30 this.currentCodex = null;
31 this.list.Clear();
32 BaseList baseList = this.list;
33 UIList.Callback<CodexCreature, ButtonGrid> callback = new UIList.Callback<CodexCreature, ButtonGrid>();
34 callback.onClick = delegate(CodexCreature a, ButtonGrid b)
35 {
36 this.currentCodex = a;
37 this.RefreshInfo();
38 this.list.Select(a, false);
39 };
40 callback.onRedraw = delegate(CodexCreature a, ButtonGrid b, int i)
41 {
42 b.refObj = a.source;
43 b.mainText.SetText(a.Name);
44 b.subText.text = (a.numCard.ToString() ?? "");
45 b.subText2.SetText(a.source._id.ToString() + ".");
46 if (EClass.core.uiScale < 1.2f)
47 {
48 b.icon.transform.localScale = new Vector3(1f / EClass.core.uiScale, 1f / EClass.core.uiScale, 1f);
49 }
50 a.SetImage(b.icon, true);
51 };
52 callback.onList = delegate(UIList.SortMode m)
53 {
54 List<CodexCreature> list = new List<CodexCreature>();
55 foreach (KeyValuePair<string, CodexCreature> keyValuePair in EClass.player.codex.creatures)
56 {
57 if (keyValuePair.Value.numCard > 0 && EClass.sources.charas.map.ContainsKey(keyValuePair.Value.id))
58 {
59 list.Add(keyValuePair.Value);
60 }
61 }
62 list.Sort((CodexCreature a, CodexCreature b) => a.source._id - b.source._id);
63 foreach (CodexCreature o in list)
64 {
65 this.list.Add(o);
66 }
67 };
68 baseList.callbacks = callback;
69 this.list.List();
70 bool flag = this.list.objects.Count > 0;
71 if (flag)
72 {
73 this.list.dsv.scrollByItemIndex(0);
74 this.list.Select(this.list.objects[0], true);
75 this.currentCodex = (this.list.objects[0] as CodexCreature);
76 }
77 this.transInfo.SetActive(flag);
78 this.buttonTake.SetActive(flag);
79 }
80
81 // Token: 0x060026CC RID: 9932 RVA: 0x000DC1D0 File Offset: 0x000DA3D0
82 public void RefreshInfo()
83 {
84 CodexCreature codexCreature = this.currentCodex;
85 if (codexCreature == null)
86 {
87 return;
88 }
89 UINote uinote = this.note;
90 SourceChara.Row source = codexCreature.source;
91 uinote.Clear();
92 UIItem uiitem = uinote.AddHeader("HeaderCodex", codexCreature.Name.Replace("『", Environment.NewLine + "『"), null);
93 codexCreature.SetImage(uiitem.image1, true);
94 uiitem.text2.text = string.Concat(new string[]
95 {
96 "Lv.",
97 source.LV.ToString(),
98 Environment.NewLine,
99 EClass.sources.races.map[source.race].GetName().ToTitleCase(true),
100 Environment.NewLine,
101 EClass.sources.jobs.map[source.job].GetName().ToTitleCase(true)
102 });
103 uiitem.image1.rectTransform.pivot = this.pivot;
104 uiitem.image1.rectTransform.localPosition = this.localPos;
105 uiitem.image1.rectTransform.localScale = new Vector3(-uiitem.image1.transform.localScale.x, uiitem.image1.transform.localScale.y, 1f);
106 uinote.Build();
107 this.textOwn.text = (codexCreature.numCard.ToString() ?? "");
108 this.textValue.text = (codexCreature.source.value.ToString() ?? "");
109 this.textKills.text = (codexCreature.kills.ToString() ?? "");
110 this.textWeakspot.SetText((codexCreature.weakspot == 0) ? "undiscovered".lang() : "discovered".lang(codexCreature.weakspot.ToString() ?? "", null, null, null, null), (codexCreature.weakspot == 0) ? FontColor.Default : FontColor.Good);
111 this.textSpawns.text = (codexCreature.spawns.ToString() ?? "");
112 this.textBonus.text = codexCreature.GetTextBonus();
113 this.currentCodex = codexCreature;
114 }
115
116 // Token: 0x060026CD RID: 9933 RVA: 0x000DC434 File Offset: 0x000DA634
117 public void OnClickAddCards()
118 {
119 List<Thing> list = EClass.pc.things.List((Thing c) => c.id == "figure3", false);
120 int num = 0;
121 if (list.Count > 0)
122 {
123 foreach (Thing thing in list)
124 {
125 EClass.player.codex.AddCard(thing.c_idRefCard, thing.Num);
126 num += thing.Num;
127 thing.Destroy();
128 this.RefreshList();
129 }
130 SE.Play("use_card");
131 Msg.Say("addedCards", num, num.ToString() ?? "", null);
132 }
133 else
134 {
135 SE.BeepSmall();
136 Msg.Say("noCard");
137 }
138 this.RefreshInfo();
139 }
140
141 // Token: 0x060026CE RID: 9934 RVA: 0x000DC528 File Offset: 0x000DA728
142 public static void Collect(Thing t)
143 {
144 EClass.player.codex.AddCard(t.c_idRefCard, t.Num);
145 SE.Play("use_card");
146 Msg.Say("addedCards", t.Num, t.Num.ToString() ?? "", null);
147 t.Destroy();
148 }
149
150 // Token: 0x060026CF RID: 9935 RVA: 0x000DC58C File Offset: 0x000DA78C
151 public void OnClickGetCard()
152 {
153 CodexCreature codexCreature = this.currentCodex;
154 int numCard = codexCreature.numCard;
155 codexCreature.numCard = numCard - 1;
156 Thing thing = ThingGen.Create("figure3", -1, -1);
157 thing.MakeFigureFrom(this.currentCodex.id);
158 EClass.pc.Pick(thing, true, true);
159 if (this.currentCodex.numCard == 0)
160 {
161 this.RefreshList();
162 return;
163 }
164 this.list.Redraw();
165 this.list.Select(this.currentCodex, false);
166 this.RefreshInfo();
167 }
168
169 // Token: 0x04001564 RID: 5476
170 public UIDynamicList list;
171
172 // Token: 0x04001565 RID: 5477
173 public UIText textName;
174
175 // Token: 0x04001566 RID: 5478
176 public UIText textOwn;
177
178 // Token: 0x04001567 RID: 5479
179 public UIText textValue;
180
181 // Token: 0x04001568 RID: 5480
182 public UIText textKills;
183
184 // Token: 0x04001569 RID: 5481
185 public UIText textWeakspot;
186
187 // Token: 0x0400156A RID: 5482
188 public UIText textSpawns;
189
190 // Token: 0x0400156B RID: 5483
191 public UIText textBonus;
192
193 // Token: 0x0400156C RID: 5484
194 public UINote note;
195
196 // Token: 0x0400156D RID: 5485
197 public CodexCreature currentCodex;
198
199 // Token: 0x0400156E RID: 5486
200 public Transform transInfo;
201
202 // Token: 0x0400156F RID: 5487
203 public UIButton buttonTake;
204
205 // Token: 0x04001570 RID: 5488
206 public UIButton buttonAddCards;
207
208 // Token: 0x04001571 RID: 5489
209 public UIButton buttonToggleCollect;
210
211 // Token: 0x04001572 RID: 5490
212 public Vector2 pivot;
213
214 // Token: 0x04001573 RID: 5491
215 public Vector2 localPos;
216}
Definition Msg.cs:7
Definition Thing.cs:10