Elin Decompiled Documentation EA 23.102 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 rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
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:55
Trait trait
Definition: Card.cs:49
bool IsInstalled
Definition: Card.cs:2241
Definition: Point.cs:9
List< Thing > Things
Definition: Point.cs:314
bool HasChara
Definition: Point.cs:226
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:339

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 if (seed != -1)
125 {
127 }
128 string combinedName = WordGen.GetCombinedName(EClass.Branch?.GetRandomName(), ListRoomNames().RandomItem(), room: true);
129 if (seed != -1)
130 {
131 Rand.SetSeed();
132 }
133 return combinedName;
134 }
@ seed
HashSet< string > ListRoomNames()
Definition: BaseArea.cs:136
Definition: EClass.cs:5
static FactionBranch Branch
Definition: EClass.cs:22
string GetRandomName()
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:37

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 161 of file BaseArea.cs.

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

References source.

Referenced by LayerHome.RefreshAreas().

◆ ListInteractions()

List< Interaction > BaseArea.ListInteractions ( )
inline

Definition at line 167 of file BaseArea.cs.

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

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

287 {
288 }

◆ 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 290 of file BaseArea.cs.

291 {
292 n.Clear();
294 n.Build();
295 }
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 BaseListPeople.OnInstantiate(), 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: