Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_NotificationsLogDisplay.c
Go to the documentation of this file.
1 /*
2 Handles the SCR_NotificationsLogComponent when Player is initialized.
3 */
4 class SCR_NotificationsLogDisplay : SCR_InfoDisplayExtended
5 {
6  [Attribute(desc: "Should the Notifications go from top to bottom instead of bottom to top?")]
7  protected bool m_bInsertFromTop;
8 
9  protected SCR_NotificationsLogComponent m_NotificationsHud;
10  protected SCR_InfoDisplaySlotHandler m_slotHandler;
11  protected SCR_HUDSlotUIComponent m_HUDSlotComponent;
12  /*
13  Sets the height of 1 notification to the available spac in the slot can be set correctly.
14  !CANNOT BE 0!
15  */
16  protected const int HEIGHT_DIVIDER = 50;
17 
18  //------------------------------------------------------------------------------------------------
19  override void DisplayStartDraw(IEntity owner)
20  {
21  if (!m_wRoot)
22  return;
23 
24  m_NotificationsHud = SCR_NotificationsLogComponent.Cast(m_wRoot.FindHandler(SCR_NotificationsLogComponent));
25 
27  if (!m_slotHandler)
28  return;
29 
30  m_HUDSlotComponent = m_slotHandler.GetSlotUIComponent();
31  if (!m_HUDSlotComponent)
32  return;
33 
34  m_HUDSlotComponent.GetOnResize().Insert(OnSlotUIResize);
35  }
36 
37  //------------------------------------------------------------------------------------------------
38  override void DisplayStopDraw(IEntity owner)
39  {
40  // Assign it again in case the SlotUIComponent has changed
41  m_HUDSlotComponent = m_slotHandler.GetSlotUIComponent();
42  if (!m_HUDSlotComponent)
43  return;
44 
45  m_HUDSlotComponent.GetOnResize().Remove(OnSlotUIResize);
46  }
47 
48  //------------------------------------------------------------------------------------------------
49  override void DisplayUpdate(IEntity owner, float timeSlice)
50  {
51  if (m_HUDSlotComponent != m_slotHandler.GetSlotUIComponent())
52  {
54  m_HUDSlotComponent.GetOnResize().Remove(OnSlotUIResize);
55 
56  m_HUDSlotComponent = m_slotHandler.GetSlotUIComponent();
57  if (!m_HUDSlotComponent)
58  return;
59 
60  m_HUDSlotComponent.GetOnResize().Insert(OnSlotUIResize);
61  }
62  }
63 
64  //------------------------------------------------------------------------------------------------
66  void OnSlotUIResize()
67  {
68  // Assign it again in case the SlotUIComponent has changed
69  m_HUDSlotComponent = m_slotHandler.GetSlotUIComponent();
70  if (!m_HUDSlotComponent)
71  return;
72 
73  int maxNotifications = (int)m_HUDSlotComponent.GetHeight() / HEIGHT_DIVIDER;
74  if (maxNotifications < 1)
75  maxNotifications = 1;
76 
77  m_NotificationsHud.OnSlotResize(maxNotifications);
78  m_NotificationsHud.ChangeInsertOrder(m_bInsertFromTop);
79  }
80 }
GetHandler
SCR_InfoDisplayHandler GetHandler(typename handlerType)
Definition: SCR_InfoDisplay.c:80
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
HEIGHT_DIVIDER
const int HEIGHT_DIVIDER
Definition: SCR_VonDisplay.c:87
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_NotificationsLogComponent
Definition: SCR_NotificationsLogUIComponent.c:6
SCR_NotificationsLogDisplay
Definition: SCR_NotificationsLogDisplay.c:4
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_InfoDisplaySlotHandler
Definition: SCR_InfoDisplaySlotHandler.c:2
m_HUDSlotComponent
protected SCR_HUDSlotUIComponent m_HUDSlotComponent
Definition: SCR_VonDisplay.c:103
int
SCR_PossessingManagerComponentClass int
SCR_HUDSlotUIComponent
Definition: SCR_HUDSlotUIComponent.c:5