Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_NotificationData.c
Go to the documentation of this file.
1 
7 {
8  //--- Local params
9  protected ENotification m_iID;
10  protected float m_fNotificationTimeLeft = -1;
11  protected int m_iPrevPositionUpdated = -1;
12  protected string notificationEntry1, notificationEntry2, notificationEntry3, notificationEntry4, notificationEntry5, notificationEntry6;
13  protected bool m_bIsSplitNotification;
14  protected ENotificationColor m_FactionRelatedColor = ENotificationColor.NEUTRAL;
15  protected ENotificationColor m_FactionRelatedTextColor = ENotificationColor.NEUTRAL;
16  protected ENotificationColor m_FactionRelatedTextLeftColor = ENotificationColor.NEUTRAL;
17  protected ENotificationColor m_FactionRelatedTextRightColor = ENotificationColor.NEUTRAL;
18  protected SCR_NotificationDisplayData m_DisplayData;
19 
20  //--- Replicated params
21  protected int m_iParam1;
22  protected int m_iParam2;
23  protected int m_iParam3;
24  protected int m_iParam4;
25  protected int m_iParam5;
26  protected int m_iParam6;
27  protected vector m_vPosition = vector.Zero;
28  protected ENotificationReceiver m_iNotificationReceiverType;
29 
37  void SetMeta(int id, SCR_NotificationDisplayData displayData)
38  {
39  m_iID = id;
40 
41  //Set how much time left before notification will be deleted from data
42  m_fNotificationTimeLeft = SCR_NotificationsComponent.NOTIFICATION_DELETE_TIME;
43 
44  m_DisplayData = displayData;
45 
46  if (m_DisplayData)
47  {
48  if (!m_DisplayData.m_info)
49  {
50  Print("(" + typename.EnumToString(ENotification, GetID()) + ") SCR_NotificationDisplayData has no UIInfo assigned! This will cause errors!", LogLevel.ERROR);
51  m_DisplayData.m_info = new SCR_UINotificationInfo;
52  }
53 
54  //Set any initial local data such as initial notification position and faction related notification color
55  m_DisplayData.SetInitialDisplayData(this);
56  }
57  }
58 
63  int GetID()
64  {
65  return m_iID;
66  }
67 
72  ENotificationReceiver GetNotificationReceiverType()
73  {
74  return m_iNotificationReceiverType;
75  }
76 
81  float GetNotificationTimeLeft()
82  {
83  return m_fNotificationTimeLeft;
84  }
85 
91  bool UpdateNotificationData(float timeSlice)
92  {
93  m_fNotificationTimeLeft -= timeSlice;
94 
95  //Update Position ever second the notification data exists
96  if (m_DisplayData && m_DisplayData.GetNotificationUIInfo().GetEditorSetPositionData() == ENotificationSetPositionData.AUTO_SET_AND_UPDATE_POSITION)
97  {
98  if (m_iPrevPositionUpdated != (int)m_fNotificationTimeLeft)
99  {
100  m_iPrevPositionUpdated = m_fNotificationTimeLeft;
101  m_DisplayData.SetPosition(this);
102  }
103  }
104 
105  //No time left so delete
106  return (m_fNotificationTimeLeft <= 0);
107  }
108 
113  string GetText()
114  {
115  if (m_DisplayData)
116  {
117  return m_DisplayData.GetText(this);
118  }
119  else
120  {
121  Print("(" + typename.EnumToString(ENotification, GetID()) + ") SCR_NotificationDisplayData has no m_DisplayData assigned!", LogLevel.ERROR);
122  return typename.EnumToString(ENotification, GetID());
123  }
124  }
125 
135  void SetNotificationTextEntries(string entry1 = string.Empty, string entry2 = string.Empty, string entry3 = string.Empty, string entry4 = string.Empty, string entry5 = string.Empty, string entry6 = string.Empty)
136  {
137  if (entry1 != string.Empty)
138  notificationEntry1 = entry1;
139  if (entry2 != string.Empty)
140  notificationEntry2 = entry2;
141  if (entry3 != string.Empty)
142  notificationEntry3 = entry3;
143  if (entry4 != string.Empty)
144  notificationEntry4 = entry4;
145  if (entry5 != string.Empty)
146  notificationEntry5 = entry5;
147  if (entry6 != string.Empty)
148  notificationEntry6 = entry6;
149  }
150 
160  void GetNotificationTextEntries(out string entry1 = string.Empty, out string entry2 = string.Empty, out string entry3 = string.Empty, out string entry4 = string.Empty, out string entry5 = string.Empty, out string entry6 = string.Empty)
161  {
162  entry1 = notificationEntry1;
163  entry2 = notificationEntry2;
164  entry3 = notificationEntry3;
165  entry4 = notificationEntry4;
166  entry5 = notificationEntry5;
167  entry6 = notificationEntry6;
168  }
169 
176  void SetFactionRelatedColor(ENotificationColor factionRelatedColor)
177  {
178  m_FactionRelatedColor = factionRelatedColor;
179  }
180 
187  void SetFactionRelatedTextColor(ENotificationColor factionRelatedColor)
188  {
189  m_FactionRelatedTextColor = factionRelatedColor;
190  }
191 
199  void SetSplitFactionRelatedColor(ENotificationColor factionRelatedColorLeft, ENotificationColor factionRelatedColorRight)
200  {
201  m_FactionRelatedTextLeftColor = factionRelatedColorLeft;
202  m_FactionRelatedTextRightColor = factionRelatedColorRight;
203  }
204 
211  ENotificationColor GetFactionRelatedColor()
212  {
213  return m_FactionRelatedColor;
214  }
215 
222  ENotificationColor GetFactionRelatedTextColor()
223  {
224  return m_FactionRelatedTextColor;
225  }
226 
227 
234  void GetSplitFactionRelatedColor(out ENotificationColor leftTextColor, out ENotificationColor rightTextColor)
235  {
236  leftTextColor = m_FactionRelatedTextLeftColor;
237  rightTextColor = m_FactionRelatedTextRightColor;
238  }
239 
244  SCR_NotificationDisplayData GetDisplayData()
245  {
246  return m_DisplayData;
247  }
248 
253  void GetPosition(out vector position)
254  {
256  }
257 
268  void GetParams(out int param1, out int param2 = 0, out int param3 = 0, out int param4 = 0, out int param5 = 0, out int param6 = 0)
269  {
270  param1 = m_iParam1;
271  param2 = m_iParam2;
272  param3 = m_iParam3;
273  param4 = m_iParam4;
274  param5 = m_iParam5;
275  param6 = m_iParam6;
276  }
277 
281  void Log()
282  {
283  PrintFormat("%1\nID: %2\nParams: %3, %4, %5, %6, %7, %8", this, typename.EnumToString(ENotification, m_iID), m_iParam1, m_iParam2, m_iParam3, m_iParam4, m_iParam5, m_iParam6);
284  }
285 
286  static void Encode(SSnapSerializerBase snapshot, ScriptCtx hint, ScriptBitSerializer packet)
287  {
288  snapshot.Serialize(packet, 40);
289  }
290  static bool Decode(ScriptBitSerializer packet, ScriptCtx hint, SSnapSerializerBase snapshot)
291  {
292  return snapshot.Serialize(packet, 40);
293  }
294  static bool SnapCompare(SSnapSerializerBase lhs, SSnapSerializerBase rhs, ScriptCtx hint)
295  {
296  return lhs.CompareSnapshots(rhs, 40);
297  }
298  static bool PropCompare(SCR_NotificationData prop, SSnapSerializerBase snapshot, ScriptCtx hint)
299  {
300  return snapshot.Compare(prop.m_iParam1, 4)
301  && snapshot.Compare(prop.m_iParam2, 4)
302  && snapshot.Compare(prop.m_iParam3, 4)
303  && snapshot.Compare(prop.m_iParam4, 4)
304  && snapshot.Compare(prop.m_iParam5, 4)
305  && snapshot.Compare(prop.m_iParam6, 4)
306  && snapshot.Compare(prop.m_vPosition, 12)
307  && snapshot.Compare(prop.m_iNotificationReceiverType, 4);
308  }
309  static bool Extract(SCR_NotificationData prop, ScriptCtx hint, SSnapSerializerBase snapshot)
310  {
311  snapshot.SerializeBytes(prop.m_iParam1, 4);
312  snapshot.SerializeBytes(prop.m_iParam2, 4);
313  snapshot.SerializeBytes(prop.m_iParam3, 4);
314  snapshot.SerializeBytes(prop.m_iParam4, 4);
315  snapshot.SerializeBytes(prop.m_iParam5, 4);
316  snapshot.SerializeBytes(prop.m_iParam6, 4);
317  snapshot.SerializeBytes(prop.m_vPosition, 12);
318  snapshot.SerializeBytes(prop.m_iNotificationReceiverType, 4);
319  return true;
320  }
321  static bool Inject(SSnapSerializerBase snapshot, ScriptCtx hint, SCR_NotificationData prop)
322  {
323  snapshot.SerializeBytes(prop.m_iParam1, 4);
324  snapshot.SerializeBytes(prop.m_iParam2, 4);
325  snapshot.SerializeBytes(prop.m_iParam3, 4);
326  snapshot.SerializeBytes(prop.m_iParam4, 4);
327  snapshot.SerializeBytes(prop.m_iParam5, 4);
328  snapshot.SerializeBytes(prop.m_iParam6, 4);
329  snapshot.SerializeBytes(prop.m_vPosition, 12);
330  snapshot.SerializeBytes(prop.m_iNotificationReceiverType, 4);
331  return true;
332  }
333 
338  void SetPosition(vector position)
339  {
341  }
342 
354  void SetParameters(ENotificationReceiver receiverType, int param1 = 0, int param2 = 0, int param3 = 0, int param4 = 0, int param5 = 0, int param6 = 0)
355  {
356  m_iNotificationReceiverType = receiverType;
357  m_iParam1 = param1;
358  m_iParam2 = param2;
359  m_iParam3 = param3;
360  m_iParam4 = param4;
361  m_iParam5 = param5;
362  m_iParam6 = param6;
363  }
364 
365 };
SCR_NotificationDisplayData
Definition: SCR_NotificationDisplayData.c:7
ENotificationSetPositionData
ENotificationSetPositionData
Definition: ENotificationSetPositionData.c:6
ENotificationReceiver
ENotificationReceiver
Definition: ENotificationReceiver.c:4
m_iID
protected int m_iID
Definition: SCR_AmbientPatrolSpawnPointComponent.c:42
ENotification
ENotification
Definition: ENotification.c:4
SCR_NotificationData
Definition: SCR_NotificationData.c:6
ENotificationColor
ENotificationColor
Definition: ENotificationColor.c:4
m_vPosition
vector m_vPosition
Definition: SCR_AITalkRequest.c:23
position
vector position
Definition: SCR_DestructibleTreeV2.c:30
SCR_UINotificationInfo
UIInfo used by the Notifications system.
Definition: SCR_NotificationUIInfo.c:3