Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_NTElementBase.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
3 class SCR_NameTagElementTitle: BaseContainerCustomTitle
4 {
5  //------------------------------------------------------------------------------------------------
6  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
7  {
8  string val;
9  source.Get("m_sWidgetName", val);
10  title = val + " " + source.GetClassName();
11  return true;
12  }
13 };
14 
15 //------------------------------------------------------------------------------------------------
19 {
20  [Attribute("", UIWidgets.EditBox, "Widget name")]
21  string m_sWidgetName;
22 
23  [Attribute("", UIWidgets.Object, "Entity state configuration")]
24  protected ref array<ref SCR_NTStateConfigBase> m_aEntityStates;
25 
26  [Attribute("0", UIWidgets.CheckBox, "Whether this element should get scaled down with distance \n ! For scalable elements only")]
27  protected bool m_bScaleElement;
28 
29  protected ref map<ENameTagEntityState, SCR_NTStateConfigBase> m_aEntityStatesMap = new map< ENameTagEntityState, SCR_NTStateConfigBase>;
30 
31  //------------------------------------------------------------------------------------------------
33  protected void InitElementWidget(SCR_NameTagData data, int index)
34  {
35  Widget widget = data.m_NameTagWidget.FindAnyWidget(m_sWidgetName);
36  if (!widget)
37  {
38  Print("Nametags: Improperly setup element in a zone config, cannot fetch requested widget " + this , LogLevel.WARNING);
39  return;
40  }
41 
42  data.m_aNametagElements[index] = widget; // add to data array
43 
44  SetDefaults(data, index);
45  }
46 
47  //------------------------------------------------------------------------------------------------
51  protected SCR_NTStateConfigBase GetEntityStateConfig(SCR_NameTagData data)
52  {
53  ENameTagEntityState state = data.m_ePriorityEntityState;
54  ENameTagEntityState stateMin = ENameTagEntityState.DEFAULT;
56  while (state != stateMin)
57  {
58  if (data.m_eEntityStateFlags & state)
59  {
60  cfg = m_aEntityStatesMap.Get(state);
61  if (cfg)
62  return cfg;
63  }
64 
65  state = state >> 1;
66  }
67 
68  return m_aEntityStatesMap.Get(ENameTagEntityState.DEFAULT);
69  }
70 
71  //------------------------------------------------------------------------------------------------
73  void SetDefaults(SCR_NameTagData data, int index)
74  {}
75 
76  //------------------------------------------------------------------------------------------------
79  protected void ScaleElement(SCR_NameTagData data, int index)
80  {}
81 
82  //------------------------------------------------------------------------------------------------
85  void UpdateElement(SCR_NameTagData data, int index)
86  {
87  // Initial setup
88  if ( !data.m_aNametagElements[index] )
89  {
90  InitElementWidget(data, index);
91  return;
92  }
93 
94  // scale
95  if (m_bScaleElement)
96  {
97  data.m_fTimeSliceUpdate = 1.0;
98  ScaleElement(data, index);
99  }
100 
101  }
102 
103  //------------------------------------------------------------------------------------------------
104  void SCR_NTElementBase()
105  {
106  foreach (SCR_NTStateConfigBase entState : m_aEntityStates)
107  {
108  ENameTagEntityState stateEnum = entState.m_eEntityState;
109  if (stateEnum)
110  m_aEntityStatesMap.Insert(stateEnum, entState);
111  }
112  }
113 };
114 
115 //------------------------------------------------------------------------------------------------
117 class SCR_NameTagStateTitle: BaseContainerCustomTitle
118 {
119  //------------------------------------------------------------------------------------------------
120  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
121  {
123  source.Get("m_eEntityState", type);
124  title = typename.EnumToString(ENameTagEntityState, type);
125 
126  return true;
127  }
128 };
129 
130 //------------------------------------------------------------------------------------------------
134 {
135  [Attribute("", UIWidgets.ComboBox, "Configure selected entity state", "", ParamEnumArray.FromEnum(ENameTagEntityState))]
136  int m_eEntityState;
137 
138  [Attribute("1 1 1 1", UIWidgets.ColorPicker, desc: "Color")]
139  ref Color m_vColor;
140 
141  [Attribute("1", UIWidgets.Slider, desc: "Default opacity when in line of sight", "0 1 1")]
142  float m_fOpacityDefault;
143 
144  [Attribute("true", UIWidgets.CheckBox, "If tag fade time is set, choose whether this state should skip the animation")]
145  bool m_bAnimateTransition;
146 };
147 
148 //------------------------------------------------------------------------------------------------
152 {
153  [Attribute("0 0 0 1", UIWidgets.ColorPicker, desc: "Text shadow color")]
154  ref Color m_vShadowColor;
155 
156  [Attribute("12", UIWidgets.CheckBox, "Text shadow size", params: "0 30")]
157  int m_fShadowSize;
158 
159  [Attribute("1", UIWidgets.Slider, desc: "Text shadow opacity", "0 1 1")]
160  float m_fShadowOpacity;
161 };
162 
163 //------------------------------------------------------------------------------------------------
167 {
168  [Attribute("", UIWidgets.EditBox, desc: "Image selection",)]
169  string m_sImagesetQuad;
170 };
SCR_NameTagStateTitle
Custom names for nametag entity states.
Definition: SCR_NTElementBase.c:117
SCR_NameTagData
Nametag data.
Definition: SCR_NameTagData.c:54
SCR_NTElementBase
Nametag zone element base class, not for setup.
Definition: SCR_NTElementBase.c:18
ENameTagEntityState
ENameTagEntityState
Definition: SCR_NameTagData.c:4
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_NTStateIcon
Nametag icon element state config.
Definition: SCR_NTElementBase.c:166
SCR_NameTagElementTitle
Custom names nametag element config.
Definition: SCR_NTElementBase.c:3
SCR_NTStateConfigBase
Nametag element state config.
Definition: SCR_NTElementBase.c:133
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_NTStateText
Nametag text element state config.
Definition: SCR_NTElementBase.c:151
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
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