Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MapUIBaseComponent.c
Go to the documentation of this file.
1 // Base for 2D map UI components
3 class SCR_MapUIBaseComponent : ScriptedWidgetComponent
4 {
5  [Attribute("0", UIWidgets.Auto, "Disable this component, useful for example when we want to inherit config without a specific component" )]
6  protected bool m_bDisableComponent;
7 
8  protected bool m_bHookToRoot = false; // determine whether this component is hooked to the root widget for use of ScriptedWidgetEventHandler events
9  protected Widget m_RootWidget; // map layout root widget
10  protected SCR_MapEntity m_MapEntity;
11 
12  //------------------------------------------------------------------------------------------------
13  // BASE METHODS
14  //------------------------------------------------------------------------------------------------
15 
16  //------------------------------------------------------------------------------------------------
19  protected void OnMapOpen(MapConfiguration config)
20  {
21  if (m_bHookToRoot)
22  m_RootWidget.AddHandler(this);
23  }
24 
25  //------------------------------------------------------------------------------------------------
28  protected void OnMapClose(MapConfiguration config)
29  {
30  if (m_bHookToRoot)
31  m_RootWidget.RemoveHandler(this);
32  }
33 
34  //------------------------------------------------------------------------------------------------
36  bool IsConfigDisabled()
37  {
38  return m_bDisableComponent;
39  }
40 
41  //------------------------------------------------------------------------------------------------
45  void SetActive(bool active, bool isCleanup = false)
46  {
47  if (active)
48  {
49  m_RootWidget = m_MapEntity.GetMapConfig().RootWidgetRef; // Needs to be refreshed here
50 
51  m_MapEntity.GetOnMapOpen().Insert(OnMapOpen);
52  m_MapEntity.GetOnMapClose().Insert(OnMapClose);
53  }
54  else
55  {
56  m_MapEntity.GetOnMapOpen().Remove(OnMapOpen);
57  m_MapEntity.GetOnMapClose().Remove(OnMapClose);
58 
59  if (!isCleanup)
60  m_MapEntity.DeactivateComponent(this);
61  }
62  }
63 
64  //------------------------------------------------------------------------------------------------
66  void Init();
67 
68  //------------------------------------------------------------------------------------------------
70  void Update(float timeSlice);
71 
72  //------------------------------------------------------------------------------------------------
73  // constructor
75  {
76  m_MapEntity = SCR_MapEntity.GetMapInstance();
77  }
78 }
m_MapEntity
protected SCR_MapEntity m_MapEntity
Definition: SCR_MapGadgetComponent.c:14
m_RootWidget
protected Widget m_RootWidget
Definition: SCR_BinocularsComponent.c:10
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_MapEntity
Map entity.
Definition: SCR_MapEntity.c:20
SCR_MapUIBaseComponent
Definition: SCR_MapUIBaseComponent.c:3
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