Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_VonDisplay.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
4 {
5  // Widgets
7  Widget m_wBaseWidget;
8 
9  bool m_bForceUpdate; // when transmission update is required
10  bool m_bVisible; // element visible, false if widget not visible
11  bool m_bIsActive; // active, false when widget starts fade out
12  bool m_bIsAnimating; // in process of fade in/out
13  bool m_bIsAdditional;
14  int m_iPlayerID; // incoming tranmissions playerID
15  float m_fAlpha; // opacity
16  float m_fActiveTimeout; // delay before active element starts fading
17  float m_fFrequency; // current frequency
18  float m_fQuality;
19  IEntity m_Entity; // transmitting character
20  Faction m_Faction;
21  BaseTransceiver m_RadioTransceiver;
22 
23  //------------------------------------------------------------------------------------------------
24  // Hide transmission, skip animation
25  void HideTransmission()
26  {
27  m_fAlpha = 0;
28  m_bIsActive = false;
29  m_bIsAnimating = false;
30  m_fActiveTimeout = 0;
31  m_bVisible = false;
32  if (m_wBaseWidget)
33  m_wBaseWidget.SetVisible(false);
34  }
35 
36  //------------------------------------------------------------------------------------------------
37  void TransmissionData(Widget base, int iPlayerID)
38  {
39  m_wBaseWidget = base;
40  m_wBaseWidget.SetOpacity(0);
41 
44 
45  m_iPlayerID = iPlayerID;
46  }
47 }
48 
49 //------------------------------------------------------------------------------------------------
51 class SCR_VonDisplay : SCR_InfoDisplayExtended
52 {
53  [Attribute("{2EFEA2AF1F38E7F0}UI/Textures/Icons/icons_wrapperUI-64.m_sImageSet")];
54  protected string m_sImageSet;
55 
56  [Attribute("{ABC6B36856013403}UI/Textures/Icons/icons_wrapperUI-64-glow.m_sImageSet")];
57  protected string m_sImageSetGlow;
58 
59  [Attribute("{25221F619214A722}UI/layouts/HUD/VON/VoNOverlay_Element.layout")];
60  protected string m_sReceivingTransmissionLayout;
61 
62  const string ICON_DIRECT_SPEECH = "VON_directspeech";
63  const string ICON_RADIO_HINT = "VON_radio";
64  const string ICON_RADIO = "VON_frequency";
65  const string ICON_SERVER_DISABLE_HINT = "server-locked";
66 
67  const string LABEL_FREQUENCY_UNITS = "#AR-VON_FrequencyUnits_MHz";
68  const string LABEL_UNKNOWN_SOURCE = "#AR-VON_UnknownSource";
69  const string LABEL_CHANNEL_PLATOON = "#AR-VON_ChannelPlatoon-UC";
70  const string WIDGET_INCOMING = "VonIncoming";
71  const string WIDGET_TRANSMIT = "VonTransmitting";
72  const string WIDGET_OVERFLOW = "VonAdditional";
73  const string WIDGET_OVERFLOW_TEXT = "number";
74  const string WIDGET_SELECTED_ROOT = "VonSelected";
75  const string WIDGET_SELECTED_ICON = "Selected_Icon";
76  const string WIDGET_SELECTED_ICONGLOW = "Selected_IconGlow";
77  const string WIDGET_SELECTED_VON = "Selected_VONChannel";
78  const string WIDGET_SELECTED_TEXT = "Selected_Text";
79 
80  const ref Color COLOR_WHITE = Color.FromSRGBA(255, 255, 255, 255);
81 
82  protected int m_iTransmissionSlots = 4; // max amount of receiving transmissions
83  const float FADEOUT_TIMER_THRESHOLD = 1;
84  const float FADEIN_SPEED = 10;
85  const float FADEOUT_SPEED = 5;
86  const int SELECTED_HINT_FADE_SPEED = 3000; // ms
87  const int HEIGHT_DIVIDER = 35;
88 
89  protected bool m_bIsVONUIDisabled;
90  protected bool m_bIsVONDirectDisabled;
91  protected bool m_bIsDirectToggled; // direct speech toggle state
92  protected bool m_bIsChannelToggled; // channel toggle EFireState
93 
94  protected ref TransmissionData m_OutTransmission; // outgoing transmission data class
95  protected ref array<Widget> m_aWidgetsIncomingVON = {}; // available widgets for receiving transmission display
96  protected ref array<ref TransmissionData> m_aTransmissions = {}; // array of existing incoming transmission data classes
97  protected ref map<int, TransmissionData> m_aTransmissionMap = new map<int, TransmissionData>; // map for lookup when transmission is received
98  protected ref array<ref TransmissionData> m_aAdditionalSpeakers = {}; // array of additional speakers that cant be displayed
99 
101  protected SCR_VONController m_VONController;
104 
105  protected Widget m_wVerticalLayout;
106  protected Widget m_wSelectedHint;
107  protected ImageWidget m_wSelectedHintIcon;
108  protected ImageWidget m_wSelectedHintIconGlow;
109  protected TextWidget m_wSelectedVON;
110  protected TextWidget m_wSelectedText;
111  protected Widget m_wTalkingAmountWidget;
112  protected Widget m_wAdditionalSpeakersWidget;
113  protected RichTextWidget m_wAdditionalSpeakersText;
114 
115  //------------------------------------------------------------------------------------------------
118  {
119  return m_aTransmissions.Count();
120  }
121 
122  //------------------------------------------------------------------------------------------------
125  {
126  return m_OutTransmission != null && m_OutTransmission.m_bIsActive;
127  }
128 
129  //------------------------------------------------------------------------------------------------
131  event void OnCapture(BaseTransceiver transmitter)
132  {
133  if (!m_wRoot)
134  return;
135 
136  int frequency;
137 
138  if (transmitter) // can be null when using direct speech
139  frequency = transmitter.GetFrequency();
140 
141  // update only when first activation / device changed / frequency changed
142  if (m_OutTransmission.m_bForceUpdate == true
143  || m_OutTransmission.m_bIsActive == false
144  || m_OutTransmission.m_RadioTransceiver != transmitter
145  || (transmitter && m_OutTransmission.m_fFrequency != transmitter.GetFrequency())
146  )
147  {
148  UpdateTransmission(m_OutTransmission, transmitter, frequency, false);
149  }
150 
151  m_OutTransmission.m_bIsActive = true;
152  m_OutTransmission.m_fActiveTimeout = 0;
153  }
154 
155  protected Widget GetWidget()
156  {
157  Widget widget;
158  int iWidgetIdx = 0;
159 
160  while (iWidgetIdx < m_iTransmissionSlots)
161  {
162  widget = m_aWidgetsIncomingVON.Get(iWidgetIdx);
163  if (!widget.IsVisible())
164  return widget;
165 
166  iWidgetIdx++;
167  }
168 
169  return null;
170  }
171 
172  //------------------------------------------------------------------------------------------------
174  event void OnReceive(int playerId, BaseTransceiver receiver, int frequency, float quality)
175  {
176  if (!m_wRoot || m_bIsVONUIDisabled) // ignore receiving transmissions if VON UI is off
177  return;
178 
179  // Check if there is an active transmission from given player
180  TransmissionData pTransmission = m_aTransmissionMap.Get(playerId);
181 
182 
183  // Active transmission from the player not found, create it
184  if (!pTransmission)
185  {
186  if (!receiver && m_bIsVONDirectDisabled) // direct UI off
187  return;
188 
189  // No free widget
190  if (!GetWidget())
191  {
192  //Insert new widget to display other transmissions as number
193  pTransmission = new TransmissionData(m_wAdditionalSpeakersWidget, playerId);
194  m_aAdditionalSpeakers.Insert(pTransmission);
195  m_wAdditionalSpeakersText.SetText("+" + m_aAdditionalSpeakers.Count().ToString());
196  m_wAdditionalSpeakersWidget.SetVisible(true);
197  m_wAdditionalSpeakersWidget.SetOpacity(1);
198  pTransmission.m_bIsAdditional = true;
199  pTransmission.m_bVisible = true;
200  }
201  else
202  {
203  pTransmission = new TransmissionData(GetWidget(), playerId);
204  pTransmission.m_bIsAdditional = false;
205  }
206 
207  pTransmission.m_fQuality = quality;
208 
209  m_aTransmissions.Insert(pTransmission);
210  m_aTransmissionMap.Insert(playerId, pTransmission);
211  }
212 
213  // update only when first activation / device changed / frequency changed
214  if (pTransmission.m_bIsActive == false
215  || pTransmission.m_RadioTransceiver != receiver
216  || (receiver && pTransmission.m_fFrequency != frequency)
217  )
218  {
219  bool filtered = UpdateTransmission(pTransmission, receiver, frequency, true);
220  if (!filtered)
221  {
222  pTransmission.HideTransmission();
223  return;
224  }
225  }
226 
227  pTransmission.m_bIsActive = true;
228  pTransmission.m_fActiveTimeout = 0;
229  }
230 
231  //------------------------------------------------------------------------------------------------
238  protected bool UpdateTransmission(TransmissionData data, BaseTransceiver radioTransceiver, int frequency, bool IsReceiving)
239  {
240  data.m_RadioTransceiver = radioTransceiver;
241  data.m_bForceUpdate = false;
242 
243  if (!radioTransceiver && m_bIsVONDirectDisabled && IsReceiving) // can happen when existing RADIO transmission switches to direct
244  return false;
245 
246  // faction
247  Faction playerFaction;
248  int controlledID = GetGame().GetPlayerController().GetPlayerId();
249 
250  SCR_FactionManager factionMgr = SCR_FactionManager.Cast(GetGame().GetFactionManager());
251  if (controlledID && factionMgr)
252  {
253  playerFaction = factionMgr.SGetPlayerFaction(controlledID);
254  data.m_Faction = factionMgr.SGetPlayerFaction(data.m_iPlayerID);
255  }
256 
257  bool enemyTransmission;
258  if (IsReceiving && playerFaction && playerFaction.IsFactionEnemy(data.m_Faction)) // enemy transmission case
259  {
260  if (!radioTransceiver)
261  return false; // if direct ignore
262 
263  enemyTransmission = true;
264  }
265 
266  if (!data.m_wBaseWidget)
267  return false;
268 
269  if (data.m_bIsAdditional)
270  return true;
271 
272  string sDeviceIcon;
273  data.m_bIsAnimating = true; // start anim
274  data.m_wBaseWidget.SetVisible(true);
275  data.m_Widgets.m_wIcon.SetVisible(true);
276  data.m_Widgets.m_wMicFrame.SetVisible(false);
277  data.m_Widgets.m_wChannelFrame.SetVisible(false);
278  data.m_Widgets.m_wFrequency.SetVisible(false);
279  data.m_Widgets.m_wSeparator.SetVisible(false);
280 
281  // radio
282  if (radioTransceiver)
283  {
284  sDeviceIcon = ICON_RADIO;
285 
286  float adjustedFreq;
287  data.m_fFrequency = frequency;
288  adjustedFreq = Math.Round(data.m_fFrequency * 0.1) / 100;
289  data.m_Widgets.m_wFrequency.SetText(adjustedFreq.ToString() + " " + LABEL_FREQUENCY_UNITS);
290  data.m_Widgets.m_wFrequency.SetVisible(true);
291 
292  if (adjustedFreq == 0)
293  Print("SCR_VonDisplay: Incoming frequency 0 | base: " + frequency + " | adjusted: " + adjustedFreq, LogLevel.WARNING);
294  }
295  // direct speech
296  else
297  {
298  sDeviceIcon = ICON_DIRECT_SPEECH;
299  }
300 
301  if (sDeviceIcon != string.Empty)
302  {
303  data.m_Widgets.m_wIcon.LoadImageFromSet(0, m_sImageSet, sDeviceIcon);
304  data.m_Widgets.m_wIconBackground.LoadImageFromSet(0, m_sImageSetGlow, sDeviceIcon);
305  }
306 
307  // incoming
308  if (IsReceiving)
309  {
310  data.m_Widgets.m_wIcon.SetColor(COLOR_WHITE);
311 
312  if (!enemyTransmission)
313  {
314  data.m_Entity = GetGame().GetPlayerManager().GetPlayerControlledEntity(data.m_iPlayerID);
315  SCR_PossessingManagerComponent possMgr = SCR_PossessingManagerComponent.GetInstance();
316  if (data.m_Entity && possMgr && possMgr.IsPossessing(data.m_iPlayerID)) // if possessing, use name of the possessed character instead of player
317  {
318  SCR_CharacterIdentityComponent scrCharIdentity = SCR_CharacterIdentityComponent.Cast(data.m_Entity.FindComponent(SCR_CharacterIdentityComponent));
319  if (scrCharIdentity)
320  {
321  string name;
322  array<string> nameParams = {};
323  scrCharIdentity.GetFormattedFullName(name, nameParams);
324  data.m_Widgets.m_wName.SetTextFormat(name, nameParams[0], nameParams[1], nameParams[2])
325  }
326  else // char might not be using scripted identity component
327  {
328  CharacterIdentityComponent charIdentity = CharacterIdentityComponent.Cast(data.m_Entity.FindComponent(CharacterIdentityComponent));
329  if (charIdentity && charIdentity.GetIdentity())
330  data.m_Widgets.m_wName.SetText(charIdentity.GetIdentity().GetName());
331  else
332  data.m_Widgets.m_wName.SetText(m_PlayerManager.GetPlayerName(data.m_iPlayerID));
333  }
334  }
335  else
336  data.m_Widgets.m_wName.SetText(m_PlayerManager.GetPlayerName(data.m_iPlayerID));
337  }
338  else
339  data.m_Widgets.m_wName.SetText(LABEL_UNKNOWN_SOURCE);
340 
341  data.m_Widgets.m_wName.SetVisible(true);
342 
343  if (radioTransceiver)
344  data.m_Widgets.m_wSeparator.SetVisible(false);
345  }
346  else // outgoing
347  {
348  data.m_Widgets.m_wIcon.SetColor(Color.FromInt(GUIColors.ORANGE.PackToInt()));
349  data.m_Widgets.m_wName.SetText(string.Empty);
350  data.m_Widgets.m_wName.SetVisible(false);
351 
352  if (radioTransceiver) // direct vs radio
353  {
354  data.m_Widgets.m_wMicFrame.SetVisible(m_bIsChannelToggled);
355 
356  if (SCR_Faction.Cast(playerFaction)) // show platoon
357  {
358  int factionHQFrequency = SCR_Faction.Cast(playerFaction).GetFactionRadioFrequency();
359  if (factionHQFrequency == frequency)
360  {
361  data.m_Widgets.m_wChannelText.SetText(LABEL_CHANNEL_PLATOON);
362  data.m_Widgets.m_wChannelFrame.SetVisible(true);
363  }
364  }
365 
366  }
367  else
368  {
369  data.m_Widgets.m_wMicFrame.SetVisible(m_bIsDirectToggled);
370  }
371  }
372 
373  return true;
374  }
375 
376  //------------------------------------------------------------------------------------------------
380  protected void OpacityFade(TransmissionData data, float timeSlice, bool isAdditional = false)
381  {
382  if (!data.m_wBaseWidget)
383  return;
384 
385  if (data.m_bIsActive)
386  {
387  data.m_wBaseWidget.SetVisible(true);
388  data.m_bVisible = true;
389 
390  data.m_fAlpha = Math.Lerp(data.m_fAlpha, 1, FADEIN_SPEED * timeSlice);
391  if (data.m_fAlpha > 0.99)
392  {
393  data.m_fAlpha = 1;
394  data.m_bIsAnimating = false;
395  }
396  }
397  else
398  {
399  data.m_fAlpha = Math.Lerp(data.m_fAlpha, 0, FADEOUT_SPEED * timeSlice);
400  if (data.m_fAlpha < 0.01)
401  {
402  if (isAdditional)
403  {
404  data.m_fAlpha = 0;
405  data.m_bIsActive = false;
406  data.m_bIsAnimating = false;
407  data.m_fActiveTimeout = 0;
408  data.m_bVisible = false;
409  }
410  else
411  {
412  data.HideTransmission();
413  }
414 
415  }
416  }
417 
418  if (!isAdditional)
419  data.m_wBaseWidget.SetOpacity(data.m_fAlpha);
420  }
421 
422  //------------------------------------------------------------------------------------------------
425  {
426  if (entry.GetVONMethod() == ECommMethod.DIRECT)
427  {
428  m_wSelectedVON.SetText("#AR-VON_DirectTalk");
429  SetHintIcon(false);
430  }
431  else
432  {
433  SCR_VONEntryRadio radioEntry = SCR_VONEntryRadio.Cast(entry);
434  if (!radioEntry || !m_wSelectedHint || !radioEntry.GetUIInfo())
435  return;
436 
437  string formatText = "#AR-VON_ChannelHint";
438  m_wSelectedVON.SetTextFormat(formatText, radioEntry.GetUIInfo().GetName(), radioEntry.GetTransceiverNumber(), radioEntry.GetDisplayText());
439 
440  SetHintIcon(true);
441  }
442 
443  m_wSelectedText.SetVisible(true);
444 
445  m_wSelectedHint.SetOpacity(1);
446  GetGame().GetCallqueue().Remove(FadeSelectedVONHint); // in case of multiple selections
447  GetGame().GetCallqueue().CallLater(FadeSelectedVONHint, SELECTED_HINT_FADE_SPEED); // start fading after a certain display time
448 
449  }
450 
451  //------------------------------------------------------------------------------------------------
454  void ShowSelectedVONDisabledHint(bool isServerDisabled = false)
455  {
456  if (isServerDisabled)
457  {
460  }
461  else
462  {
463  m_wSelectedHintIcon.LoadImageFromSet(0, m_sImageSet, ICON_RADIO_HINT);
465  }
466 
467  m_wSelectedHintIcon.SetColor(Color.FromInt(GUIColors.RED.PackToInt()));
468 
469  m_wSelectedVON.SetText("");
470  m_wSelectedText.SetVisible(false);
471 
472  m_wSelectedHint.SetOpacity(1);
473  GetGame().GetCallqueue().Remove(FadeSelectedVONHint); // in case of multiple selections
474  GetGame().GetCallqueue().CallLater(FadeSelectedVONHint, SELECTED_HINT_FADE_SPEED); // start fading after a certain display time
475  }
476 
477  //------------------------------------------------------------------------------------------------
478  protected void FadeSelectedVONHint()
479  {
480  AnimateWidget.Opacity(m_wSelectedHint, 0, 4);
481  }
482 
483  //------------------------------------------------------------------------------------------------
485  protected void SetHintIcon(bool isRadio)
486  {
487  if (isRadio)
488  {
489  m_wSelectedHintIcon.LoadImageFromSet(0, m_sImageSet, ICON_RADIO_HINT);
491  }
492  else
493  {
494  m_wSelectedHintIcon.LoadImageFromSet(0, m_sImageSet, ICON_DIRECT_SPEECH);
496  }
497 
498  m_wSelectedHintIcon.SetColor(Color.FromInt(GUIColors.ORANGE.PackToInt()));
499  }
500 
501  //------------------------------------------------------------------------------------------------
503  protected void OnVONActiveToggled(bool directState, bool channelState)
504  {
505  m_bIsDirectToggled = directState;
506  m_bIsChannelToggled = channelState;
507 
508  if (m_OutTransmission)
509  {
510  m_OutTransmission.m_bForceUpdate = true;
511  OnCapture(m_OutTransmission.m_RadioTransceiver);
512  }
513  }
514 
515  //------------------------------------------------------------------------------------------------
517  protected void OnDestroyed(Instigator killer, IEntity killerEntity)
518  {
519  if (m_OutTransmission)
520  m_OutTransmission.HideTransmission();
521 
522  int count = m_aTransmissions.Count();
523  for (int i = 0; i < count; i++)
524  {
525  m_aTransmissions[i].HideTransmission();
526  }
527  }
528 
529  //------------------------------------------------------------------------------------------------
531  protected void InitDisplay()
532  {
533  m_bIsVONUIDisabled = GetGame().IsVONUIDisabledByServer();
534  m_bIsVONDirectDisabled = GetGame().IsVONDirectSpeechUIDisabledByServer();
535 
536  m_PlayerController.m_OnDestroyed.Insert(OnDestroyed);
537 
538  m_VONController = SCR_VONController.Cast(m_PlayerController.FindComponent(SCR_VONController));
539  m_VONController.GetOnVONActiveToggledInvoker().Insert(OnVONActiveToggled);
540  m_VONController.SetDisplay(this); // we set this from here instead of the other way around to avoid load order issues
541 
543 
544  m_wVerticalLayout = m_wRoot.FindAnyWidget(WIDGET_INCOMING);
546  m_wAdditionalSpeakersText = RichTextWidget.Cast(m_wRoot.FindAnyWidget(WIDGET_OVERFLOW_TEXT));
547 
549  m_wSelectedHintIcon = ImageWidget.Cast(m_wSelectedHint.FindAnyWidget(WIDGET_SELECTED_ICON));
550  m_wSelectedHintIconGlow = ImageWidget.Cast(m_wSelectedHint.FindAnyWidget(WIDGET_SELECTED_ICONGLOW));
551  m_wSelectedVON = TextWidget.Cast(m_wRoot.FindAnyWidget(WIDGET_SELECTED_VON));
552  m_wSelectedText = TextWidget.Cast(m_wRoot.FindAnyWidget(WIDGET_SELECTED_TEXT));
553 
555  if (!m_SlotHandler)
556  return;
557 
558  m_HUDSlotComponent = m_SlotHandler.GetSlotUIComponent();
559  if (!m_HUDSlotComponent)
560  return;
561 
562  m_HUDSlotComponent.GetOnResize().Insert(OnSlotUIResize);
563  }
564 
565  //------------------------------------------------------------------------------------------------
566  protected void OnSlotUIResize()
567  {
568  // Assign it again in case the SlotUIComponent has changed
569  m_HUDSlotComponent = m_SlotHandler.GetSlotUIComponent();
570  if (!m_HUDSlotComponent)
571  return;
572 
573  int height = m_HUDSlotComponent.GetHeight();
574  m_iTransmissionSlots = ((int)height / HEIGHT_DIVIDER) - 1;
575  if (m_iTransmissionSlots <= 0)
577 
578  UpdateWidgets();
579  }
580 
581  //------------------------------------------------------------------------------------------------
582  protected void UpdateWidgets()
583  {
584  int count = m_aWidgetsIncomingVON.Count();
585 
586  if (count == m_iTransmissionSlots)
587  return;
588 
589  if (count > m_iTransmissionSlots)
590  {
591  for (int i = count - 1; i > m_iTransmissionSlots; i--)
592  {
593  Widget w = m_aWidgetsIncomingVON.Get(i);
594  if (w)
595  {
596  w.RemoveFromHierarchy();
597  m_aWidgetsIncomingVON.RemoveItem(w);
598  }
599  }
600  }
601  else
602  {
603  for (int i = count; i < m_iTransmissionSlots; i++)
604  {
605  Widget w = GetGame().GetWorkspace().CreateWidgets(m_sReceivingTransmissionLayout, m_wVerticalLayout);
606  if (w)
607  {
608  w.SetVisible(false);
609  m_aWidgetsIncomingVON.Insert(w);
610  }
611  }
612  }
613  }
614 
615  //------------------------------------------------------------------------------------------------
616  // Overrides
617  //------------------------------------------------------------------------------------------------
618  override void DisplayUpdate(IEntity owner, float timeSlice)
619  {
620  //Check if the SlotUIComponent is still valid otherwise change to the new one
621  if (m_HUDSlotComponent != m_SlotHandler.GetSlotUIComponent())
622  {
623  if (m_HUDSlotComponent)
624  m_HUDSlotComponent.GetOnResize().Remove(OnSlotUIResize);
625 
626  m_HUDSlotComponent = m_SlotHandler.GetSlotUIComponent();
627  if (!m_HUDSlotComponent)
628  return;
629 
630  m_HUDSlotComponent.GetOnResize().Insert(OnSlotUIResize);
631  }
632 
633  // update visibility timer
634  if (m_OutTransmission.m_bIsActive)
635  {
636  m_OutTransmission.m_fActiveTimeout += timeSlice;
637 
638  if (m_OutTransmission.m_fActiveTimeout > FADEOUT_TIMER_THRESHOLD)
639  {
640  m_OutTransmission.m_bIsActive = false;
641  m_OutTransmission.m_bIsAnimating = true;
642  }
643  }
644 
645  // update fade
646  if (m_OutTransmission.m_bIsAnimating)
647  OpacityFade(m_OutTransmission, timeSlice);
648 
649  // update incoming transmissions
650  if (m_aTransmissions.IsEmpty())
651  return;
652 
653  TransmissionData pTransmission;
654  int count = m_aTransmissions.Count() - 1;
655 
656  for (int i = count; i >= 0; i--)
657  {
658  if (i > m_aTransmissions.Count() - 1)
659  {
660  count -1;
661  continue;
662  }
663 
664  pTransmission = m_aTransmissions[i];
665 
666  bool isAdditional = m_aAdditionalSpeakers.Contains(pTransmission);
667 
668  // update visibility timer
669  if (pTransmission.m_bIsActive)
670  {
671  pTransmission.m_fActiveTimeout += timeSlice;
672 
673  if (pTransmission.m_fActiveTimeout > FADEOUT_TIMER_THRESHOLD)
674  {
675  pTransmission.m_bIsActive = false;
676  pTransmission.m_bIsAnimating = true;
677  }
678  }
679 
680  // update fade
681  if (pTransmission.m_bIsAnimating)
682  OpacityFade(pTransmission, timeSlice, isAdditional);
683 
684  // remove faded transmissions
685  if (!pTransmission.m_bVisible)
686  {
687  if (pTransmission.m_iPlayerID)
688  m_aTransmissionMap.Remove(pTransmission.m_iPlayerID);
689 
690  m_aTransmissions.Remove(i);
691 
692  if (isAdditional)
693  {
694  m_aAdditionalSpeakers.Remove(m_aAdditionalSpeakers.Find(pTransmission));
695  m_wAdditionalSpeakersText.SetText("+" + m_aAdditionalSpeakers.Count().ToString());
696 
697  if (m_aAdditionalSpeakers.IsEmpty())
698  m_wAdditionalSpeakersWidget.SetVisible(false);
699  }
700 
701  if (m_aAdditionalSpeakers.Count() > 0 && (m_aTransmissions.Count() - m_aAdditionalSpeakers.Count()) < m_aWidgetsIncomingVON.Count())
702  {
703  m_aAdditionalSpeakers[0].m_bIsActive = false;
706 
708 
709  m_aAdditionalSpeakers.Remove(0);
710  m_wAdditionalSpeakersText.SetText("+" + m_aAdditionalSpeakers.Count().ToString());
711 
712  if (m_aAdditionalSpeakers.Count() == 0)
713  m_wAdditionalSpeakersWidget.SetVisible(false);
714  }
715 
716  count - 1;
717  }
718  }
719  }
720 
721  //------------------------------------------------------------------------------------------------
722  override bool DisplayStartDrawInit(IEntity owner)
723  {
724  m_PlayerManager = GetGame().GetPlayerManager();
725 
726  return m_PlayerManager != null;
727  }
728 
729  //------------------------------------------------------------------------------------------------
730  override void DisplayStartDraw(IEntity owner)
731  {
732  if (!m_wRoot)
733  return;
734 
735  InitDisplay();
736  }
737 
738  //------------------------------------------------------------------------------------------------
739  override void DisplayControlledEntityChanged(IEntity from, IEntity to)
740  {
741  if (m_OutTransmission)
742  m_OutTransmission.HideTransmission();
743 
744  int count = m_aTransmissions.Count();
745  for (int i = 0; i < count; i++)
746  {
747  m_aTransmissions[i].HideTransmission();
748  }
749  }
750 
751  //------------------------------------------------------------------------------------------------
752  override void DisplayStopDraw(IEntity owner)
753  {
754  if (m_PlayerController)
755  m_PlayerController.m_OnDestroyed.Remove(OnDestroyed);
756 
757  if (m_VONController)
758  m_VONController.GetOnVONActiveToggledInvoker().Remove(OnVONActiveToggled);
759  }
760 }
SELECTED_HINT_FADE_SPEED
const int SELECTED_HINT_FADE_SPEED
Definition: SCR_VonDisplay.c:86
OnDestroyed
protected void OnDestroyed(Instigator killer, IEntity killerEntity)
SCR_PlayerController Event.
Definition: SCR_VonDisplay.c:517
GetHandler
SCR_InfoDisplayHandler GetHandler(typename handlerType)
Definition: SCR_InfoDisplay.c:80
TransmissionData
void TransmissionData(Widget base, int iPlayerID)
Definition: SCR_VonDisplay.c:34
FadeSelectedVONHint
protected void FadeSelectedVONHint()
Definition: SCR_VonDisplay.c:478
m_aTransmissionMap
protected ref map< int, TransmissionData > m_aTransmissionMap
Definition: SCR_VonDisplay.c:97
m_wSelectedVON
protected TextWidget m_wSelectedVON
Definition: SCR_VonDisplay.c:109
m_sImageSet
protected string m_sImageSet
Definition: SCR_VonDisplay.c:54
LABEL_CHANNEL_PLATOON
const string LABEL_CHANNEL_PLATOON
Definition: SCR_VonDisplay.c:69
m_wAdditionalSpeakersText
protected RichTextWidget m_wAdditionalSpeakersText
Definition: SCR_VonDisplay.c:113
OpacityFade
protected void OpacityFade(TransmissionData data, float timeSlice, bool isAdditional=false)
Definition: SCR_VonDisplay.c:380
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
m_sReceivingTransmissionLayout
protected string m_sReceivingTransmissionLayout
Definition: SCR_VonDisplay.c:59
WIDGET_INCOMING
const string WIDGET_INCOMING
Definition: SCR_VonDisplay.c:70
UpdateWidgets
protected void UpdateWidgets()
Definition: SCR_VonDisplay.c:582
m_aWidgetsIncomingVON
protected ref array< Widget > m_aWidgetsIncomingVON
Definition: SCR_VonDisplay.c:95
COLOR_WHITE
const ref Color COLOR_WHITE
Definition: SCR_VonDisplay.c:80
m_wAdditionalSpeakersWidget
protected Widget m_wAdditionalSpeakersWidget
Definition: SCR_VonDisplay.c:112
Attribute
class TransmissionData Attribute("{2EFEA2AF1F38E7F0}UI/Textures/Icons/icons_wrapperUI-64.m_sImageSet")]
VON display of active outgoing and incoming transmissions.
WIDGET_SELECTED_VON
const string WIDGET_SELECTED_VON
Definition: SCR_VonDisplay.c:77
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_VoNOverlay_ElementWidgets
Definition: SCR_VoNOverlay_ElementWidgets.c:4
LABEL_FREQUENCY_UNITS
const string LABEL_FREQUENCY_UNITS
Definition: SCR_VonDisplay.c:67
HEIGHT_DIVIDER
const int HEIGHT_DIVIDER
Definition: SCR_VonDisplay.c:87
IsCapturingTransmisionActive
bool IsCapturingTransmisionActive()
Whether outgoing transmission is currently active.
Definition: SCR_VonDisplay.c:124
m_wSelectedText
protected TextWidget m_wSelectedText
Definition: SCR_VonDisplay.c:110
m_bIsChannelToggled
protected bool m_bIsChannelToggled
Definition: SCR_VonDisplay.c:92
m_iPlayerID
int m_iPlayerID
Definition: SCR_VonDisplay.c:11
SCR_VONEntryRadio
VONEntry class for radio entries.
Definition: SCR_VONEntryRadio.c:3
func
func
Definition: SCR_AIThreatSystem.c:5
m_wVerticalLayout
protected Widget m_wVerticalLayout
Definition: SCR_VonDisplay.c:105
m_VONController
protected SCR_VONController m_VONController
Definition: SCR_VonDisplay.c:101
LABEL_UNKNOWN_SOURCE
const string LABEL_UNKNOWN_SOURCE
Definition: SCR_VonDisplay.c:68
m_Widgets
ref SCR_VoNOverlay_ElementWidgets m_Widgets
Definition: SCR_VonDisplay.c:3
DisplayUpdate
override void DisplayUpdate(IEntity owner, float timeSlice)
Definition: SCR_VonDisplay.c:618
Instigator
Definition: Instigator.c:6
WIDGET_OVERFLOW_TEXT
const string WIDGET_OVERFLOW_TEXT
Definition: SCR_VonDisplay.c:73
m_wTalkingAmountWidget
protected Widget m_wTalkingAmountWidget
Definition: SCR_VonDisplay.c:111
ICON_RADIO
const string ICON_RADIO
Definition: SCR_VonDisplay.c:64
m_fAlpha
float m_fAlpha
Definition: SCR_VonDisplay.c:12
m_iTransmissionSlots
protected int m_iTransmissionSlots
Definition: SCR_VonDisplay.c:82
ICON_SERVER_DISABLE_HINT
const string ICON_SERVER_DISABLE_HINT
Definition: SCR_VonDisplay.c:65
OnVONActiveToggled
protected void OnVONActiveToggled(bool directState, bool channelState)
SCR_VONController event -> Toggle microphone indication.
Definition: SCR_VonDisplay.c:503
WIDGET_SELECTED_ROOT
const string WIDGET_SELECTED_ROOT
Definition: SCR_VonDisplay.c:74
ICON_RADIO_HINT
const string ICON_RADIO_HINT
Definition: SCR_VonDisplay.c:63
GetActiveTransmissionsCount
int GetActiveTransmissionsCount()
Count of active incoming transmissions.
Definition: SCR_VonDisplay.c:117
m_sImageSetGlow
protected string m_sImageSetGlow
Definition: SCR_VonDisplay.c:56
TransmissionData
Data class for transmissions.
Definition: SCR_VonDisplay.c:3
m_fQuality
float m_fQuality
Definition: SCR_VonDisplay.c:15
m_aAdditionalSpeakers
protected ref array< ref TransmissionData > m_aAdditionalSpeakers
Definition: SCR_VonDisplay.c:98
DisplayStopDraw
override void DisplayStopDraw(IEntity owner)
Definition: SCR_VonDisplay.c:752
m_wSelectedHintIcon
protected ImageWidget m_wSelectedHintIcon
Definition: SCR_VonDisplay.c:107
SCR_InfoDisplaySlotHandler
Definition: SCR_InfoDisplaySlotHandler.c:2
OnReceive
event void OnReceive(int playerId, BaseTransceiver receiver, int frequency, float quality)
VONComponent event.
Definition: SCR_VonDisplay.c:174
m_bIsVONDirectDisabled
protected bool m_bIsVONDirectDisabled
Definition: SCR_VonDisplay.c:90
m_bIsDirectToggled
protected bool m_bIsDirectToggled
Definition: SCR_VonDisplay.c:91
m_bIsVONUIDisabled
protected bool m_bIsVONUIDisabled
Definition: SCR_VonDisplay.c:89
SetHintIcon
protected void SetHintIcon(bool isRadio)
Set VON info hint icon type.
Definition: SCR_VonDisplay.c:485
BaseTransceiver
Definition: BaseTransceiver.c:12
m_wSelectedHintIconGlow
protected ImageWidget m_wSelectedHintIconGlow
Definition: SCR_VonDisplay.c:108
ICON_DIRECT_SPEECH
const string ICON_DIRECT_SPEECH
Definition: SCR_VonDisplay.c:62
DisplayControlledEntityChanged
override void DisplayControlledEntityChanged(IEntity from, IEntity to)
Definition: SCR_VonDisplay.c:739
m_fFrequency
float m_fFrequency
Definition: SCR_VonDisplay.c:14
WIDGET_OVERFLOW
const string WIDGET_OVERFLOW
Definition: SCR_VonDisplay.c:72
OnCapture
event void OnCapture(BaseTransceiver transmitter)
VONComponent event.
Definition: SCR_VonDisplay.c:131
m_PlayerManager
protected PlayerManager m_PlayerManager
Definition: SCR_VonDisplay.c:100
Faction
Definition: Faction.c:12
m_wBaseWidget
Widget m_wBaseWidget
Definition: SCR_VonDisplay.c:4
FADEOUT_TIMER_THRESHOLD
const float FADEOUT_TIMER_THRESHOLD
Definition: SCR_VonDisplay.c:83
m_bIsAnimating
bool m_bIsAnimating
Definition: SCR_VonDisplay.c:9
WIDGET_SELECTED_TEXT
const string WIDGET_SELECTED_TEXT
Definition: SCR_VonDisplay.c:78
m_PlayerController
SCR_CampaignNetworkComponentClass m_PlayerController
Takes care of Campaign-specific server <> client communication and requests.
m_fActiveTimeout
float m_fActiveTimeout
Definition: SCR_VonDisplay.c:13
OnSlotUIResize
protected void OnSlotUIResize()
Definition: SCR_VonDisplay.c:566
FADEOUT_SPEED
const float FADEOUT_SPEED
Definition: SCR_VonDisplay.c:85
DisplayStartDrawInit
override bool DisplayStartDrawInit(IEntity owner)
Definition: SCR_VonDisplay.c:722
ShowSelectedVONHint
void ShowSelectedVONHint(SCR_VONEntry entry)
Show hint displaying which VON method was selected.
Definition: SCR_VonDisplay.c:424
m_iPlayerID
SCR_EditorManagerCore m_iPlayerID
InitDisplay
protected void InitDisplay()
Initialize.
Definition: SCR_VonDisplay.c:531
UpdateTransmission
protected bool UpdateTransmission(TransmissionData data, BaseTransceiver radioTransceiver, int frequency, bool IsReceiving)
Definition: SCR_VonDisplay.c:238
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition: SCR_FactionManager.c:461
WIDGET_TRANSMIT
const string WIDGET_TRANSMIT
Definition: SCR_VonDisplay.c:71
WIDGET_SELECTED_ICONGLOW
const string WIDGET_SELECTED_ICONGLOW
Definition: SCR_VonDisplay.c:76
m_OutTransmission
protected ref TransmissionData m_OutTransmission
Definition: SCR_VonDisplay.c:94
m_bIsActive
SCR_HintSequenceComponentClass m_bIsActive
m_HUDSlotComponent
protected SCR_HUDSlotUIComponent m_HUDSlotComponent
Definition: SCR_VonDisplay.c:103
DisplayStartDraw
override void DisplayStartDraw(IEntity owner)
Definition: SCR_VonDisplay.c:730
m_bVisible
protected bool m_bVisible
Definition: SCR_UITaskManagerComponent.c:28
ECommMethod
ECommMethod
Definition: ECommMethod.c:7
m_SlotHandler
protected SCR_InfoDisplaySlotHandler m_SlotHandler
Definition: SCR_VonDisplay.c:102
SCR_VONEntry
Voice over network entry data class, used for management of communication methods.
Definition: SCR_VONEntry.c:3
PlayerManager
Definition: PlayerManager.c:12
int
SCR_PossessingManagerComponentClass int
SCR_Faction
Definition: SCR_Faction.c:6
FADEIN_SPEED
const float FADEIN_SPEED
Definition: SCR_VonDisplay.c:84
m_wSelectedHint
protected Widget m_wSelectedHint
Definition: SCR_VonDisplay.c:106
WIDGET_SELECTED_ICON
const string WIDGET_SELECTED_ICON
Definition: SCR_VonDisplay.c:75
GetWidget
protected Widget GetWidget()
Definition: SCR_VonDisplay.c:155
ShowSelectedVONDisabledHint
void ShowSelectedVONDisabledHint(bool isServerDisabled=false)
Definition: SCR_VonDisplay.c:454
SCR_HUDSlotUIComponent
Definition: SCR_HUDSlotUIComponent.c:5
m_aTransmissions
protected ref array< ref TransmissionData > m_aTransmissions
Definition: SCR_VonDisplay.c:96
m_RadioTransceiver
BaseTransceiver m_RadioTransceiver
Definition: SCR_VonDisplay.c:18