Elin Modding Docs Doc
Loading...
Searching...
No Matches
BaseArea.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4using UnityEngine;
5
6// Token: 0x02000216 RID: 534
7public class BaseArea : EClass, IInspect
8{
9 // Token: 0x170003EB RID: 1003
10 // (get) Token: 0x06000F38 RID: 3896 RVA: 0x0006F00B File Offset: 0x0006D20B
11 public virtual string Name
12 {
13 get
14 {
15 if (!this.data.name.IsEmpty())
16 {
17 return this.data.name;
18 }
19 return this.type.source.GetName();
20 }
21 }
22
23 // Token: 0x170003EC RID: 1004
24 // (get) Token: 0x06000F39 RID: 3897 RVA: 0x0006F03B File Offset: 0x0006D23B
25 public bool IsPrivate
26 {
27 get
28 {
29 return this.data.accessType == BaseArea.AccessType.Private;
30 }
31 }
32
33 // Token: 0x170003ED RID: 1005
34 // (get) Token: 0x06000F3A RID: 3898 RVA: 0x0006F04B File Offset: 0x0006D24B
35 public SourceArea.Row source
36 {
37 get
38 {
39 return this.type.source;
40 }
41 }
42
43 // Token: 0x06000F3B RID: 3899 RVA: 0x0006F058 File Offset: 0x0006D258
44 public Point GetRandomFreePos()
45 {
46 for (int i = 0; i < 100; i++)
47 {
48 Point point = this.points.RandomItem<Point>();
49 if (!point.IsBlocked)
50 {
51 return point;
52 }
53 }
54 return null;
55 }
56
57 // Token: 0x06000F3C RID: 3900 RVA: 0x0006F08C File Offset: 0x0006D28C
58 public Thing GetEmptySeat()
59 {
60 foreach (Point point in this.points)
61 {
62 foreach (Thing thing in point.Things)
63 {
64 if (thing.IsInstalled && !thing.pos.HasChara && thing.trait is TraitChair)
65 {
66 return thing;
67 }
68 }
69 }
70 return null;
71 }
72
73 // Token: 0x06000F3D RID: 3901 RVA: 0x0006F13C File Offset: 0x0006D33C
74 public virtual Point GetRandomPoint(bool walkable = true, bool allowChara = true)
75 {
76 if (walkable)
77 {
78 for (int i = 0; i < 100; i++)
79 {
80 foreach (Point point in this.points)
81 {
82 if (!point.IsBlocked && (allowChara || !point.HasChara))
83 {
84 return point;
85 }
86 }
87 }
88 }
89 return this.points.RandomItem<Point>();
90 }
91
92 // Token: 0x06000F3E RID: 3902 RVA: 0x0006F1BC File Offset: 0x0006D3BC
93 public void ChangeType(string _id)
94 {
95 this.type = ClassCache.Create<AreaType>("AreaType" + _id, "Elin");
96 this.type.id = _id;
97 this.type.owner = this;
98 if (this.plate != null)
99 {
100 this.plate.areaData.type = this.type;
101 }
102 }
103
104 // Token: 0x06000F3F RID: 3903 RVA: 0x0006F21A File Offset: 0x0006D41A
105 public void SetRandomName(int seed = -1)
106 {
107 this.data.name = this.GetRandomName(seed);
108 }
109
110 // Token: 0x06000F40 RID: 3904 RVA: 0x0006F22E File Offset: 0x0006D42E
111 public string GetRandomName(int seed = -1)
112 {
113 if (seed != -1)
114 {
115 Rand.SetSeed(seed);
116 }
117 FactionBranch branch = EClass.Branch;
118 string combinedName = WordGen.GetCombinedName((branch != null) ? branch.GetRandomName() : null, this.ListRoomNames().RandomItem<string>(), true);
119 if (seed != -1)
120 {
121 Rand.SetSeed(-1);
122 }
123 return combinedName;
124 }
125
126 // Token: 0x06000F41 RID: 3905 RVA: 0x0006F268 File Offset: 0x0006D468
127 public HashSet<string> ListRoomNames()
128 {
129 HashSet<string> hashSet = new HashSet<string>();
130 foreach (string item in Lang.GetList("rooms"))
131 {
132 hashSet.Add(item);
133 }
134 foreach (Point point in this.points)
135 {
136 foreach (Thing thing in point.Things)
137 {
138 if (thing.IsInstalled && !thing.source.roomName.IsEmpty())
139 {
140 foreach (string item2 in thing.source.GetTextArray("roomName"))
141 {
142 hashSet.Add(item2);
143 }
144 }
145 }
146 }
147 return hashSet;
148 }
149
150 // Token: 0x06000F42 RID: 3906 RVA: 0x0006F36C File Offset: 0x0006D56C
151 public int GetSortVal(UIList.SortMode m)
152 {
153 return this.source._index;
154 }
155
156 // Token: 0x06000F43 RID: 3907 RVA: 0x0006F380 File Offset: 0x0006D580
157 public List<BaseArea.Interaction> ListInteractions()
158 {
159 return new List<BaseArea.Interaction>
160 {
162 {
163 text = "accessType".lang(("access_" + this.data.accessType.ToString()).lang(), null, null, null, null),
164 action = delegate()
165 {
166 UIContextMenu uicontextMenu = EClass.ui.CreateContextMenuInteraction();
167 foreach (BaseArea.AccessType accessType in Util.EnumToList<BaseArea.AccessType>())
168 {
169 uicontextMenu.AddButton(((this.data.accessType == accessType) ? "context_checker".lang() : "") + ("access_" + accessType.ToString()).lang(), delegate()
170 {
171 this.data.accessType = ((this.data.accessType == BaseArea.AccessType.Public) ? BaseArea.AccessType.Private : BaseArea.AccessType.Public);
172 if (this.plate != null)
173 {
174 this.plate.areaData.accessType = this.data.accessType;
175 }
176 SE.ClickOk();
177 }, true);
178 }
179 CursorSystem.ignoreCount = 5;
180 uicontextMenu.Show();
181 }
182 },
184 {
185 text = "changeName",
186 action = delegate()
187 {
188 List<string> list = new List<string>();
189 EClass.ui.AddLayer<LayerList>().SetStringList(delegate
190 {
191 list.Clear();
192 for (int i = 0; i < 10; i++)
193 {
194 list.Add(this.GetRandomName(-1));
195 }
196 return list;
197 }, delegate(int a, string b)
198 {
199 this.data.name = list[a];
200 if (this.plate != null)
201 {
202 this.plate.areaData.name = list[a];
203 }
204 }, true).SetSize(450f, -1f).EnableReroll();
205 }
206 },
208 {
209 text = "toggleShowWallItem".lang() + "(" + (this.data.showWallItem ? "on" : "off").lang() + ")",
210 action = delegate()
211 {
212 this.data.showWallItem = !this.data.showWallItem;
213 SE.ClickOk();
214 }
215 },
217 {
218 text = "toggleAtrium".lang() + "(" + (this.data.atrium ? "on" : "off").lang() + ")",
219 action = delegate()
220 {
221 this.data.atrium = !this.data.atrium;
222 if (this.plate != null)
223 {
224 this.plate.areaData.atrium = this.data.atrium;
225 }
226 SE.ClickOk();
227 }
228 },
230 {
231 text = "limitRoomHeight",
232 action = delegate()
233 {
234 List<string> list = new List<string>();
235 EClass.ui.AddLayer<LayerList>().SetStringList(delegate
236 {
237 list.Clear();
238 for (int i = 1; i < 10; i++)
239 {
240 list.Add(i.ToString() ?? "");
241 }
242 return list;
243 }, delegate(int a, string b)
244 {
245 this.data.maxHeight = a + 1;
246 if (this.plate != null)
247 {
248 this.plate.areaData.maxHeight = a + 1;
249 }
250 EClass._map.rooms.RefreshAll();
251 }, true);
252 }
253 },
255 {
256 text = "changeGroup",
257 action = delegate()
258 {
259 List<string> list = new List<string>();
260 EClass.ui.AddLayer<LayerList>().SetStringList(delegate
261 {
262 list.Clear();
263 for (int i = 0; i < 5; i++)
264 {
265 list.Add(i.ToString() ?? "");
266 }
267 return list;
268 }, delegate(int a, string b)
269 {
270 this.data.group = a;
271 if (this.plate != null)
272 {
273 this.plate.areaData.group = a;
274 }
275 EClass._map.rooms.RefreshAll();
276 }, true);
277 }
278 }
279 };
280 }
281
282 // Token: 0x06000F44 RID: 3908 RVA: 0x0006F517 File Offset: 0x0006D717
283 public void OnInspect()
284 {
285 }
286
287 // Token: 0x170003EE RID: 1006
288 // (get) Token: 0x06000F45 RID: 3909 RVA: 0x0006F519 File Offset: 0x0006D719
289 public bool CanInspect
290 {
291 get
292 {
293 return true;
294 }
295 }
296
297 // Token: 0x170003EF RID: 1007
298 // (get) Token: 0x06000F46 RID: 3910 RVA: 0x0006F51C File Offset: 0x0006D71C
299 public string InspectName
300 {
301 get
302 {
303 return this.Name;
304 }
305 }
306
307 // Token: 0x170003F0 RID: 1008
308 // (get) Token: 0x06000F47 RID: 3911 RVA: 0x0006F524 File Offset: 0x0006D724
309 public Point InspectPoint
310 {
311 get
312 {
313 return Point.Invalid;
314 }
315 }
316
317 // Token: 0x06000F48 RID: 3912 RVA: 0x0006F52B File Offset: 0x0006D72B
318 public void WriteNote(UINote n, Action<UINote> onWriteNote = null, IInspect.NoteMode mode = IInspect.NoteMode.Default, Recipe recipe = null)
319 {
320 n.Clear();
321 n.AddHeaderCard(this.Name, null);
322 n.Build();
323 }
324
325 // Token: 0x170003F1 RID: 1009
326 // (get) Token: 0x06000F49 RID: 3913 RVA: 0x0006F547 File Offset: 0x0006D747
327 public Vector3 InspectPosition
328 {
329 get
330 {
331 return Vector3.zero;
332 }
333 }
334
335 // Token: 0x04000D77 RID: 3447
336 [JsonProperty]
337 public int uid;
338
339 // Token: 0x04000D78 RID: 3448
340 [JsonProperty]
341 public PointList points = new PointList();
342
343 // Token: 0x04000D79 RID: 3449
344 [JsonProperty]
345 public AreaData data = new AreaData();
346
347 // Token: 0x04000D7A RID: 3450
348 [JsonProperty]
349 public AreaType type = new AreaTypeRoom();
350
351 // Token: 0x04000D7B RID: 3451
352 public TraitRoomPlate plate;
353
354 // Token: 0x0200090B RID: 2315
355 public enum AccessType
356 {
357 // Token: 0x04002652 RID: 9810
358 Public,
359 // Token: 0x04002653 RID: 9811
360 Private
361 }
362
363 // Token: 0x0200090C RID: 2316
364 public class Interaction
365 {
366 // Token: 0x04002654 RID: 9812
367 public string text;
368
369 // Token: 0x04002655 RID: 9813
370 public Action action;
371 }
372}
Definition Point.cs:11
Definition Thing.cs:10