Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_HighlightedEditorUIComponent.c
Go to the documentation of this file.
2
5 [Attribute("Icon")]
6 protected string m_ImageWidgetName;
8 [Attribute("IconText")]
9 protected string m_TextWidgetName;
11 [Attribute("Animation")]
12 protected string m_AnimWidgetName;
14 [Attribute(desc: "If Highlight has no specific icon")]
17 [Attribute(desc: "If multiple highlights")]
20 [Attribute(desc: "Array of highlights and icons")]
21 protected ref array<ref SCR_HighlightVisual> m_aHighlightVisuals;
23 [Attribute("1")]
24 protected bool m_bAnimate;
25
26 //Ref
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))
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 {
81 animWidget.SetVisible(false);
82 }
83
85 if (selectedFilter)
86 selectedFilter.GetOnChanged().Remove(OnSelectedChange);
87 }
88 }
89
90 //-------------------------- Init --------------------------\\
91
92 //---- REFACTOR NOTE START: Hardcoded values for size
93
94 //------------------------------------------------------------------------------------------------
96 {
97 super.OnInit(entity, info, slot);
98
101 return;
102
103 Widget w = GetWidget();
104 m_ImageWidget = ImageWidget.Cast(w.FindAnyWidget(m_ImageWidgetName));
105 m_TextWidget = TextWidget.Cast(w.FindAnyWidget(m_TextWidgetName));
106
107 EEditableEntityHighlight highlight;
108 int highlightCount;
109
110 m_HighlightedEditorComponent.GetEntityHighlightedState(m_Entity, highlight, highlightCount);
111 m_HighlightedEditorComponent.GetOnUpdateHighlight().Insert(OnUpdateHighlight);
112 OnUpdateHighlight(m_Entity, highlight, highlightCount);
113
114 if (m_bAnimate)
115 {
116 Widget animWidget = w.FindAnyWidget(m_AnimWidgetName);
117
118 float size[2] = {70, 70};
119 WidgetAnimationBase anim = AnimateWidget.Opacity(animWidget, 0, 1);
120 if (anim)
121 anim.SetRepeat(true);
122
123 anim = AnimateWidget.Size(animWidget, size, 1);
124 if (anim)
125 anim.SetRepeat(true);
126
128 if (selectedFilter)
129 selectedFilter.GetOnChanged().Insert(OnSelectedChange);
130 }
132
133 //---- REFACTOR NOTE END ----
134
135 //------------------------------------------------------------------------------------------------
136 override bool OnClick(Widget w, int x, int y, int button)
137 {
139 return super.OnClick(w, x, y, button);
140 }
141
142 //------------------------------------------------------------------------------------------------
143 override void HandlerDeattached(Widget w)
144 {
145 super.HandlerDeattached(w);
146
148 m_HighlightedEditorComponent.GetOnUpdateHighlight().Remove(OnUpdateHighlight);
149
151 }
152}
153
155class SCR_HighlightVisual
156{
157 [Attribute("0", UIWidgets.ComboBox, "", enums: ParamEnumArray.FromEnum(EEditableEntityHighlight))]
158 protected EEditableEntityHighlight m_HighlightType;
159
160 [Attribute()]
161 protected ResourceName m_Icon;
162
163 //------------------------------------------------------------------------------------------------
165 EEditableEntityHighlight GetHighlightType()
166 {
167 return m_HighlightType;
168 }
169
170 //------------------------------------------------------------------------------------------------
172 ResourceName GetIcon()
173 {
174 return m_Icon;
175 }
176}
EEditableEntityHighlight
int size
enum EAITargetInfoCategory m_Entity
SCR_HighlightedEditorUIComponent SCR_BaseEditableEntityUIComponent BaseContainerProps()
SCR_HighlightedEditorUIComponent SCR_BaseEditableEntityUIComponent SCR_BaseContainerCustomTitleEnum(EEditableEntityHighlight, "m_HighlightType")
ImageWidget m_ImageWidget
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Widget GetWidget()
void WidgetAnimationBase(Widget w, float speed)
static WidgetAnimationFrameSize Size(Widget widget, float size[2], float speed)
static WidgetAnimationOpacity Opacity(Widget widget, float targetValue, float speed, bool toggleVisibility=false)
static void StopAllAnimations(Widget w)
ScriptInvokerBase< SCR_BaseEditableEntityFilter_OnChange > GetOnChanged()
static SCR_BaseEditableEntityFilter GetInstance(EEditableEntityState state, bool showError=false)
Is an highlighted icon which, if animated pulsates.
override void OnInit(SCR_EditableEntityComponent entity, SCR_UIInfo info, SCR_EditableEntityBaseSlotUIComponent slot)
void OnUpdateHighlight(SCR_EditableEntityComponent entity, EEditableEntityHighlight highlight, int highlightCount)
override bool OnClick(Widget w, int x, int y, int button)
ref array< ref SCR_HighlightVisual > m_aHighlightVisuals
SCR_HighlightedEditorComponent m_HighlightedEditorComponent
void OnSelectedChange(EEditableEntityState state, set< SCR_EditableEntityComponent > entitiesInsert, set< SCR_EditableEntityComponent > entitiesRemove)
EEditableEntityState
SCR_FieldOfViewSettings Attribute