Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_InfoDisplayLayerHandler.c
Go to the documentation of this file.
3 {
4  [Attribute()]
5  protected string m_sLayerName;
6 
7  //------------------------------------------------------------------------------------------------
8  protected override void OnStart(notnull SCR_InfoDisplay display)
9  {
10  if (display.GetHandler(SCR_InfoDisplaySlotHandler) != null)
11  {
12  Print("Info Display cant have SCR_InfoDisplayLayerHandler & SCR_InfoDisplaySlotHandler co-exist as handlers!", LogLevel.ERROR);
13  return;
14  }
15 
16  WorkspaceWidget workspace = GetGame().GetWorkspace();
17 
18  SCR_HUDManagerComponent hudManager = SCR_HUDManagerComponent.GetHUDManager();
19  if (!hudManager)
20  {
21  Print("No HUD Manager for Layer Slot: " + m_sLayerName, LogLevel.ERROR);
22  return;
23  }
24 
25  SCR_HUDManagerLayoutHandler layoutHandler = SCR_HUDManagerLayoutHandler.Cast(hudManager.FindHandler(SCR_HUDManagerLayoutHandler));
26  if (!layoutHandler)
27  {
28  Print("Cant find SCR_HUDManagerLayoutHandler for Layer Slot: " + m_sLayerName, LogLevel.ERROR);
29  return;
30  }
31 
32  SCR_HUDLayout owningLayout;
33  Widget layerSlotWidget = layoutHandler.FindWidgetByNameFromAnyLayout(m_sLayerName, owningLayout);
34  if (!layerSlotWidget)
35  {
36  Print("No Slot Widget for Layer Slot: " + m_sLayerName, LogLevel.ERROR);
37  return;
38  }
39 
40  Widget rootWidget = workspace.CreateWidgets(display.m_LayoutPath, layerSlotWidget);
41  if (!rootWidget)
42  {
43  Print("Can't initialize Info Display on provided Slot Widget: " + m_sLayerName, LogLevel.ERROR);
44  return;
45  }
46 
47  display.SetRootWidget(rootWidget);
48  display.SetContentWidget(rootWidget);
49 
50  SCR_HUDElement hudElement = new SCR_HUDElement();
51  hudElement.SetWidget(rootWidget);
52  hudElement.SetParentWidgetName(m_sLayerName);
53  hudElement.SetParentLayout(owningLayout);
54  owningLayout.AddHudElement(hudElement, false);
55  display.RegisterToHudManager();
56  }
57 }
SCR_HUDManagerComponent
Definition: SCR_HUDManagerComponent.c:23
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_HUDLayout
Definition: SCR_HUDLayout.c:2
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_InfoDisplaySlotHandler
Definition: SCR_InfoDisplaySlotHandler.c:2
SCR_HUDManagerLayoutHandler
Definition: SCR_HUDManagerLayoutHandler.c:7
SCR_InfoDisplayHandler
Definition: SCR_InfoDisplayHandler.c:2
SCR_InfoDisplayLayerHandler
Definition: SCR_InfoDisplayLayerHandler.c:2
SCR_HUDElement
Definition: SCR_HUDFreeSlot.c:1
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468