Elin Decompiled Documentation EA 23.222 Stable nyan
Loading...
Searching...
No Matches
WindowCharaMini.cs
Go to the documentation of this file.
1using System.Linq;
2using UnityEngine;
3
5{
6 public Chara chara;
7
9
11
13
15
17
19
21
22 public Transform contentList;
23
24 public UINote note;
25
26 public UIList listEq;
27
29
31
33
34 public void SetChara(Chara c)
35 {
36 chara = c;
37 Refresh(0);
38 }
39
40 public override void OnSwitchContent(Window window)
41 {
42 if (chara != null)
43 {
45 }
46 }
47
48 public void Refresh(int idTab)
49 {
50 if (chara == null)
51 {
52 return;
53 }
54 contentList.DestroyChildren();
55 note.Clear();
56 note.SetActive(enable: false);
58 textInfo1.text = "_DV".lang(chara.DV.ToString() ?? "", chara.PV.ToString() ?? "");
59 textInfo2.text = "_style".lang(Lang._weight(chara.body.GetWeight(armorOnly: true)) ?? "", chara.elements.GetOrCreateElement(chara.GetArmorSkill()).Name, ("style" + chara.body.GetAttackStyle()).lang());
60 UIList list = default(UIList);
61 if (idTab == 0)
62 {
63 Header("resistance", null);
64 ListResist();
65 list.callbacks = new UIList.Callback<Element, ButtonElement>
66 {
67 onInstantiate = delegate(Element a, ButtonElement b)
68 {
69 b.SetGrid(a, chara);
70 },
71 onList = delegate
72 {
73 foreach (SourceElement.Row item in EClass.sources.elements.rows.Where((SourceElement.Row a) => a.category == "resist" && ((!a.tag.Contains("hidden") && !a.tag.Contains("high")) || chara.Evalue(a.id) != 0)))
74 {
76 }
77 }
78 };
79 list.List();
80 }
81 else if (idTab == 1)
82 {
83 Header("mutation", null);
84 ListFeat();
85 list.callbacks = new UIList.Callback<Feat, ButtonElement>
86 {
87 onClick = delegate(Feat a, ButtonElement b)
88 {
90 },
91 onInstantiate = delegate(Feat a, ButtonElement b)
92 {
94 },
95 onList = delegate
96 {
97 foreach (Element item2 in chara.elements.ListElements((Element a) => a.source.category == "mutation" && a.Value != 0))
98 {
99 list.Add(item2);
100 }
101 }
102 };
103 list.List();
104 if (list.items.Count == 0)
105 {
106 _header.SetActive(enable: false);
107 list.SetActive(enable: false);
108 }
109 Header("etherDisease", null);
110 ListFeat();
111 list.callbacks = new UIList.Callback<Feat, ButtonElement>
112 {
113 onClick = delegate(Feat a, ButtonElement b)
114 {
116 },
117 onInstantiate = delegate(Feat a, ButtonElement b)
118 {
120 },
121 onList = delegate
122 {
123 foreach (Element item3 in chara.elements.ListElements((Element a) => a.source.category == "ether" && a.Value != 0))
124 {
125 list.Add(item3);
126 }
127 }
128 };
129 list.List();
130 if (list.items.Count == 0)
131 {
132 _header.SetActive(enable: false);
133 list.SetActive(enable: false);
134 }
135 Header("innateFeats", null);
136 ListFeat();
137 list.callbacks = new UIList.Callback<Feat, ButtonElement>
138 {
139 onClick = delegate(Feat a, ButtonElement b)
140 {
142 },
143 onInstantiate = delegate(Feat a, ButtonElement b)
144 {
146 },
147 onList = delegate
148 {
149 foreach (Element item4 in chara.elements.ListElements((Element a) => a.source.category == "feat" && a.HasTag("innate") && a.Value != 0))
150 {
151 list.Add(item4);
152 }
153 }
154 };
155 list.List();
156 Header("feats", null);
157 ListFeat();
158 list.callbacks = new UIList.Callback<Feat, ButtonElement>
159 {
160 onClick = delegate(Feat a, ButtonElement b)
161 {
163 },
164 onInstantiate = delegate(Feat a, ButtonElement b)
165 {
167 },
168 onList = delegate
169 {
170 foreach (Element item5 in chara.elements.ListElements((Element a) => a.source.category == "feat" && !a.HasTag("innate") && a.Value != 0))
171 {
172 list.Add(item5);
173 }
174 },
175 onSort = (Feat a, UIList.SortMode m) => a.GetSortVal(m)
176 };
177 list.ChangeSort(UIList.SortMode.ByID);
178 list.List();
179 }
180 else if (idTab == 2)
181 {
182 if (chara.c_upgrades == null)
183 {
184 chara.c_upgrades = new CharaUpgrade();
185 }
186 CharaUpgrade upgrades = chara.c_upgrades;
187 CharaGenes genes = chara.c_genes;
188 int num = upgrades.spent;
189 if (genes != null)
190 {
191 num += genes.GetTotalCost();
192 }
193 note.SetActive(enable: true);
194 note.AddText("feat_pet".lang(chara.feat.ToString() ?? "", num.ToString() ?? ""));
195 note.AddText("feat_inferior".lang(chara.CurrentGeneSlot.ToString() ?? "", chara.MaxGeneSlot.ToString() ?? "", ((genes != null) ? genes.inferior : 0).ToString() ?? ""));
196 note.AddText((chara.isScaled ? "feat_pet_type2" : "feat_pet_type1").lang());
197 note.Space(8);
198 foreach (CharaUpgrade.Item item6 in upgrades.items)
199 {
200 if (!Element.List_MainAttributesMajor.Contains(item6.idEle))
201 {
202 Element element = Element.Create(item6.idEle, item6.value);
203 note.AddText("upgraded".lang(element.Name.ToTitleCase(), item6.value.ToString() ?? "", item6.cost.ToString() ?? ""));
204 }
205 }
206 if (chara.c_genes != null)
207 {
208 foreach (DNA g in genes.items)
209 {
210 UIItem uIItem = note.AddItem("ItemGene");
211 uIItem.button1.mainText.SetText(g.GetText());
212 uIItem.button1.SetTooltip(delegate(UITooltip t)
213 {
214 UINote uINote = t.note;
215 uINote.Clear();
216 uINote.AddHeader(g.GetText());
217 g.WriteNote(uINote);
218 t.note.Build();
219 });
220 uIItem.button2.SetOnClick(delegate
221 {
222 if (!g.CanRemove())
223 {
224 SE.Beep();
225 }
226 else
227 {
228 Dialog.YesNo("dialog_removeGene", delegate
229 {
230 genes.inferior--;
231 SE.Trash();
232 genes.Remove(chara, g);
233 Refresh(idTab);
234 chara.RemoveAllStances();
235 });
236 }
237 });
238 uIItem.button2.SetActive(genes != null && genes.inferior > 0);
239 }
240 }
241 if (EClass.debug.enable)
242 {
243 note.AddButton("add 20".lang(), delegate
244 {
245 chara.feat += 20;
246 Refresh(idTab);
247 });
248 note.AddButton("grow 100".lang(), delegate
249 {
250 chara.feat += 100;
252 Refresh(idTab);
253 });
254 }
255 if (upgrades.count > 0)
256 {
257 note.AddButton("feat_reset".lang(), delegate
258 {
259 upgrades.Reset(chara);
260 SE.Trash();
261 Refresh(idTab);
262 });
263 }
264 note.Build();
265 }
266 else if (idTab == 3)
267 {
268 note.SetActive(enable: true);
269 WindowChara.RefreshNote(chara, note, shortMode: true);
270 }
272 void Header(string lang, string lang2)
273 {
275 _header.SetText(lang);
276 if (lang2 != null)
277 {
278 Util.Instantiate(moldHeader2, contentList).SetText(lang2);
279 }
280 }
281 void ListFeat()
282 {
284 }
285 void ListResist()
286 {
288 }
289 }
290
291 public void RefreshEquipment()
292 {
293 UIList uIList = listEq;
294 uIList.Clear();
295 uIList.callbacks = new UIList.Callback<BodySlot, UIItem>
296 {
297 onClick = delegate
298 {
299 },
300 onInstantiate = delegate(BodySlot a, UIItem b)
301 {
302 if (a.elementId == 0)
303 {
304 b.button1.interactable = false;
305 }
306 else
307 {
308 Thing thing = (Thing)(b.refObj = a.thing);
309 if (thing != null)
310 {
311 b.button1.icon.material = matItem;
312 thing.SetImage(b.button1.icon);
313 }
314 else
315 {
316 b.button1.icon.material = null;
317 b.button1.icon.sprite = SpriteSheet.Get("Media/Graphics/Icon/Element/", "eq_" + a.element.alias);
318 b.button1.icon.color = colorUnequipped;
319 b.button1.icon.SetNativeSize();
320 }
321 b.button1.SetTooltip(delegate(UITooltip tt)
322 {
323 if (a.thing != null)
324 {
325 a.thing.WriteNote(tt.note);
326 }
327 else
328 {
329 tt.note.Clear();
330 tt.note.AddHeader(a.name);
331 tt.note.AddText("noEQ".lang());
332 if (a.elementId == 35)
333 {
334 Thing.AddAttackEvaluation(tt.note, chara);
335 }
336 }
337 tt.note.Build();
338 });
339 }
340 },
341 onSort = (BodySlot a, UIList.SortMode m) => -a.element.sort
342 };
343 foreach (BodySlot slot in chara.body.slots)
344 {
345 if (slot.elementId != 44)
346 {
347 uIList.Add(slot);
348 }
349 }
350 uIList.Sort();
351 uIList.Refresh();
352 }
353}
list. Refresh()
string name
Definition: BodySlot.cs:14
int elementId
Definition: BodySlot.cs:6
Thing thing
Definition: BodySlot.cs:8
SourceElement.Row element
Definition: BodySlot.cs:16
void SetElement(Element _e, ElementContainer _owner, Mode _mode=Mode.Skill)
void SetGrid(Element e, Chara c)
ElementContainerCard elements
Definition: Card.cs:41
CharaUpgrade c_upgrades
Definition: Card.cs:1833
CharaGenes c_genes
Definition: Card.cs:1845
int feat
Definition: Card.cs:374
string NameSimple
Definition: Card.cs:2127
int Evalue(int ele)
Definition: Card.cs:2559
bool isScaled
Definition: Card.cs:914
void SetImage(Image image, int dir, int idSkin=0)
Definition: Card.cs:5960
List< BodySlot > slots
Definition: CharaBody.cs:8
AttackStyle GetAttackStyle()
Definition: CharaBody.cs:433
int GetWeight(bool armorOnly=false)
Definition: CharaBody.cs:390
int inferior
Definition: CharaGenes.cs:10
int GetTotalCost()
Definition: CharaGenes.cs:20
List< DNA > items
Definition: CharaGenes.cs:7
List< Item > items
Definition: CharaUpgrade.cs:61
Definition: Chara.cs:10
CharaBody body
Definition: Chara.cs:94
override int GetArmorSkill()
Definition: Chara.cs:7659
int MaxGeneSlot
Definition: Chara.cs:1066
int CurrentGeneSlot
Definition: Chara.cs:1069
void TryUpgrade(bool msg=true)
Definition: Chara.cs:8337
override int DV
Definition: Chara.cs:727
override int PV
Definition: Chara.cs:756
bool enable
Definition: CoreDebug.cs:286
Definition: DNA.cs:8
bool CanRemove()
Definition: DNA.cs:234
string GetText()
Definition: DNA.cs:538
void WriteNote(UINote n)
Definition: DNA.cs:548
Definition: EClass.cs:5
static SourceManager sources
Definition: EClass.cs:42
static CoreDebug debug
Definition: EClass.cs:48
List< Element > ListElements(Func< Element, bool > shoudList=null, Comparison< Element > comparison=null)
Element GetOrCreateElement(Element ele)
int id
Definition: ELEMENT.cs:250
SourceElement.Row source
Definition: ELEMENT.cs:273
bool HasTag(string tag)
Definition: ELEMENT.cs:473
int GetSortVal(UIList.SortMode m)
Definition: ELEMENT.cs:1005
int Value
Definition: ELEMENT.cs:292
virtual string Name
Definition: ELEMENT.cs:304
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1100
static int[] List_MainAttributesMajor
Definition: ELEMENT.cs:242
Definition: FEAT.cs:280
Definition: Lang.cs:6
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
Definition: Lang.cs:172
SourceElement elements
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
Definition: Thing.cs:8
override void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
Definition: Thing.cs:874
static void AddAttackEvaluation(UINote n, Chara chara, Thing current=null)
Definition: Thing.cs:1453
Image icon
Definition: UIButton.cs:110
UIText mainText
Definition: UIButton.cs:102
void SetTooltip(Action< UITooltip > onShowTooltip=null, bool enable=true)
Definition: UIButton.cs:361
void SetText(string s)
Definition: UIHeader.cs:24
Definition: UIItem.cs:5
UIButton button1
Definition: UIItem.cs:18
UIButton button2
Definition: UIItem.cs:20
object refObj
Definition: UIItem.cs:30
Definition: UIList.cs:9
List< object > items
Definition: UIList.cs:241
override void Clear()
Definition: UIList.cs:349
SortMode
Definition: UIList.cs:27
override void Add(object item)
Definition: UIList.cs:302
void ChangeSort(SortMode m)
Definition: UIList.cs:705
override void List()
Definition: UIList.cs:717
Definition: UINote.cs:6
void Clear()
Definition: UINote.cs:35
UIItem AddItem(string id)
Definition: UINote.cs:139
UIItem AddHeader(string text, Sprite sprite=null)
Definition: UINote.cs:79
UIButton AddButton(string text, Action onClick)
Definition: UINote.cs:182
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void Build()
Definition: UINote.cs:49
Definition: UIText.cs:6
void SetText(string s)
Definition: UIText.cs:159
UINote note
Definition: UITooltip.cs:21
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67
static void Toggle(Element e)
Transform contentList
override void OnSwitchContent(Window window)
UIHeader moldHeader2
UIHeader moldHeader
void SetChara(Chara c)
void Refresh(int idTab)
static void RefreshNote(Chara chara, UINote n, bool shortMode=false)
Definition: WindowChara.cs:859
Definition: Window.cs:13
int idTab
Definition: Window.cs:694