Elin Modding Docs Doc
Loading...
Searching...
No Matches
BaseListPeople.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x020005AA RID: 1450
6public class BaseListPeople : ListOwner<Chara, ItemGeneral>
7{
8 // Token: 0x17000BB2 RID: 2994
9 // (get) Token: 0x060027C5 RID: 10181 RVA: 0x000E0E3A File Offset: 0x000DF03A
10 public new LayerPeople layer
11 {
12 get
13 {
14 return this.layer as LayerPeople;
15 }
16 }
17
18 // Token: 0x17000BB3 RID: 2995
19 // (get) Token: 0x060027C6 RID: 10182 RVA: 0x000E0E47 File Offset: 0x000DF047
20 public override string IdHeaderRow
21 {
22 get
23 {
24 return "HeaderRowPeople";
25 }
26 }
27
28 // Token: 0x17000BB4 RID: 2996
29 // (get) Token: 0x060027C7 RID: 10183 RVA: 0x000E0E4E File Offset: 0x000DF04E
30 public virtual bool ShowCharaSheet
31 {
32 get
33 {
34 return false;
35 }
36 }
37
38 // Token: 0x17000BB5 RID: 2997
39 // (get) Token: 0x060027C8 RID: 10184 RVA: 0x000E0E51 File Offset: 0x000DF051
40 public virtual bool ShowShowMode
41 {
42 get
43 {
44 return false;
45 }
46 }
47
48 // Token: 0x17000BB6 RID: 2998
49 // (get) Token: 0x060027C9 RID: 10185 RVA: 0x000E0E54 File Offset: 0x000DF054
50 public virtual bool ShowGoto
51 {
52 get
53 {
54 return false;
55 }
56 }
57
58 // Token: 0x17000BB7 RID: 2999
59 // (get) Token: 0x060027CA RID: 10186 RVA: 0x000E0E57 File Offset: 0x000DF057
60 public virtual bool ShowHome
61 {
62 get
63 {
64 return false;
65 }
66 }
67
68 // Token: 0x060027CB RID: 10187 RVA: 0x000E0E5A File Offset: 0x000DF05A
69 public virtual bool IsDisabled(Chara c)
70 {
71 return !c.isDead && c.memberType != FactionMemberType.Guest && !c.IsInHomeZone();
72 }
73
74 // Token: 0x060027CC RID: 10188 RVA: 0x000E0E78 File Offset: 0x000DF078
75 public override void List()
76 {
77 BaseList list = this.list;
78 UIList.Callback<Chara, ItemGeneral> callback = new UIList.Callback<Chara, ItemGeneral>();
79 callback.onInstantiate = delegate(Chara a, ItemGeneral b)
80 {
81 b.SetChara(a);
82 this.OnInstantiate(a, b);
83 b.Build();
84 };
85 callback.onClick = delegate(Chara c, ItemGeneral i)
86 {
87 this.OnClick(c, i);
88 };
89 callback.onSort = delegate(Chara a, UIList.SortMode m)
90 {
91 a.SetSortVal(m, CurrencyType.Money);
92 return -a.sortVal;
93 };
94 callback.onList = delegate(UIList.SortMode m)
95 {
96 this.OnList();
97 };
98 callback.onRefresh = null;
99 list.callbacks = callback;
100 this.list.List(false);
101 }
102
103 // Token: 0x060027CD RID: 10189 RVA: 0x000E0F04 File Offset: 0x000DF104
104 public override void OnInstantiate(Chara a, ItemGeneral b)
105 {
106 BaseListPeople.<>c__DisplayClass16_0 CS$<>8__locals1 = new BaseListPeople.<>c__DisplayClass16_0();
107 CS$<>8__locals1.<>4__this = this;
108 CS$<>8__locals1.a = a;
109 this.SetSubText(CS$<>8__locals1.a, b);
110 if (this.ShowHome)
111 {
112 BaseArea roomWork = null;
113 bool flag = false;
114 foreach (Hobby hobby in CS$<>8__locals1.a.ListWorks(true))
115 {
116 AIWork ai = hobby.GetAI(CS$<>8__locals1.a);
117 flag = ai.SetDestination();
118 if (flag)
119 {
120 if (ai.destArea != null)
121 {
122 roomWork = ai.destArea;
123 break;
124 }
125 if (ai.destThing != null)
126 {
127 roomWork = ai.destThing.pos.cell.room;
128 break;
129 }
130 break;
131 }
132 }
133 b.AddSubButton(EClass.core.refs.icons.work, delegate
134 {
135 if (roomWork == null)
136 {
137 SE.BeepSmall();
138 return;
139 }
140 EClass.pc.SetAI(new AI_Goto(roomWork.GetRandomFreePos(), 1, false, false));
141 CS$<>8__locals1.<>4__this.layer.Close();
142 }, null, delegate(UITooltip t)
143 {
144 BaseListPeople.<>c__DisplayClass16_2 CS$<>8__locals3;
145 CS$<>8__locals3.t = t;
146 CS$<>8__locals3.t.note.Clear();
147 BaseArea roomWork;
148 CS$<>8__locals3.t.note.AddHeader("infoWork".lang((roomWork != null) ? roomWork.Name : "none".lang(), null, null, null, null), null);
149 foreach (Hobby h in CS$<>8__locals1.a.ListWorks(true))
150 {
151 CS$<>8__locals1.<OnInstantiate>g__AddText|5(h, "work", ref CS$<>8__locals3);
152 }
153 foreach (Hobby h2 in CS$<>8__locals1.a.ListHobbies(true))
154 {
155 CS$<>8__locals1.<OnInstantiate>g__AddText|5(h2, "hobby", ref CS$<>8__locals3);
156 }
157 CS$<>8__locals3.t.note.Build();
158 roomWork = roomWork;
159 }).icon.SetAlpha(flag ? 1f : 0.4f);
160 Room room = CS$<>8__locals1.a.FindRoom();
161 TraitBed bed = CS$<>8__locals1.a.FindBed();
162 if (CS$<>8__locals1.a.memberType == FactionMemberType.Default)
163 {
164 b.AddSubButton(EClass.core.refs.icons.home, delegate
165 {
166 if (room == null)
167 {
168 SE.BeepSmall();
169 return;
170 }
171 EClass.pc.SetAI(new AI_Goto(room.GetRandomFreePos(), 1, false, false));
172 CS$<>8__locals1.<>4__this.layer.Close();
173 }, null, delegate(UITooltip t)
174 {
175 t.note.Clear();
176 t.note.AddHeader("infoHome".lang((room != null) ? room.Name : "none".lang(), null, null, null, null), null);
177 t.note.AddTopic("TopicLeft", "infoBed".lang(), (bed != null) ? bed.Name.ToTitleCase(false) : "none".lang());
178 t.note.Build();
179 if (room != null)
180 {
181 EClass.core.actionsNextFrame.Add(delegate
182 {
183 });
184 }
185 }).icon.SetAlpha((room != null) ? 1f : 0.4f);
186 }
187 }
188 if (this.ShowCharaSheet && EClass.debug.showExtra)
189 {
190 b.AddSubButton(EClass.core.refs.icons.inspect, delegate
191 {
192 SE.Play("pop_paper");
193 LayerChara layerChara = EClass.ui.AddLayerDontCloseOthers<LayerChara>();
194 layerChara.windows[0].SetRect(EClass.core.refs.rects.center, false);
195 layerChara.SetChara(CS$<>8__locals1.a);
196 }, "charaInfo", null);
197 }
198 if (this.IsDisabled(CS$<>8__locals1.a))
199 {
200 b.gameObject.AddComponent<CanvasGroup>().alpha = 0.6f;
201 }
202 }
203
204 // Token: 0x060027CE RID: 10190 RVA: 0x000E1138 File Offset: 0x000DF338
205 public virtual void SetSubText(Chara a, ItemGeneral b)
206 {
207 switch (this.layer.showMode)
208 {
209 case LayerPeople.ShowMode.Job:
210 b.SetSubText(a.job.GetName().ToTitleCase(true), 300, FontColor.Default, TextAnchor.MiddleLeft);
211 return;
212 case LayerPeople.ShowMode.Race:
213 b.SetSubText(a.race.GetName().ToTitleCase(true), 300, FontColor.Default, TextAnchor.MiddleLeft);
214 return;
215 case LayerPeople.ShowMode.Work:
216 {
217 string lang = a.GetTextWork(true) + "," + a.GetTextHobby(true);
218 b.SetSubText(lang, 300, FontColor.Default, TextAnchor.MiddleLeft);
219 return;
220 }
221 default:
222 return;
223 }
224 }
225
226 // Token: 0x060027CF RID: 10191 RVA: 0x000E11CC File Offset: 0x000DF3CC
227 public override void OnClick(Chara c, ItemGeneral i)
228 {
229 if (!c.IsAliveInCurrentZone)
230 {
231 SE.BeepSmall();
232 return;
233 }
234 UIContextMenu uicontextMenu = EClass.ui.CreateContextMenuInteraction().SetHighlightTarget(i);
235 if (c.IsGuest())
236 {
237 uicontextMenu.AddButton("findMember", delegate()
238 {
239 EClass.pc.SetAI(new AI_Goto(c, 1, false, false));
240 this.layer.Close();
241 }, true);
242 }
243 else if (c.IsHomeMember())
244 {
245 if (!c.IsPC)
246 {
247 uicontextMenu.AddButton("findMember", delegate()
248 {
249 EClass.pc.SetAI(new AI_Goto(c, 1, false, false));
250 this.layer.Close();
251 }, true);
252 }
253 Action<bool, string> <>9__4;
254 uicontextMenu.AddButton("changeName", delegate()
255 {
256 string langDetail = "dialogChangeName";
257 string text2 = c.c_altName.IsEmpty(c.NameSimple);
258 Action<bool, string> onClose;
259 if ((onClose = <>9__4) == null)
260 {
261 onClose = (<>9__4 = delegate(bool cancel, string text)
262 {
263 if (!cancel)
264 {
265 if (text == "*r")
266 {
267 text = NameGen.getRandomName();
268 }
269 c.c_altName = text;
270 this.layer.OnSwitchContent(this.layer.windows[0]);
271 }
272 });
273 }
274 Dialog.InputName(langDetail, text2, onClose, Dialog.InputType.Default);
275 }, true);
276 if (c == EClass.pc)
277 {
278 uicontextMenu.AddButton("changeTitle", delegate()
279 {
280 EClass.ui.AddLayer<LayerList>().SetStringList(() => WordGen.GetList("title"), delegate(int a, string b)
281 {
282 EClass.player.title = b;
283 }, true).SetSize(400f, -1f);
284 }, true);
285 }
286 else
287 {
288 if (c.sourceCard.idActor.IsEmpty() && c.host == null)
289 {
290 if (c.pccData == null)
291 {
292 uicontextMenu.AddButton("togglePCC", delegate()
293 {
294 bool isSynced = c.isSynced;
295 c.pccData = PCCData.Create(c.IDPCCBodySet);
296 c.pccData.Randomize(c.IDPCCBodySet, null, true);
297 if (isSynced)
298 {
299 c.renderer.OnLeaveScreen();
300 }
301 EClass.scene.syncList.Remove(c.renderer);
302 c._CreateRenderer();
303 if (isSynced)
304 {
305 EClass.scene.syncList.Add(c.renderer);
306 c.renderer.OnEnterScreen();
307 }
308 this.list.Refresh(false);
309 SE.Click();
310 }, true);
311 }
312 else
313 {
314 uicontextMenu.AddButton("editPCC", delegate()
315 {
316 EClass.ui.AddLayer<LayerEditPCC>().Activate(c, UIPCC.Mode.Full, null, null);
317 }, true);
318 uicontextMenu.AddButton("togglePCC", delegate()
319 {
320 bool isSynced = c.isSynced;
321 if (isSynced)
322 {
323 c.renderer.OnLeaveScreen();
324 }
325 EClass.scene.syncList.Remove(c.renderer);
326 c.pccData = null;
327 c._CreateRenderer();
328 if (isSynced)
329 {
330 EClass.scene.syncList.Add(c.renderer);
331 c.renderer.OnEnterScreen();
332 }
333 this.list.Refresh(false);
334 }, true);
335 }
336 }
337 uicontextMenu.AddButton("makeMaid", delegate()
338 {
339 if (EClass.Branch.uidMaid == c.uid)
340 {
341 EClass.Branch.uidMaid = 0;
342 }
343 else
344 {
345 EClass.Branch.uidMaid = c.uid;
346 }
347 this.list.Refresh(false);
348 SE.Click();
349 }, true);
350 int @int = c.GetInt(36, null);
351 bool isLivestockTimerOn = this.memberType == FactionMemberType.Default && !EClass.world.date.IsExpired(@int);
352 int remainingHours = EClass.world.date.GetRemainingHours(@int);
353 uicontextMenu.AddButton((c.memberType == FactionMemberType.Livestock) ? "daMakeResident" : (isLivestockTimerOn ? "daMakeLivestock2".lang(Date.GetText(remainingHours), null, null, null, null) : "daMakeLivestock"), delegate()
354 {
355 if (isLivestockTimerOn)
356 {
357 SE.Beep();
358 return;
359 }
360 if (c.memberType == FactionMemberType.Livestock)
361 {
362 c.SetInt(36, EClass.world.date.GetRaw(0) + 14400);
363 }
364 EClass.Branch.ChangeMemberType(c, (c.memberType == FactionMemberType.Livestock) ? FactionMemberType.Default : FactionMemberType.Livestock);
365 this.List();
366 SE.Click();
367 }, true);
368 uicontextMenu.AddButton("addToReserve", delegate()
369 {
370 if (EClass.Home.listReserve.Count >= EClass.Home.maxReserve)
371 {
372 SE.Beep();
373 Msg.Say("reserveLimit");
374 return;
375 }
376 SE.MoveZone();
377 EClass.Home.AddReserve(c);
378 this.list.List(false);
379 }, true);
380 }
381 }
382 uicontextMenu.Show();
383 }
384
385 // Token: 0x060027D0 RID: 10192 RVA: 0x000E145C File Offset: 0x000DF65C
386 public override void OnList()
387 {
388 if (this.memberType == FactionMemberType.Guest)
389 {
390 using (List<Chara>.Enumerator enumerator = EClass._map.charas.GetEnumerator())
391 {
392 while (enumerator.MoveNext())
393 {
394 Chara chara = enumerator.Current;
395 if (chara.IsGuest())
396 {
397 this.list.Add(chara);
398 }
399 }
400 return;
401 }
402 }
403 foreach (Chara chara2 in EClass.Branch.members)
404 {
405 if (chara2.memberType == this.memberType && !chara2.IsPCParty && !chara2.isSummon)
406 {
407 this.list.Add(chara2);
408 }
409 }
410 }
411
412 // Token: 0x060027D1 RID: 10193 RVA: 0x000E1534 File Offset: 0x000DF734
413 public override void OnRefreshMenu()
414 {
415 WindowMenu menuLeft = this.window.menuLeft;
416 menuLeft.Clear();
417 if (!this.main)
418 {
419 return;
420 }
421 menuLeft.AddButton2Line("sort", () => this.list.sortMode.ToString(), delegate(UIButton b)
422 {
423 this.list.NextSort();
424 }, null, "2line");
425 if (this.ShowShowMode)
426 {
427 Lang.GetList("info_people");
428 menuLeft.AddButton2Line("info", () => "show" + this.layer.showMode.ToString(), delegate(UIButton b)
429 {
430 this.layer.showMode = this.layer.showMode.NextEnum<LayerPeople.ShowMode>();
431 this.List();
432 }, null, "2line");
433 }
434 }
435
436 // Token: 0x0400161E RID: 5662
437 public Chara owner;
438
439 // Token: 0x0400161F RID: 5663
440 public FactionMemberType memberType;
441}
Definition Chara.cs:12
Definition Date.cs:6
Definition Hobby.cs:5
Definition Msg.cs:7
Definition Room.cs:6