Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerHome.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4
5// Token: 0x02000556 RID: 1366
6public class LayerHome : ELayer
7{
8 // Token: 0x0600250B RID: 9483 RVA: 0x000D1E1D File Offset: 0x000D001D
9 public override bool HeaderIsListOf(int id)
10 {
11 return id != 0;
12 }
13
14 // Token: 0x0600250C RID: 9484 RVA: 0x000D1E23 File Offset: 0x000D0023
15 public override void OnInit()
16 {
17 this.branch = ELayer.Branch;
18 LayerHome.Instance = this;
19 }
20
21 // Token: 0x0600250D RID: 9485 RVA: 0x000D1E38 File Offset: 0x000D0038
22 public override void OnSwitchContent(Window window)
23 {
24 if (window.setting.tabs.Count == 0)
25 {
26 return;
27 }
28 WindowMenu menuLeft = window.menuLeft;
29 menuLeft.Clear();
30 if (ELayer.player.shippingResults.Count > 0)
31 {
32 menuLeft.AddButtonSimple(() => "shipping_result".lang(), delegate(UIButton a)
33 {
34 ELayer.ui.AddLayer<LayerShippingResult>().Show();
35 }, null, "Simple");
36 }
37 string idLang = window.CurrentTab.idLang;
38 if (idLang == "top")
39 {
40 this.info.Refresh();
41 return;
42 }
43 if (!(idLang == "skills"))
44 {
45 if (!(idLang == "population"))
46 {
47 if (!(idLang == "chronicle"))
48 {
49 return;
50 }
51 this.RefreshChronicle();
52 }
53 return;
54 }
55 this.RefreshFeat();
56 }
57
58 // Token: 0x0600250E RID: 9486 RVA: 0x000D1F1C File Offset: 0x000D011C
59 public void RefreshChronicle()
60 {
61 }
62
63 // Token: 0x0600250F RID: 9487 RVA: 0x000D1F20 File Offset: 0x000D0120
64 public void RefreshTech(bool listComplete = false)
65 {
66 UIList list = listComplete ? this.listTech2 : this.listTech;
67 list.sortMode = ELayer.player.pref.sortResearch;
68 BaseList list2 = list;
69 UIList.Callback<ResearchPlan, ItemResearch> callback = new UIList.Callback<ResearchPlan, ItemResearch>();
70 callback.onInstantiate = delegate(ResearchPlan a, ItemResearch b)
71 {
72 };
73 callback.onList = delegate(UIList.SortMode m)
74 {
75 foreach (ResearchPlan o in (listComplete ? this.branch.researches.finished : this.branch.researches.plans))
76 {
77 list.Add(o);
78 }
79 };
80 callback.onSort = ((ResearchPlan a, UIList.SortMode m) => a.GetSortVal(m));
81 list2.callbacks = callback;
82 list.List(false);
83 this.RefreshFocus();
84 }
85
86 // Token: 0x06002510 RID: 9488 RVA: 0x000D1FF8 File Offset: 0x000D01F8
87 public void RefreshFocus()
88 {
89 foreach (ItemResearch itemResearch in this.listTech.GetComponentsInChildren<ItemResearch>())
90 {
91 itemResearch.goFocus.SetActive(itemResearch.plan == this.branch.researches.focused);
92 }
93 }
94
95 // Token: 0x06002511 RID: 9489 RVA: 0x000D2048 File Offset: 0x000D0248
96 public void RefreshFeat()
97 {
98 BaseList baseList = this.listFeat;
99 UIList.Callback<Element, ButtonElement> callback = new UIList.Callback<Element, ButtonElement>();
100 callback.onClick = delegate(Element a, ButtonElement b)
101 {
102 int p = ELayer.Branch.GetTechUpgradeCost(a);
103 int currency = ELayer.pc.GetCurrency("money2");
104 if (p == 0 || p > currency || a.ValueWithoutLink == 0 || a.source.cost[0] == 0)
105 {
106 SE.Beep();
107 return;
108 }
109 Dialog.YesNo("dialogUpgradeTech".lang(a.Name, null, null, null, null), delegate
110 {
111 SE.Pay();
112 ELayer.pc.ModCurrency(-p, "money2");
113 ELayer.Branch.elements.ModBase(a.id, 1);
114 this.listFeat.List(false);
115 ELayer.Branch.resources.SetDirty();
116 ELayer.core.game.player.hotbars.ResetHotbar(2);
117 if (WidgetHotbar.HotBarMainMenu)
118 {
119 WidgetHotbar.HotBarMainMenu.RebuildPage(-1);
120 }
121 if (WidgetMenuPanel.Instance)
122 {
123 WidgetMenuPanel.Instance.OnChangeActionMode();
124 }
125 }, null, "yes", "no");
126 };
127 callback.onInstantiate = delegate(Element a, ButtonElement b)
128 {
129 b.SetElement(a, ELayer._zone.elements, ButtonElement.Mode.Tech);
130 };
131 callback.onList = delegate(UIList.SortMode m)
132 {
133 foreach (Element o in from b in this.branch.elements.dict.Values
134 where (b.Value > 0 || b.vBase > 0) && b.source.category != "policy" && b.source.category != "landfeat" && !b.HasTag("hidden")
135 select b)
136 {
137 this.listFeat.Add(o);
138 }
139 };
140 callback.onSort = ((Element a, UIList.SortMode m) => a.GetSortVal(m));
141 callback.onRefresh = null;
142 baseList.callbacks = callback;
143 this.listFeat.List(false);
144 BaseList baseList2 = this.listFeat2;
145 UIList.Callback<Element, ButtonElement> callback2 = new UIList.Callback<Element, ButtonElement>();
146 callback2.onClick = delegate(Element a, ButtonElement b)
147 {
148 };
149 callback2.onInstantiate = delegate(Element a, ButtonElement b)
150 {
151 b.SetElement(a, ELayer._zone.elements, ButtonElement.Mode.Policy);
152 };
153 callback2.onList = delegate(UIList.SortMode m)
154 {
155 foreach (Element o in from b in this.branch.elements.dict.Values
156 where b.source.category == "policy"
157 select b)
158 {
159 this.listFeat2.Add(o);
160 }
161 };
162 callback2.onSort = ((Element a, UIList.SortMode m) => a.GetSortVal(m));
163 callback2.onRefresh = null;
164 baseList2.callbacks = callback2;
165 this.listFeat2.List(false);
166 BaseList baseList3 = this.listFeat3;
167 UIList.Callback<Element, ButtonElement> callback3 = new UIList.Callback<Element, ButtonElement>();
168 callback3.onClick = delegate(Element a, ButtonElement b)
169 {
170 };
171 callback3.onInstantiate = delegate(Element a, ButtonElement b)
172 {
173 b.SetElement(a, ELayer._zone.elements, ButtonElement.Mode.LandFeat);
174 };
175 callback3.onList = delegate(UIList.SortMode m)
176 {
177 IEnumerable<Element> enumerable = this.branch.elements.dict.Values;
178 if (this.branch.HasNetwork)
179 {
180 enumerable = enumerable.Concat(ELayer.pc.faction.elements.dict.Values);
181 }
182 foreach (Element o in from b in enumerable
183 where (b.Value > 0 || b.vBase > 0) && b.source.category == "landfeat" && !b.HasTag("hidden")
184 select b)
185 {
186 this.listFeat3.Add(o);
187 }
188 };
189 callback3.onSort = ((Element a, UIList.SortMode m) => a.GetSortVal(m));
190 callback3.onRefresh = null;
191 baseList3.callbacks = callback3;
192 this.listFeat3.List(false);
193 }
194
195 // Token: 0x06002512 RID: 9490 RVA: 0x000D2230 File Offset: 0x000D0430
196 public void RefreshAreas()
197 {
198 BaseList baseList = this.listArea;
199 UIList.Callback<Area, ItemGeneral> callback = new UIList.Callback<Area, ItemGeneral>();
200 callback.onClick = delegate(Area a, ItemGeneral b)
201 {
202 };
203 callback.onInstantiate = delegate(Area a, ItemGeneral b)
204 {
205 UIButton button = b.button1;
206 b.SetMainText(a.Name, null, true);
207 b.AddSubButton(ELayer.core.refs.icons.go, delegate
208 {
209 ELayer.screen.Focus(a.points[0]);
210 }, "tFocus", null);
211 b.Build();
212 };
213 callback.onList = delegate(UIList.SortMode m)
214 {
215 foreach (Area o in ELayer._map.rooms.listArea)
216 {
217 this.listArea.Add(o);
218 }
219 };
220 callback.onSort = ((Area a, UIList.SortMode m) => a.GetSortVal(m));
221 callback.onRefresh = null;
222 baseList.callbacks = callback;
223 this.listArea.List(false);
224 }
225
226 // Token: 0x06002513 RID: 9491 RVA: 0x000D22E4 File Offset: 0x000D04E4
227 public void RefreshSpots()
228 {
229 this.listArea.Clear();
230 BaseList baseList = this.listArea;
231 UIList.Callback<Trait, ItemGeneral> callback = new UIList.Callback<Trait, ItemGeneral>();
232 callback.onClick = delegate(Trait a, ItemGeneral b)
233 {
234 };
235 callback.onInstantiate = delegate(Trait a, ItemGeneral b)
236 {
237 UIButton button = b.button1;
238 b.SetMainText(a.Name, null, true);
239 b.AddSubButton(ELayer.core.refs.icons.go, delegate
240 {
241 ELayer.screen.Focus(a.GetPoint());
242 }, "tFocus", null);
243 b.Build();
244 };
245 callback.onList = delegate(UIList.SortMode m)
246 {
247 foreach (Card card in ELayer._map.Installed.all.Values)
248 {
249 if (card.trait.IsSpot)
250 {
251 this.listArea.Add(card.trait);
252 }
253 }
254 };
255 callback.onSort = ((Trait a, UIList.SortMode m) => a.GetSortVal(m));
256 callback.onRefresh = null;
257 baseList.callbacks = callback;
258 this.listArea.List(false);
259 }
260
261 // Token: 0x0400149C RID: 5276
262 public static LayerHome Instance;
263
264 // Token: 0x0400149D RID: 5277
265 public UIList listArea;
266
267 // Token: 0x0400149E RID: 5278
268 public UIList listTech;
269
270 // Token: 0x0400149F RID: 5279
271 public UIList listTech2;
272
273 // Token: 0x040014A0 RID: 5280
274 public UIList listFeat;
275
276 // Token: 0x040014A1 RID: 5281
277 public UIList listFeat2;
278
279 // Token: 0x040014A2 RID: 5282
280 public UIList listFeat3;
281
282 // Token: 0x040014A3 RID: 5283
283 public FactionBranch branch;
284
285 // Token: 0x040014A4 RID: 5284
286 public UIHomeInfo info;
287
288 // Token: 0x040014A5 RID: 5285
289 public const int TabResearch = 1;
290
291 // Token: 0x040014A6 RID: 5286
292 public const int TabPolicy = 2;
293
294 // Token: 0x040014A7 RID: 5287
295 public const int TabPopulation = 3;
296
297 // Token: 0x040014A8 RID: 5288
298 public const int TabFeat = 4;
299}
Definition Area.cs:6
Definition Card.cs:13
Definition Trait.cs:9