Elin Modding Docs Doc
Loading...
Searching...
No Matches
RoomManager.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using Newtonsoft.Json;
5
6// Token: 0x020006A6 RID: 1702
7public class RoomManager : EClass
8{
9 // Token: 0x06003169 RID: 12649 RVA: 0x00114A6C File Offset: 0x00112C6C
10 public void OnLoad()
11 {
12 foreach (Area area in this.listArea)
13 {
14 area.OnLoad();
15 }
16 foreach (Room room in this.listRoom)
17 {
18 room.OnLoad();
19 }
20 this.Refresh();
21 }
22
23 // Token: 0x0600316A RID: 12650 RVA: 0x00114B04 File Offset: 0x00112D04
24 public void AssignCharas()
25 {
26 }
27
28 // Token: 0x0600316B RID: 12651 RVA: 0x00114B08 File Offset: 0x00112D08
29 public void RefreshAll()
30 {
31 foreach (Room room in this.listRoom)
32 {
33 room.SetDirty();
34 }
35 this.Refresh();
36 }
37
38 // Token: 0x0600316C RID: 12652 RVA: 0x00114B60 File Offset: 0x00112D60
39 public void Refresh()
40 {
41 if (this.dirtyRooms)
42 {
43 foreach (Room room in this.listRoom)
44 {
45 if (room.dirty)
46 {
47 room.Refresh();
48 }
49 }
50 }
51 if (this.dirtyLots)
52 {
53 this.RebuildLots();
54 }
55 }
56
57 // Token: 0x0600316D RID: 12653 RVA: 0x00114BD0 File Offset: 0x00112DD0
58 public void AssignUID(BaseArea a)
59 {
60 a.uid = this.uidRoom;
61 this.uidRoom++;
62 }
63
64 // Token: 0x0600316E RID: 12654 RVA: 0x00114BEC File Offset: 0x00112DEC
65 public Area AddArea(Area a, Point p)
66 {
67 if (!this.listArea.Contains(a))
68 {
69 this.listArea.Add(a);
70 this.mapIDs.Add(a.uid, a);
71 }
72 a.AddPoint(p.Copy(), false);
73 return a;
74 }
75
76 // Token: 0x0600316F RID: 12655 RVA: 0x00114C28 File Offset: 0x00112E28
77 public Area TryAddArea(Point p, Area existingArea)
78 {
79 if (p.area != null)
80 {
81 return existingArea;
82 }
83 if (existingArea == null)
84 {
85 existingArea = Area.Create("public");
86 this.listArea.Add(existingArea);
87 this.mapIDs.Add(existingArea.uid, existingArea);
88 }
89 existingArea.AddPoint(p.Copy(), false);
90 return existingArea;
91 }
92
93 // Token: 0x06003170 RID: 12656 RVA: 0x00114C7A File Offset: 0x00112E7A
94 public void RemoveArea(Area a)
95 {
96 this.listArea.Remove(a);
97 this.mapIDs.Remove(a.uid);
98 a.OnRemove();
99 }
100
101 // Token: 0x06003171 RID: 12657 RVA: 0x00114CA1 File Offset: 0x00112EA1
102 public Room AddRoom(Room r)
103 {
104 this.listRoom.Add(r);
105 this.AssignUID(r);
106 r.SetDirty();
107 this.mapIDs.Add(r.uid, r);
108 return r;
109 }
110
111 // Token: 0x06003172 RID: 12658 RVA: 0x00114CCF File Offset: 0x00112ECF
112 public void RemoveRoom(Room r)
113 {
114 this.listRoom.Remove(r);
115 this.mapIDs.Remove(r.uid);
116 r.OnRemove();
117 }
118
119 // Token: 0x06003173 RID: 12659 RVA: 0x00114CF6 File Offset: 0x00112EF6
120 public HitResult GetHitResult(Point point, Point start)
121 {
122 if (point.area != null)
123 {
124 return HitResult.Invalid;
125 }
126 if (!point.HasBlock)
127 {
128 return HitResult.Valid;
129 }
130 return HitResult.Default;
131 }
132
133 // Token: 0x06003174 RID: 12660 RVA: 0x00114D10 File Offset: 0x00112F10
134 public void RebuildLots()
135 {
136 this.listLot.Clear();
137 foreach (Room room in this.listRoom)
138 {
139 room.lot = null;
140 }
141 foreach (Room room2 in this.listRoom)
142 {
143 if (room2.lot == null)
144 {
145 Lot lot = new Lot
146 {
147 x = room2.x,
148 z = room2.z,
149 mx = room2.mx,
150 mz = room2.mz
151 };
152 lot.SetBaseRoom(room2);
153 this.listLot.Add(lot);
154 }
155 }
156 this.dirtyLots = false;
157 }
158
159 // Token: 0x06003175 RID: 12661 RVA: 0x00114E00 File Offset: 0x00113000
160 public BaseArea FindBaseArea(string id)
161 {
162 this.tempList.Clear();
163 foreach (BaseArea baseArea in this.listRoom.Concat(this.listArea))
164 {
165 if (baseArea.type.id == id)
166 {
167 this.tempList.Add(baseArea);
168 }
169 }
170 if (this.tempList.Count == 0)
171 {
172 return null;
173 }
174 return this.tempList.RandomItem<BaseArea>();
175 }
176
177 // Token: 0x04001B55 RID: 6997
178 private List<BaseArea> tempList = new List<BaseArea>();
179
180 // Token: 0x04001B56 RID: 6998
181 [JsonProperty]
182 public List<Area> listArea = new List<Area>();
183
184 // Token: 0x04001B57 RID: 6999
185 [JsonProperty]
186 public List<Room> listRoom = new List<Room>();
187
188 // Token: 0x04001B58 RID: 7000
189 [JsonProperty]
190 public int uidRoom = 1;
191
192 // Token: 0x04001B59 RID: 7001
193 public Dictionary<int, BaseArea> mapIDs = new Dictionary<int, BaseArea>();
194
195 // Token: 0x04001B5A RID: 7002
196 public List<Lot> listLot = new List<Lot>();
197
198 // Token: 0x04001B5B RID: 7003
199 public bool dirtyLots;
200
201 // Token: 0x04001B5C RID: 7004
202 public bool dirtyRooms;
203}
Definition Area.cs:6
Definition Lot.cs:7
Definition Point.cs:11
Definition Room.cs:6