Elin Decompiled Documentation EA 23.331 Nightly
Loading...
Searching...
No Matches
BaseArea Class Reference
Inheritance diagram for BaseArea:
EClass IInspect Area Room VirtualRoom

Classes

class  Interaction
 

Public Types

enum  AccessType { Public , Resident , Private }
 
- Public Types inherited from IInspect
enum  NoteMode { Default , Recipe , Product , Info }
 

Public Member Functions

Point GetRandomFreePos ()
 
Thing GetEmptySeat ()
 
virtual Point GetRandomPoint (bool walkable=true, bool allowChara=true)
 
void ChangeType (string _id)
 
void SetRandomName (int seed=-1)
 
string GetRandomName (int seed=-1)
 
HashSet< string > ListRoomNames ()
 
int GetSortVal (UIList.SortMode m)
 
List< InteractionListInteractions ()
 
void OnInspect ()
 
void WriteNote (UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
 
void WriteNote (UINote n, Action< UINote > onWriteNote=null, NoteMode mode=NoteMode.Default, Recipe recipe=null)
 
void OnInspect ()
 

Public Attributes

int uid
 
PointList points = new PointList()
 
AreaData data = new AreaData()
 
AreaType type = new AreaTypeRoom()
 
TraitRoomPlate plate
 

Properties

virtual string Name [get]
 
bool IsPrivate [get]
 
SourceArea.Row source [get]
 
bool CanInspect [get]
 
string InspectName [get]
 
Point InspectPoint [get]
 
Vector3 InspectPosition [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 
- Properties inherited from IInspect
bool CanInspect [get]
 
string InspectName [get]
 
Point InspectPoint [get]
 
Vector3 InspectPosition [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 6 of file BaseArea.cs.

Member Enumeration Documentation

◆ AccessType

Enumerator
Public 
Resident 
Private 

Definition at line 8 of file BaseArea.cs.

Member Function Documentation

◆ ChangeType()

void BaseArea.ChangeType ( string  _id)
inline

Definition at line 106 of file BaseArea.cs.

107 {
108 type = ClassCache.Create<AreaType>("AreaType" + _id, "Elin");
109 type.id = _id;
110 type.owner = this;
111 if (plate != null)
112 {
113 plate.areaData.type = type;
114 }
115 }
TraitRoomPlate plate
Definition: BaseArea.cs:34
AreaType type
Definition: BaseArea.cs:32

References plate, and type.

Referenced by Area.Create().

◆ GetEmptySeat()

Thing BaseArea.GetEmptySeat ( )
inline

Definition at line 73 of file BaseArea.cs.

74 {
75 foreach (Point point in points)
76 {
77 foreach (Thing thing in point.Things)
78 {
79 if (thing.IsInstalled && !thing.pos.HasChara && thing.trait is TraitChair)
80 {
81 return thing;
82 }
83 }
84 }
85 return null;
86 }
PointList points
Definition: BaseArea.cs:26
Point pos
Definition: Card.cs:60
Trait trait
Definition: Card.cs:54
bool IsInstalled
Definition: Card.cs:2451
Definition: Point.cs:9
List< Thing > Things
Definition: Point.cs:338
bool HasChara
Definition: Point.cs:238
Definition: Thing.cs:8

References Point.HasChara, Card.IsInstalled, points, Card.pos, Point.Things, and Card.trait.

Referenced by MeetingManager.CallNext(), and MeetingManager.Start().

◆ GetRandomFreePos()

Point BaseArea.GetRandomFreePos ( )
inline

Definition at line 60 of file BaseArea.cs.

61 {
62 for (int i = 0; i < 100; i++)
63 {
64 Point point = points.RandomItem();
65 if (!point.IsBlocked)
66 {
67 return point;
68 }
69 }
70 return null;
71 }
bool IsBlocked
Definition: Point.cs:363

References Point.IsBlocked, and points.

Referenced by AreaTypeFarm.GetAI(), GoalSleep.OnSimulatePosition(), GoalWork.OnSimulatePosition(), and GoalSleep.Run().

◆ GetRandomName()

string BaseArea.GetRandomName ( int  seed = -1)
inline

Definition at line 122 of file BaseArea.cs.

123 {
124 bool flag = seed != -1;
125 if (flag)
126 {
128 }
129 string combinedName = WordGen.GetCombinedName(EClass.Branch?.GetRandomName(), ListRoomNames().RandomItem(), room: true, flag);
130 if (flag)
131 {
132 Rand.SetSeed();
133 }
134 return combinedName;
135 }
@ seed
HashSet< string > ListRoomNames()
Definition: BaseArea.cs:137
Definition: EClass.cs:6
static FactionBranch Branch
Definition: EClass.cs:23
string GetRandomName()
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:44

References EClass.Branch, FactionBranch.GetRandomName(), ListRoomNames(), seed, and Rand.SetSeed().

Referenced by ListInteractions(), and SetRandomName().

◆ GetRandomPoint()

virtual Point BaseArea.GetRandomPoint ( bool  walkable = true,
bool  allowChara = true 
)
inlinevirtual

Definition at line 88 of file BaseArea.cs.

89 {
90 if (walkable)
91 {
92 for (int i = 0; i < 100; i++)
93 {
94 foreach (Point point in points)
95 {
96 if (!point.IsBlocked && (allowChara || !point.HasChara))
97 {
98 return point;
99 }
100 }
101 }
102 }
103 return points.RandomItem();
104 }

References Point.HasChara, Point.IsBlocked, and points.

Referenced by MeetingManager.CallNext(), AI_Idle.Run(), AIWork_Chore.SetDestPos(), and MeetingManager.Start().

◆ GetSortVal()

int BaseArea.GetSortVal ( UIList::SortMode  m)
inline

Definition at line 162 of file BaseArea.cs.

163 {
164 _ = 7;
165 return source._index;
166 }
SourceArea.Row source
Definition: BaseArea.cs:50

References source.

Referenced by LayerHome.RefreshAreas().

◆ ListInteractions()

List< Interaction > BaseArea.ListInteractions ( )
inline

Definition at line 168 of file BaseArea.cs.

169 {
170 return new List<Interaction>
171 {
172 new Interaction
173 {
174 text = "accessType".lang(("access_" + data.accessType).lang()),
175 action = delegate
176 {
177 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
178 foreach (AccessType t in Util.EnumToList<AccessType>())
179 {
180 uIContextMenu.AddButton(((data.accessType == t) ? "context_checker".lang() : "") + ("access_" + t).lang(), delegate
181 {
182 data.accessType = t;
183 if (plate != null)
184 {
185 plate.areaData.accessType = data.accessType;
186 }
187 SE.ClickOk();
188 });
189 }
190 CursorSystem.ignoreCount = 5;
191 uIContextMenu.Show();
192 }
193 },
194 new Interaction
195 {
196 text = "changeName",
197 action = delegate
198 {
199 Dialog.InputName("dialogChangeName", data.name.IsEmpty(GetRandomName()), delegate(bool cancel, string text)
200 {
201 if (!cancel)
202 {
203 data.name = text;
204 if (plate != null)
205 {
206 plate.areaData.name = text;
207 }
208 }
209 });
210 }
211 },
212 new Interaction
213 {
214 text = "toggleShowWallItem".lang() + "(" + (data.showWallItem ? "on" : "off").lang() + ")",
215 action = delegate
216 {
217 data.showWallItem = !data.showWallItem;
218 SE.ClickOk();
219 }
220 },
221 new Interaction
222 {
223 text = "toggleAtrium".lang() + "(" + (data.atrium ? "on" : "off").lang() + ")",
224 action = delegate
225 {
226 data.atrium = !data.atrium;
227 if (plate != null)
228 {
229 plate.areaData.atrium = data.atrium;
230 }
231 SE.ClickOk();
232 }
233 },
234 new Interaction
235 {
236 text = "limitRoomHeight",
237 action = delegate
238 {
239 List<string> list2 = new List<string>();
240 EClass.ui.AddLayer<LayerList>().SetStringList(delegate
241 {
242 list2.Clear();
243 for (int j = 1; j < 10; j++)
244 {
245 list2.Add(j.ToString() ?? "");
246 }
247 return list2;
248 }, delegate(int a, string b)
249 {
250 data.maxHeight = a + 1;
251 if (plate != null)
252 {
253 plate.areaData.maxHeight = a + 1;
254 }
256 });
257 }
258 },
259 new Interaction
260 {
261 text = "changeGroup",
262 action = delegate
263 {
264 List<string> list = new List<string>();
265 EClass.ui.AddLayer<LayerList>().SetStringList(delegate
266 {
267 list.Clear();
268 for (int i = 0; i < 5; i++)
269 {
270 list.Add(i.ToString() ?? "");
271 }
272 return list;
273 }, delegate(int a, string b)
274 {
275 data.group = a;
276 if (plate != null)
277 {
278 plate.areaData.group = a;
279 }
281 });
282 }
283 }
284 };
285 }
bool showWallItem
Definition: AreaData.cs:54
BaseArea.AccessType accessType
Definition: AreaData.cs:42
bool atrium
Definition: AreaData.cs:66
string name
Definition: AreaData.cs:7
AccessType
Definition: BaseArea.cs:9
AreaData data
Definition: BaseArea.cs:29
string GetRandomName(int seed=-1)
Definition: BaseArea.cs:122
Definition: Dialog.cs:7
static Dialog InputName(string langDetail, string text, Action< bool, string > onClose, InputType inputType=InputType.Default)
Definition: Dialog.cs:536
static Map _map
Definition: EClass.cs:19
static UI ui
Definition: EClass.cs:17
RoomManager rooms
Definition: Map.cs:31
void RefreshAll()
Definition: RoomManager.cs:43
void Show(UIItem i)
void AddButton(Func< string > funcText, UnityAction action=null)
Definition: Util.cs:10

References EClass._map, AreaData.accessType, AreaData.atrium, data, GetRandomName(), Dialog.InputName(), AreaData.name, plate, RoomManager.RefreshAll(), Map.rooms, AreaData.showWallItem, EClass.ui, and Util.

Referenced by TraitRoomPlate.TrySetAct().

◆ ListRoomNames()

HashSet< string > BaseArea.ListRoomNames ( )
inline

Definition at line 137 of file BaseArea.cs.

138 {
139 HashSet<string> hashSet = new HashSet<string>();
140 string[] list = Lang.GetList("rooms");
141 foreach (string item in list)
142 {
143 hashSet.Add(item);
144 }
145 foreach (Point point in points)
146 {
147 foreach (Thing thing in point.Things)
148 {
149 if (thing.IsInstalled && !thing.source.roomName.IsEmpty())
150 {
151 list = thing.source.GetTextArray("roomName");
152 foreach (string item2 in list)
153 {
154 hashSet.Add(item2);
155 }
156 }
157 }
158 }
159 return hashSet;
160 }
Definition: Lang.cs:7
static string[] GetList(string id)
Definition: Lang.cs:113
SourceThing.Row source
Definition: Thing.cs:11

References Lang.GetList(), Card.IsInstalled, item, points, Thing.source, and Point.Things.

Referenced by GetRandomName().

◆ OnInspect()

void BaseArea.OnInspect ( )
inline

Implements IInspect.

Definition at line 287 of file BaseArea.cs.

288 {
289 }

◆ SetRandomName()

void BaseArea.SetRandomName ( int  seed = -1)
inline

Definition at line 117 of file BaseArea.cs.

118 {
119 data.name = GetRandomName(seed);
120 }

References GetRandomName(), and seed.

Referenced by AM_CreateArea.OnProcessTiles(), and Room.Refresh().

◆ WriteNote()

void BaseArea.WriteNote ( UINote  n,
Action< UINote onWriteNote = null,
IInspect::NoteMode  mode = IInspect::NoteMode::Default,
Recipe  recipe = null 
)
inline

Implements IInspect.

Definition at line 291 of file BaseArea.cs.

292 {
293 n.Clear();
295 n.Build();
296 }
virtual string Name
Definition: BaseArea.cs:37
UIItem AddHeaderCard(string text, Sprite sprite=null)
Definition: UINote.cs:84
void Clear()
Definition: UINote.cs:35
void Build()
Definition: UINote.cs:49

References UINote.AddHeaderCard(), UINote.Build(), and UINote.Clear().

Member Data Documentation

◆ data

◆ plate

TraitRoomPlate BaseArea.plate

Definition at line 34 of file BaseArea.cs.

Referenced by ChangeType(), Room.Clean(), ListInteractions(), and Room.Refresh().

◆ points

◆ type

AreaType BaseArea.type = new AreaTypeRoom()

◆ uid

Property Documentation

◆ CanInspect

bool BaseArea.CanInspect
get

Implements IInspect.

Definition at line 52 of file BaseArea.cs.

◆ InspectName

string BaseArea.InspectName
get

Implements IInspect.

Definition at line 54 of file BaseArea.cs.

◆ InspectPoint

Point BaseArea.InspectPoint
get

Implements IInspect.

Definition at line 56 of file BaseArea.cs.

◆ InspectPosition

Vector3 BaseArea.InspectPosition
get

Implements IInspect.

Definition at line 58 of file BaseArea.cs.

◆ IsPrivate

bool BaseArea.IsPrivate
get

Definition at line 48 of file BaseArea.cs.

Referenced by AIWork_Chore.SetDestPos().

◆ Name

virtual string BaseArea.Name
get

Definition at line 36 of file BaseArea.cs.

37 {
38 get
39 {
40 if (!data.name.IsEmpty())
41 {
42 return data.name;
43 }
44 return type.source.GetName();
45 }
46 }
SourceArea.Row source
Definition: AreaType.cs:29

Referenced by LayerHome.RefreshAreas(), UIRecipeInfo.SetArea(), and BaseListPeople.WriteHobbies().

◆ source

SourceArea.Row BaseArea.source
get

Definition at line 50 of file BaseArea.cs.

Referenced by GetSortVal(), BuildMenu.RefreshCategoryArea(), and UIRecipeInfo.SetArea().


The documentation for this class was generated from the following file: