Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_NTIconBase.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
5 {
6  [Attribute("{70E828A2F6EBE7D0}UI/Textures/Nametags/nametagicons.imageset", UIWidgets.ResourceNamePicker, desc: "Imageset selection", params: "imageset")]
7  ResourceName m_sImageset;
8 
9  [Attribute("64", UIWidgets.CheckBox, "Scaled icon size at the beginning of the zone \n pix*pix")]
10  protected float m_iImageSizeMax;
11 
12  [Attribute("64", UIWidgets.CheckBox, "Scaled icon size at the end of the zone \n pix*pix")]
13  protected float m_iImageSizeMin;
14 
15  //------------------------------------------------------------------------------------------------
16  override protected void ScaleElement(SCR_NameTagData data, int index)
17  {
18  ImageWidget widget = ImageWidget.Cast( data.m_aNametagElements[index] );
19  if (!widget)
20  return;
21 
22  //At least one zone always need to be defined
23  SCR_NameTagZone zone = SCR_NameTagDisplay.GetNametagZones().Get(data.m_iZoneID);
24  if (!zone)
25  return;
26 
27  float diff = m_iImageSizeMax - m_iImageSizeMin;
28 
29  // avoid 0 as a starting point
30  int zoneStart = zone.GetZoneStart();
31  if ( zoneStart < 1 )
32  zoneStart = 1;
33 
34  float lerp = Math.InverseLerp(zoneStart, zone.m_iZoneEnd, data.m_fDistance);
35  diff = diff * lerp;
36  // final size
37  diff = ( m_iImageSizeMax - diff );
38 
39  widget.SetSize(diff, diff);
40  }
41 
42  //------------------------------------------------------------------------------------------------
43  override void SetDefaults(SCR_NameTagData data, int index)
44  {
45  ImageWidget iWidget = ImageWidget.Cast( data.m_aNametagElements[index] );
46  if (!iWidget)
47  return;
48 
49  SCR_NTStateIcon stateConf = SCR_NTStateIcon.Cast( GetEntityStateConfig(data) );
50  if (!stateConf)
51  return;
52 
53  if (!m_sImageset.IsEmpty() && !stateConf.m_sImagesetQuad.IsEmpty())
54  iWidget.LoadImageFromSet(0, m_sImageset, stateConf.m_sImagesetQuad);
55 
56  if (!m_bScaleElement)
57  FrameSlot.SetSize(iWidget, m_iImageSizeMin, m_iImageSizeMin);
58 
59  iWidget.SetColor(stateConf.m_vColor);
60 
61  data.SetVisibility(iWidget, stateConf.m_fOpacityDefault != 0, stateConf.m_fOpacityDefault, stateConf.m_bAnimateTransition); // transitions
62  }
63 };
64 
65 //------------------------------------------------------------------------------------------------
69 {
70  [Attribute("0", UIWidgets.CheckBox, "Whether this element should use defined faction rank icons in default state")]
71  protected bool m_bUseRanks;
72 
73  //------------------------------------------------------------------------------------------------
74  override void SetDefaults(SCR_NameTagData data, int index)
75  {
76  super.SetDefaults(data, index);
77 
78  // if using ranks
79  if (!m_bUseRanks)
80  return;
81 
82  ImageWidget iWidget = ImageWidget.Cast( data.m_aNametagElements[index] );
83  if (iWidget)
84  {
85  SCR_NTStateIcon stateConf = SCR_NTStateIcon.Cast( GetEntityStateConfig(data) );
86  if (stateConf)
87  {
88  if (stateConf.m_eEntityState == ENameTagEntityState.DEFAULT)
89  {
90  ResourceName rankIcon = SCR_CharacterRankComponent.GetCharacterRankInsignia(data.m_Entity);
91  if (rankIcon)
92  iWidget.LoadImageTexture(0, rankIcon);
93  }
94  }
95  }
96  }
97 };
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
SCR_NameTagZone
Nametag zone config setup.
Definition: SCR_NameTagConfig.c:109
SCR_CharacterRankComponent
void SCR_CharacterRankComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_CharacterRankComponent.c:209
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_NTStateIcon
Nametag icon element state config.
Definition: SCR_NTElementBase.c:166
SCR_NTIconState
Zone element for state icon.
Definition: SCR_NTIconBase.c:68
SCR_NameTagElementTitle
Custom names nametag element config.
Definition: SCR_NTElementBase.c:3
SCR_NameTagDisplay
Definition: SCR_NameTagDisplay.c:4
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
SCR_NTIconBase
Base zone element widget for icons/images.
Definition: SCR_NTIconBase.c:4
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