Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Area.cs
Go to the documentation of this file.
1using Newtonsoft.Json;
2
3public class Area : BaseArea
4{
5 [JsonProperty]
7
8 public bool isDestroyed;
9
10 public virtual bool isListable => true;
11
12 public virtual bool AutoTask => false;
13
15
16 public virtual void OnLoad()
17 {
18 foreach (Point point in points)
19 {
20 AddPoint(point, onLoad: true);
21 }
23 type.owner = this;
24 manager.mapIDs.Add(uid, this);
25 }
26
27 public void AddPoint(Point point, bool onLoad = false)
28 {
29 if (!onLoad)
30 {
31 points.Add(point);
32 }
33 point.cell.GetOrCreateDetail().area = this;
34 }
35
36 public void RemovePoint(Point point)
37 {
38 if (points.Count <= 1)
39 {
40 return;
41 }
42 foreach (Point point2 in points)
43 {
44 if (point2.Equals(point))
45 {
46 OnRemovePoint(point2);
47 points.Remove(point2);
48 point.detail.area = null;
49 point.cell.TryDespawnDetail();
50 break;
51 }
52 }
53 }
54
55 public virtual void OnRemovePoint(Point point)
56 {
57 }
58
59 public virtual void OnInstallCard(Card t)
60 {
61 }
62
63 public virtual void OnUninstallCard(Card t)
64 {
65 }
66
67 public void OnHoverArea(MeshPass pass)
68 {
69 foreach (Point point in points)
70 {
71 pass.Add(point, (EClass.scene.actionMode.AreaHihlight == AreaHighlightMode.Edit) ? 34 : 33);
72 }
73 }
74
75 public virtual byte GetTile(int index)
76 {
77 return 33;
78 }
79
80 public virtual void Update()
81 {
82 }
83
84 public void OnRemove()
85 {
86 if (isDestroyed)
87 {
88 return;
89 }
90 isDestroyed = true;
91 Task[] array = taskList.items.ToArray();
92 for (int i = 0; i < array.Length; i++)
93 {
94 array[i].Destroy();
95 }
96 foreach (Point point in points)
97 {
98 OnRemovePoint(point);
99 point.detail.area = null;
100 point.cell.TryDespawnDetail();
101 }
102 }
103
104 public static Area Create(string id)
105 {
106 Area area = new Area();
107 area.ChangeType(id);
109 return area;
110 }
111}
AreaHighlightMode
virtual AreaHighlightMode AreaHihlight
Definition: ActionMode.cs:169
Definition: Area.cs:4
RoomManager manager
Definition: Area.cs:14
virtual void OnInstallCard(Card t)
Definition: Area.cs:59
virtual bool isListable
Definition: Area.cs:10
void AddPoint(Point point, bool onLoad=false)
Definition: Area.cs:27
virtual void OnUninstallCard(Card t)
Definition: Area.cs:63
void OnHoverArea(MeshPass pass)
Definition: Area.cs:67
virtual bool AutoTask
Definition: Area.cs:12
virtual void OnLoad()
Definition: Area.cs:16
virtual void Update()
Definition: Area.cs:80
TaskList< Task > taskList
Definition: Area.cs:6
void RemovePoint(Point point)
Definition: Area.cs:36
virtual void OnRemovePoint(Point point)
Definition: Area.cs:55
virtual byte GetTile(int index)
Definition: Area.cs:75
void OnRemove()
Definition: Area.cs:84
static Area Create(string id)
Definition: Area.cs:104
bool isDestroyed
Definition: Area.cs:8
void ChangeType(string _id)
Definition: BaseArea.cs:106
PointList points
Definition: BaseArea.cs:26
int uid
Definition: BaseArea.cs:23
Definition: Card.cs:11
Area area
Definition: CellDetail.cs:15
CellDetail GetOrCreateDetail()
Definition: Cell.cs:1529
void TryDespawnDetail()
Definition: Cell.cs:1538
Definition: EClass.cs:5
static Scene scene
Definition: EClass.cs:30
static Map _map
Definition: EClass.cs:18
RoomManager rooms
Definition: Map.cs:31
Definition: Point.cs:9
bool Equals(int _x, int _z)
Definition: Point.cs:924
Cell cell
Definition: Point.cs:51
void AssignUID(BaseArea a)
Definition: RoomManager.cs:70
Dictionary< int, BaseArea > mapIDs
Definition: RoomManager.cs:18
ActionMode actionMode
Definition: Scene.cs:77
virtual void OnLoad()
Definition: TaskList.cs:12
List< T > items
Definition: TaskList.cs:32
Definition: Task.cs:4
Status Destroy()
Definition: Task.cs:31