Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_HighlightedEditorUIComponent.c
Go to the documentation of this file.
1 
4 {
5  [Attribute("Icon")]
6  protected string m_ImageWidgetName;
7 
8  [Attribute("IconText")]
9  protected string m_TextWidgetName;
10 
11  [Attribute("Animation")]
12  protected string m_AnimWidgetName;
13 
14  [Attribute(desc: "If Highlight has no specific icon")]
15  protected ResourceName m_DefaultIcon;
16 
17  [Attribute(desc: "If multiple highlights")]
18  protected ResourceName m_MultiHighlightIcon;
19 
20  [Attribute(desc: "Array of highlights and icons")]
21  protected ref array<ref SCR_HighlightVisual> m_aHighlightVisuals;
22 
23  [Attribute("1")]
24  protected bool m_bAnimate;
25 
26  //Ref
27  protected SCR_HighlightedEditorComponent m_HighlightedEditorComponent;
28  protected ImageWidget m_ImageWidget;
29  protected TextWidget m_TextWidget;
30 
31  //-------------------------- On Highlight update --------------------------\\
32 
33  //------------------------------------------------------------------------------------------------
34  protected void OnUpdateHighlight(SCR_EditableEntityComponent entity, EEditableEntityHighlight highlight, int highlightCount)
35  {
36  if (entity != m_Entity)
37  return;
38 
39  if (highlightCount > 1)
40  {
41  m_ImageWidget.LoadImageTexture(0, m_MultiHighlightIcon);
42  m_ImageWidget.SetImage(0);
43  m_TextWidget.SetText(highlightCount.ToString());
44  m_TextWidget.SetVisible(true);
45  }
46  else
47  {
48  m_TextWidget.SetVisible(false);
49  foreach (SCR_HighlightVisual visual: m_aHighlightVisuals)
50  {
51  if (visual.GetHighlightType() == highlight)
52  {
53  m_ImageWidget.LoadImageTexture(0, visual.GetIcon());
54  m_ImageWidget.SetImage(0);
55  return;
56  }
57  }
58 
59  //No specific icon found
60  m_ImageWidget.LoadImageTexture(0, m_DefaultIcon);
61  m_ImageWidget.SetImage(0);
62  }
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  protected void OnSelectedChange(EEditableEntityState state, set<SCR_EditableEntityComponent> entitiesInsert, set<SCR_EditableEntityComponent> entitiesRemove)
67  {
68  if (entitiesInsert && entitiesInsert.Contains(m_Entity))
69  StopAnimations(GetWidget());
70  }
71 
72  //------------------------------------------------------------------------------------------------
73  protected void StopAnimations(Widget w)
74  {
75  if (m_bAnimate)
76  {
77  Widget animWidget = w.FindAnyWidget(m_AnimWidgetName);
78  if (animWidget)
79  {
80  AnimateWidget.StopAllAnimations(animWidget);
81  animWidget.SetVisible(false);
82  }
83 
85  if (selectedFilter)
86  selectedFilter.GetOnChanged().Remove(OnSelectedChange);
87  }
88  }
89 
90  //-------------------------- Init --------------------------\\
91 
92  //------------------------------------------------------------------------------------------------
94  {
95  super.OnInit(entity, info, slot);
96 
99  return;
100 
101  Widget w = GetWidget();
102  m_ImageWidget = ImageWidget.Cast(w.FindAnyWidget(m_ImageWidgetName));
103  m_TextWidget = TextWidget.Cast(w.FindAnyWidget(m_TextWidgetName));
104 
105  EEditableEntityHighlight highlight;
106  int highlightCount;
107 
108  m_HighlightedEditorComponent.GetEntityHighlightedState(m_Entity, highlight, highlightCount);
109  m_HighlightedEditorComponent.GetOnUpdateHighlight().Insert(OnUpdateHighlight);
110  OnUpdateHighlight(m_Entity, highlight, highlightCount);
111 
112  if (m_bAnimate)
113  {
114  Widget animWidget = w.FindAnyWidget(m_AnimWidgetName);
115 
116  float size[2] = {70, 70};
117  WidgetAnimationBase anim = AnimateWidget.Opacity(animWidget, 0, 1);
118  if (anim)
119  anim.SetRepeat(true);
120 
121  anim = AnimateWidget.Size(animWidget, size, 1);
122  if (anim)
123  anim.SetRepeat(true);
124 
126  if (selectedFilter)
127  selectedFilter.GetOnChanged().Insert(OnSelectedChange);
128  }
129  }
130 
131  //------------------------------------------------------------------------------------------------
132  override bool OnClick(Widget w, int x, int y, int button)
133  {
134  StopAnimations(w);
135  return super.OnClick(w, x, y, button);
136  }
137 
138  //------------------------------------------------------------------------------------------------
139  override void HandlerDeattached(Widget w)
140  {
141  super.HandlerDeattached(w);
142 
144  m_HighlightedEditorComponent.GetOnUpdateHighlight().Remove(OnUpdateHighlight);
145 
146  StopAnimations(w);
147  }
148 }
149 
151 class SCR_HighlightVisual
152 {
153  [Attribute("0", UIWidgets.ComboBox, "", enums: ParamEnumArray.FromEnum(EEditableEntityHighlight))]
154  protected EEditableEntityHighlight m_HighlightType;
155 
156  [Attribute()]
157  protected ResourceName m_Icon;
158 
159  //------------------------------------------------------------------------------------------------
161  EEditableEntityHighlight GetHighlightType()
162  {
163  return m_HighlightType;
164  }
165 
166  //------------------------------------------------------------------------------------------------
168  ResourceName GetIcon()
169  {
170  return m_Icon;
171  }
172 }
EEditableEntityState
EEditableEntityState
Definition: EEditableEntityState.c:37
m_ImageWidget
protected ImageWidget m_ImageWidget
Definition: SCR_HighlightedEditorUIComponent.c:25
SCR_HighlightedEditorComponent
Definition: SCR_HighlightedEditorComponent.c:11
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
EEditableEntityHighlight
EEditableEntityHighlight
Definition: EEditableEntityHighlight.c:2
SCR_EditableEntityBaseSlotUIComponent
Definition: SCR_EditableEntityBaseSlotUIComponent.c:6
m_Entity
enum EAITargetInfoCategory m_Entity
m_TextWidget
protected TextWidget m_TextWidget
Definition: SCR_HighlightedEditorUIComponent.c:26
m_ImageWidgetName
protected string m_ImageWidgetName
Definition: SCR_HighlightedEditorUIComponent.c:3
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_HighlightedEditorUIComponent
Is an highlighted icon which, if animated pulsates.
Definition: SCR_HighlightedEditorUIComponent.c:3
m_TextWidgetName
protected string m_TextWidgetName
Definition: SCR_HighlightedEditorUIComponent.c:6
m_bAnimate
protected bool m_bAnimate
Definition: SCR_HighlightedEditorUIComponent.c:21
m_HighlightedEditorComponent
protected SCR_HighlightedEditorComponent m_HighlightedEditorComponent
Definition: SCR_HighlightedEditorUIComponent.c:24
SCR_BaseEditableEntityUIComponent
Definition: SCR_BaseEditableEntityUIComponent.c:8
SCR_BaseEditableEntityFilter
Definition: SCR_BaseEditableEntityFilter.c:13
SCR_UIInfo
Definition: SCR_UIInfo.c:7
m_DefaultIcon
protected ResourceName m_DefaultIcon
Definition: SCR_HighlightedEditorUIComponent.c:12
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
SCR_BaseContainerCustomTitleEnum
SCR_HighlightedEditorUIComponent SCR_BaseEditableEntityUIComponent SCR_BaseContainerCustomTitleEnum(EEditableEntityHighlight, "m_HighlightType")
Definition: SCR_HighlightedEditorUIComponent.c:150
m_AnimWidgetName
protected string m_AnimWidgetName
Definition: SCR_HighlightedEditorUIComponent.c:9
m_aHighlightVisuals
protected ref array< ref SCR_HighlightVisual > m_aHighlightVisuals
Definition: SCR_HighlightedEditorUIComponent.c:18
BaseContainerProps
SCR_HighlightedEditorUIComponent SCR_BaseEditableEntityUIComponent BaseContainerProps()
m_MultiHighlightIcon
protected ResourceName m_MultiHighlightIcon
Definition: SCR_HighlightedEditorUIComponent.c:15
GetWidget
protected Widget GetWidget()
Definition: SCR_VonDisplay.c:155