Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
NotificationsSystem.c
Go to the documentation of this file.
3 {
4  protected bool m_bUpdating = false;
5  protected ref array<SCR_NotificationsComponent> m_Components = {};
6  protected ref array<SCR_NotificationsComponent> m_DeletedComponents = {};
7 
8  override protected void OnUpdate(ESystemPoint point)
9  {
10  float timeSlice = GetWorld().GetTimeSlice();
11 
12  m_bUpdating = true;
13 
14  foreach (SCR_NotificationsComponent comp: m_Components)
15  {
16  comp.Update(timeSlice);
17  }
18 
19  m_bUpdating = false;
20 
21  foreach (SCR_NotificationsComponent comp: m_DeletedComponents)
22  {
23  Unregister(comp);
24  }
25  m_DeletedComponents.Clear();
26  }
27 
28  override protected void OnDiag(float timeSlice)
29  {
30  DbgUI.Begin("NotificationsSystem");
31 
32  DbgUI.Text("Items: " + m_Components.Count());
33 
34  if (DbgUI.Button("Dump active components"))
35  {
36  foreach (SCR_NotificationsComponent comp: m_Components)
37  {
38  Print(comp.GetOwner(), LogLevel.ERROR);
39  }
40  }
41 
42  DbgUI.End();
43  }
44 
45  void Register(SCR_NotificationsComponent component)
46  {
47  //About to be deleted
48  if (component.GetOwner().IsDeleted() || (component.GetOwner().GetFlags() & EntityFlags.USER5))
49  return;
50 
51  if (m_Components.Find(component) != -1)
52  return;
53 
54  m_Components.Insert(component);
55  }
56 
57  void Unregister(SCR_NotificationsComponent component)
58  {
59  int idx = m_Components.Find(component);
60  if (idx == -1)
61  return;
62 
63  if (m_bUpdating)
64  m_DeletedComponents.Insert(component);
65  else
66  m_Components.Remove(idx);
67  }
68 }
GameSystem
Definition: GameSystem.c:12
NotificationsSystem
TODO: When systems can be replicated, just move overything from SCR_NotificationsComponent.
Definition: NotificationsSystem.c:2