Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SelectionMenuEntry.c
Go to the documentation of this file.
1
4
5//------------------------------------------------------------------------------------------------
8{
9 [Attribute(desc: "Entry name used for searching and definition")]
10 protected string m_sId;
11
12 [Attribute("1")]
13 protected bool m_bEnabled;
14
15 [Attribute(desc: "Action name use as input shortcut for entry")]
16 protected string m_sInputAction;
17
18 [Attribute("", ".layout", desc: "By default menu has predefined layouts. Use only if specific layout for entry is needed")]
20
22
23 // Invokers
27
28 //------------------------------------------------------------------------------------------------
29 protected void InvokeOnPerform()
30 {
31 if (m_OnPerform)
32 m_OnPerform.Invoke(this);
33 }
34
35 //------------------------------------------------------------------------------------------------
37 {
38 if (!m_OnPerform)
40
41 return m_OnPerform;
42 }
43
44 //------------------------------------------------------------------------------------------------
45 protected void InvokeOnPerformFail()
46 {
48 m_OnPerformFail.Invoke(this);
49 }
50
51 //------------------------------------------------------------------------------------------------
59
60 //------------------------------------------------------------------------------------------------
61 protected void InvokeOnIconChange(ResourceName icon, string imageSetImage)
62 {
64 m_OnIconChange.Invoke(this, icon, imageSetImage);
65 }
66
67 //------------------------------------------------------------------------------------------------
75
76 //------------------------------------------------------------------------------------------------
77 // Custom methods
78 //------------------------------------------------------------------------------------------------
79
80 //------------------------------------------------------------------------------------------------
82 void Update()
83 {
84 }
85
86 //------------------------------------------------------------------------------------------------
89 void Perform()
90 {
91 // Check can be performed
92 if (!m_bEnabled)
93 {
95 return;
96 }
97
98 OnPerform();
100 }
101
102 //------------------------------------------------------------------------------------------------
104 protected void OnPerform()
105 {
106 }
107
108 //------------------------------------------------------------------------------------------------
109 void Enable(bool enable)
110 {
111 m_bEnabled = enable;
112
114 m_EntryComponent.SetEnabled(enable);
115 }
116
117 //------------------------------------------------------------------------------------------------
118 // Callbacks
119 //------------------------------------------------------------------------------------------------
120
121 //------------------------------------------------------------------------------------------------
122 protected void OnEntryClick(SCR_SelectionMenuEntryComponent entryComponent)
123 {
124 Perform();
125 }
126
127 //------------------------------------------------------------------------------------------------
128 // Get set
129 //------------------------------------------------------------------------------------------------
130
131 //------------------------------------------------------------------------------------------------
132 void SetId(string id)
133 {
134 m_sId = id;
135 }
136
137 //------------------------------------------------------------------------------------------------
138 string GetId()
139 {
140 return m_sId;
141 }
142
143 //------------------------------------------------------------------------------------------------
144 void SetName(string name)
145 {
146 Name = name;
147 }
148
149 //------------------------------------------------------------------------------------------------
150 void SetDescription(string description)
151 {
152 Description = description;
153 }
154
155 //------------------------------------------------------------------------------------------------
157 void SetIcon(ResourceName iconPath, string imageSetName = "")
158 {
159 Icon = iconPath;
160 IconSetName = imageSetName;
161
163 }
164
165 //------------------------------------------------------------------------------------------------
166 void SetIconFromDeafaultImageSet(string imageSetName = "")
167 {
168 Icon = UIConstants.ICONS_IMAGE_SET;
169 IconSetName = imageSetName;
170
172 }
173
174 //------------------------------------------------------------------------------------------------
179
180 //------------------------------------------------------------------------------------------------
185
186 //------------------------------------------------------------------------------------------------
188 {
189 // Clear
191 m_EntryComponent.GetOnClick().Clear();
192
193
194 m_EntryComponent = entryComponent;
195
196 // Setup invokers
198 m_EntryComponent.GetOnClick().Insert(OnEntryClick);
199
200
201 // Setup icons - TODO: probably can be moved to seperate component
203 if (iconEntry)
204 iconEntry.SetImage(Icon, IconSetName);
205
206 entryComponent.SetEntry(this);
207 }
208
209 //------------------------------------------------------------------------------------------------
214
215 //------------------------------------------------------------------------------------------------
217 {
218 return m_bEnabled;
219 }
220
221 //------------------------------------------------------------------------------------------------
222 void SetInputAction(string action)
223 {
224 m_sInputAction = action;
225 }
226
227 //------------------------------------------------------------------------------------------------
229 {
230 return m_sInputAction;
231 }
232
233 //------------------------------------------------------------------------------------------------
234 // Constructor
235 //------------------------------------------------------------------------------------------------
236
237 //------------------------------------------------------------------------------------------------
239 {
240 m_bEnabled = true;
241
242 if (Icon.IsEmpty())
243 Icon = UIConstants.ICONS_IMAGE_SET;
244 }
245};
AddonBuildInfoTool id
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
class SCR_ArsenalGameModeUIDataHolder SCR_BaseContainerCustomTitleUIInfo("m_UIInfo")
UI layouts Menus CleanSweep CleanSweepAreaSelection layout
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void SetEntry(SCR_SelectionMenuEntry entry)
Set entry holding data driving this visuals.
ref ScriptInvoker< SCR_SelectionMenuEntry, ResourceName, string > m_OnIconChange
void SetInputAction(string action)
void OnEntryClick(SCR_SelectionMenuEntryComponent entryComponent)
ScriptInvoker GetOnPerform()
ref ScriptInvoker< SCR_SelectionMenuEntry > m_OnPerform
void SetIcon(ResourceName iconPath, string imageSetName="")
Set icon and invoke change.
void InvokeOnIconChange(ResourceName icon, string imageSetImage)
void SetId(string id)
string m_sInputAction
ResourceName GetCustomLayout()
string GetId()
void SetName(string name)
void SetEntryComponent(SCR_SelectionMenuEntryComponent entryComponent)
string GetInputAction()
void Enable(bool enable)
void InvokeOnPerformFail()
void SCR_SelectionMenuEntry()
SCR_SelectionMenuEntryComponent GetEntryComponent()
ScriptInvoker GetOnIconChange()
void OnPerform()
Empty methods for deifinition of perform behavior.
ScriptInvoker GetOnPerformFail()
void SetCustomLayout(ResourceName layout)
void SetDescription(string description)
string m_sId
ref SCR_SelectionMenuEntryComponent m_EntryComponent
bool IsEnabled()
void Perform()
void InvokeOnPerform()
void Update()
Public method to make entry update itself.
ResourceName m_sCustomLayout
bool m_bEnabled
void SetIconFromDeafaultImageSet(string imageSetName="")
ref ScriptInvoker< SCR_SelectionMenuEntry > m_OnPerformFail
void SetImage(ResourceName texture, string image)
LocalizedString Description
string IconSetName
Definition SCR_UIInfo.c:13
ResourceName Icon
Definition SCR_UIInfo.c:10
LocalizedString Name
Definition SCR_UIName.c:8
SCR_FieldOfViewSettings Attribute
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134