Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_NotificationData.c
Go to the documentation of this file.
1
7{
8 //--- Local params
10 protected float m_fNotificationTimeLeft = -1;
11 protected int m_iPrevPositionUpdated = -1;
13 protected bool m_bIsSplitNotification;
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;
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);
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
76
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 {
99 {
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
177 {
178 m_FactionRelatedColor = factionRelatedColor;
179 }
180
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
215
226
227
234 void GetSplitFactionRelatedColor(out ENotificationColor leftTextColor, out ENotificationColor rightTextColor)
235 {
236 leftTextColor = m_FactionRelatedTextLeftColor;
237 rightTextColor = m_FactionRelatedTextRightColor;
238 }
239
248
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 {
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 }
295 {
296 return lhs.CompareSnapshots(rhs, 40);
297 }
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 }
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
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;
362 m_iParam6 = param6;
363 }
364
365};
AddonBuildInfoTool id
ENotification
ENotificationColor
ENotificationReceiver
vector position
static bool Inject(SSnapSerializerBase snapshot, ScriptCtx hint, SCR_NotificationData prop)
ENotificationColor m_FactionRelatedTextColor
static bool Extract(SCR_NotificationData prop, ScriptCtx hint, SSnapSerializerBase snapshot)
ENotificationColor m_FactionRelatedTextRightColor
ENotificationColor GetFactionRelatedTextColor()
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)
void SetPosition(vector position)
ENotificationReceiver m_iNotificationReceiverType
ENotificationReceiver GetNotificationReceiverType()
void SetSplitFactionRelatedColor(ENotificationColor factionRelatedColorLeft, ENotificationColor factionRelatedColorRight)
void SetMeta(int id, SCR_NotificationDisplayData displayData)
ENotificationColor m_FactionRelatedTextLeftColor
static bool SnapCompare(SSnapSerializerBase lhs, SSnapSerializerBase rhs, ScriptCtx hint)
bool UpdateNotificationData(float timeSlice)
static bool PropCompare(SCR_NotificationData prop, SSnapSerializerBase snapshot, ScriptCtx hint)
ENotificationColor m_FactionRelatedColor
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)
void GetPosition(out vector position)
void GetSplitFactionRelatedColor(out ENotificationColor leftTextColor, out ENotificationColor rightTextColor)
SCR_NotificationDisplayData m_DisplayData
void SetFactionRelatedColor(ENotificationColor factionRelatedColor)
SCR_NotificationDisplayData GetDisplayData()
void SetParameters(ENotificationReceiver receiverType, int param1=0, int param2=0, int param3=0, int param4=0, int param5=0, int param6=0)
static bool Decode(ScriptBitSerializer packet, ScriptCtx hint, SSnapSerializerBase snapshot)
void SetFactionRelatedTextColor(ENotificationColor factionRelatedColor)
static void Encode(SSnapSerializerBase snapshot, ScriptCtx hint, ScriptBitSerializer packet)
ENotificationColor GetFactionRelatedColor()
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)
UIInfo used by the Notifications system.
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
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
T4 param4
Definition tuple.c:152
T3 param3
Definition tuple.c:93
T2 param2
Definition tuple.c:92
Tuple param1
T5 param5
Definition tuple.c:153