Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
NotificationsSystem.c
Go to the documentation of this file.
1
3{
4 override static void InitInfo(WorldSystemInfo outInfo)
5 {
6 outInfo
7 .SetAbstract(false)
8 .AddPoint(ESystemPoint.Frame);
9 }
10
11 protected bool m_bUpdating = false;
12 protected ref array<SCR_NotificationsComponent> m_Components = {};
13 protected ref array<SCR_NotificationsComponent> m_DeletedComponents = {};
14
15 override protected void OnUpdatePoint(WorldUpdatePointArgs args)
16 {
17 float timeSlice = args.GetTimeSliceSeconds();
18
19 m_bUpdating = true;
20
21 foreach (SCR_NotificationsComponent comp: m_Components)
22 {
23 comp.Update(timeSlice);
24 }
25
26 m_bUpdating = false;
27
28 foreach (SCR_NotificationsComponent comp: m_DeletedComponents)
29 {
30 Unregister(comp);
31 }
32 m_DeletedComponents.Clear();
33 }
34
35 override protected void OnDiag(float timeSlice)
36 {
37 DbgUI.Begin("NotificationsSystem");
38
39 DbgUI.Text("Items: " + m_Components.Count());
40
41 if (DbgUI.Button("Dump active components"))
42 {
43 foreach (SCR_NotificationsComponent comp: m_Components)
44 {
45 Print(comp.GetOwner(), LogLevel.ERROR);
46 }
47 }
48
49 DbgUI.End();
50 }
51
52 void Register(SCR_NotificationsComponent component)
53 {
54 //About to be deleted
55 if (component.GetOwner().IsDeleted() || (component.GetOwner().GetFlags() & EntityFlags.USER5))
56 return;
57
58 if (m_Components.Find(component) != -1)
59 return;
60
61 m_Components.Insert(component);
62 }
63
64 void Unregister(SCR_NotificationsComponent component)
65 {
66 int idx = m_Components.Find(component);
67 if (idx == -1)
68 return;
69
70 if (m_bUpdating)
71 m_DeletedComponents.Insert(component);
72 else
73 m_Components.Remove(idx);
74 }
75}
Definition DbgUI.c:66
TODO: When systems can be replicated, just move overything from SCR_NotificationsComponent.
void Register(SCR_NotificationsComponent component)
void OnDiag(float timeSlice)
ref array< SCR_NotificationsComponent > m_Components
void Unregister(SCR_NotificationsComponent component)
void OnUpdatePoint(WorldUpdatePointArgs args)
ref array< SCR_NotificationsComponent > m_DeletedComponents
Structure holding world system meta-information required by the engine.
Structure holding extra data of WorldSystem update point.
WorldSystemPoint ESystemPoint
Definition gameLib.c:7
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
EntityFlags
Various entity flags.
Definition EntityFlags.c:14