Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerQuestBoard.cs
1using System;
2using System.Runtime.CompilerServices;
3using UnityEngine;
4using UnityEngine.Events;
5
6// Token: 0x020005B7 RID: 1463
7public class LayerQuestBoard : ELayer
8{
9 // Token: 0x06002816 RID: 10262 RVA: 0x000E2770 File Offset: 0x000E0970
10 public override void OnInit()
11 {
12 if (ELayer._zone.IsPCFaction)
13 {
14 ELayer._zone.branch.UpdateReqruits(false);
15 }
16 this.windows[0].setting.tabs[1].disable = !ELayer._zone.IsPCFaction;
17 }
18
19 // Token: 0x06002817 RID: 10263 RVA: 0x000E27C8 File Offset: 0x000E09C8
20 public override void OnSwitchContent(Window window)
21 {
22 switch (window.idTab)
23 {
24 case 0:
25 this.RefreshQuest();
26 break;
27 case 1:
28 this.RefreshHire();
29 break;
30 case 2:
31 this.RefreshRanking();
32 break;
33 }
34 WindowMenu menuRight = this.windows[0].menuRight;
35 menuRight.Clear();
36 if (window.idTab == 0)
37 {
38 menuRight.AddButton("rerollQuest".lang(1.ToString() ?? "", null, null, null, null), delegate(UIButton b)
39 {
40 if (ELayer._zone.influence < 1)
41 {
42 SE.Beep();
43 Msg.Say("notEnoughInfluence");
44 return;
45 }
46 SE.Dice();
47 ELayer._zone.UpdateQuests(true);
48 this.RefreshQuest();
49 Zone zone = ELayer._zone;
50 int influence = zone.influence;
51 zone.influence = influence - 1;
52 }, null, "Default");
53 }
54 }
55
56 // Token: 0x06002818 RID: 10264 RVA: 0x000E2860 File Offset: 0x000E0A60
57 public void RefreshQuest()
58 {
59 this.list.Clear();
60 this.list.callbacks = new UIList.Callback<Quest, ItemQuest>
61 {
62 onInstantiate = delegate(Quest a, ItemQuest b)
63 {
64 b.SetQuest(a);
65 b.button.SetOnClick(delegate
66 {
67 this.Close();
68 a.OnClickQuest();
69 });
70 }
71 };
72 ELayer._zone.UpdateQuests(false);
73 foreach (Quest quest in ELayer.game.quests.globalList)
74 {
75 if (quest.IsVisibleOnQuestBoard())
76 {
77 this.list.Add(quest);
78 }
79 }
80 foreach (Chara chara in ELayer._map.charas)
81 {
82 if (chara.quest != null && !ELayer.game.quests.list.Contains(chara.quest) && !chara.IsPCParty && chara.memberType == FactionMemberType.Default && chara.quest.IsVisibleOnQuestBoard())
83 {
84 this.list.Add(chara.quest);
85 }
86 }
87 this.list.Refresh(false);
88 this.textQuestLimit.SetText("questLimit".lang(ELayer.game.quests.CountRandomQuest().ToString() ?? "", 5.ToString() ?? "", null, null, null));
89 }
90
91 // Token: 0x06002819 RID: 10265 RVA: 0x000E29EC File Offset: 0x000E0BEC
92 public void RefreshHire()
93 {
94 UIList list = this.listHire;
95 list.Clear();
96 list.callbacks = new UIList.Callback<HireInfo, ButtonChara>
97 {
98 onClick = delegate(HireInfo a, ButtonChara b)
99 {
100 a.isNew = false;
101 GameLang.refDrama1 = string.Concat(new string[]
102 {
103 "(",
104 "money2".lang(),
105 ": ",
106 CalcGold.Hire(a.chara).ToString(),
107 ")"
108 });
109 Thing thing = ELayer.pc.things.Find("ticket_resident", -1, -1);
110 GameLang.refDrama2 = (((thing != null) ? thing.Name : null) ?? "");
111 a.chara.ShowDialog("_chara", "4-1", "").onKill.AddListener(new UnityAction(this.RefreshHire));
112 },
113 onInstantiate = delegate(HireInfo a, ButtonChara b)
114 {
115 Chara chara = a.chara;
116 b.SetChara(chara, ButtonChara.Mode.Hire);
117 int cost = CalcGold.Hire(chara);
118 b.item.text1.text = cost.ToString().TagColorGoodBad(() => ELayer.pc.GetCurrency("money2") >= cost || ELayer.pc.things.Find("ticket_resident", -1, -1) != null, false);
119 b.item.text2.text = ((a.Days == -1) ? "-" : (a.Days.ToString() ?? ""));
120 Action <>9__3;
121 foreach (HintIcon hintIcon in b.layoutTag.GetComponentsInChildren<HintIcon>())
122 {
123 Action onPointerDown;
124 if ((onPointerDown = <>9__3) == null)
125 {
126 onPointerDown = (<>9__3 = delegate()
127 {
128 list.callbacks.OnClick(a, b);
129 });
130 }
131 hintIcon.onPointerDown = onPointerDown;
132 }
133 b.textHobby.text = chara.GetTextHobby(false);
134 b.textWork.text = chara.GetTextWork(false);
135 b.textLifeStyle.text = "lifestyle".lang() + ": " + ("lifestyle_" + chara.idTimeTable).lang();
136 b.item.image1.SetActive(a.isNew);
137 },
138 onRefresh = null
139 };
140 foreach (HireInfo hireInfo in ELayer.Branch.listRecruit)
141 {
142 if (!hireInfo.chara.IsHomeMember() && (hireInfo.chara.currentZone == null || !hireInfo.chara.currentZone.IsPlayerFaction))
143 {
144 list.Add(hireInfo);
145 }
146 }
147 list.Refresh(false);
148 this.RebuildLayout(true);
149 }
150
151 // Token: 0x0600281A RID: 10266 RVA: 0x000E2AE8 File Offset: 0x000E0CE8
152 public void RefreshRanking()
153 {
154 UIDynamicList list = this.listRanking;
155 list.Clear();
156 BaseList baseList = list;
157 UIList.Callback<Chara, ButtonChara> callback = new UIList.Callback<Chara, ButtonChara>();
158 callback.onClick = delegate(Chara a, ButtonChara b)
159 {
160 };
161 callback.onRedraw = delegate(Chara a, ButtonChara b, int i)
162 {
163 b.SetChara(a, ButtonChara.Mode.Ranking);
164 int advRank = a.trait.GetAdvRank();
165 b.textAlias.SetText(a.trait.GetAdvRankText());
166 b.textAlias.color = this.gradientRank.Evaluate(0.1f * (float)advRank);
167 b.item.image2.SetActive(a.IsPCFaction);
168 };
169 callback.onList = delegate(UIList.SortMode m)
170 {
171 foreach (Chara chara in ELayer.game.cards.globalCharas.Values)
172 {
173 if (chara.trait.ShowAdvRank)
174 {
175 list.Add(chara);
176 }
177 }
178 list.objects.Sort((object a, object b) => LayerQuestBoard.<RefreshRanking>g__GetSortVal|18_0(b as Chara) - LayerQuestBoard.<RefreshRanking>g__GetSortVal|18_0(a as Chara));
179 };
180 callback.onRefresh = null;
181 baseList.callbacks = callback;
182 list.List();
183 int num = list.objects.IndexOf(ELayer.pc);
184 if (num != -1)
185 {
186 list.dsv.scrollByItemIndex(num);
187 list.Refresh();
188 }
189 this.RebuildLayout(true);
190 }
191
192 // Token: 0x0600281B RID: 10267 RVA: 0x000E2BC1 File Offset: 0x000E0DC1
193 public override void OnKill()
194 {
195 if (ELayer.Branch != null)
196 {
197 ELayer.Branch.ClearNewRecruits();
198 }
199 }
200
201 // Token: 0x0600281F RID: 10271 RVA: 0x000E2C78 File Offset: 0x000E0E78
202 [CompilerGenerated]
203 internal static int <RefreshRanking>g__GetSortVal|18_0(Chara c)
204 {
205 return c.trait.GetAdvRank() * 10000 + Mathf.Clamp(c.LV, 0, 1000) + ((c.trait is TraitAdventurerBacker) ? 1000 : 0);
206 }
207
208 // Token: 0x0400164A RID: 5706
209 public UIList list;
210
211 // Token: 0x0400164B RID: 5707
212 public UIList listHire;
213
214 // Token: 0x0400164C RID: 5708
215 public UIDynamicList listRanking;
216
217 // Token: 0x0400164D RID: 5709
218 public UIText textClient;
219
220 // Token: 0x0400164E RID: 5710
221 public UIText textTitle;
222
223 // Token: 0x0400164F RID: 5711
224 public UIText textDetail;
225
226 // Token: 0x04001650 RID: 5712
227 public UIText textHours;
228
229 // Token: 0x04001651 RID: 5713
230 public UIText textNote;
231
232 // Token: 0x04001652 RID: 5714
233 public UIText textReward;
234
235 // Token: 0x04001653 RID: 5715
236 public UIText textQuestLimit;
237
238 // Token: 0x04001654 RID: 5716
239 public Portrait portrait;
240
241 // Token: 0x04001655 RID: 5717
242 public UIButton buttonTalk;
243
244 // Token: 0x04001656 RID: 5718
245 public UICurrency uiCurrency;
246
247 // Token: 0x04001657 RID: 5719
248 public Gradient gradientRank;
249}
Definition Chara.cs:12
Definition Msg.cs:7
Definition Quest.cs:8
Definition Thing.cs:10
Definition Zone.cs:14