9 const string DEFAULT_IMAGE_SET =
"{3262679C50EF4F01}UI/Textures/Icons/icons_wrapperUI.imageset";
11 [
Attribute(
desc:
"Entry name used for searching and definition")]
12 protected string m_sId;
15 protected bool m_bEnabled;
17 [
Attribute(
desc:
"Action name use as input shortcut for entry")]
18 protected string m_sInputAction;
20 [
Attribute(
"",
".layout",
desc:
"By default menu has predefined layouts. Use only if specific layout for entry is needed")]
21 protected ResourceName m_sCustomLayout;
26 protected ref ScriptInvoker<SCR_SelectionMenuEntry> m_OnPerform;
27 protected ref ScriptInvoker<SCR_SelectionMenuEntry> m_OnPerformFail;
28 protected ref ScriptInvoker<SCR_SelectionMenuEntry, ResourceName, string> m_OnIconChange;
31 protected void InvokeOnPerform()
34 m_OnPerform.Invoke(
this);
38 ScriptInvoker GetOnPerform()
41 m_OnPerform =
new ScriptInvoker();
47 protected void InvokeOnPerformFail()
50 m_OnPerformFail.Invoke(
this);
54 ScriptInvoker GetOnPerformFail()
57 m_OnPerformFail =
new ScriptInvoker();
59 return m_OnPerformFail;
63 protected void InvokeOnIconChange(ResourceName icon,
string imageSetImage)
66 m_OnIconChange.Invoke(
this, icon, imageSetImage);
70 ScriptInvoker GetOnIconChange()
73 m_OnIconChange =
new ScriptInvoker();
75 return m_OnIconChange;
96 InvokeOnPerformFail();
106 protected void OnPerform()
111 void Enable(
bool enable)
115 if (m_EntryComponent)
116 m_EntryComponent.SetEnabled(enable);
134 void SetId(
string id)
143 Print(
"Selection menu entry has enmpty id", LogLevel.WARNING);
149 void SetName(
string name)
155 void SetDescription(
string description)
157 Description = description;
162 void SetIcon(ResourceName iconPath,
string imageSetName =
"")
165 IconSetName = imageSetName;
167 InvokeOnIconChange(Icon, IconSetName);
171 void SetIconFromDeafaultImageSet(
string imageSetName =
"")
173 Icon = DEFAULT_IMAGE_SET;
174 IconSetName = imageSetName;
176 InvokeOnIconChange(Icon, IconSetName);
180 ResourceName GetCustomLayout()
182 return m_sCustomLayout;
186 void SetCustomLayout(ResourceName
layout)
195 if (m_EntryComponent)
196 m_EntryComponent.GetOnClick().Clear();
199 m_EntryComponent = entryComponent;
202 if (m_EntryComponent)
203 m_EntryComponent.GetOnClick().Insert(OnEntryClick);
209 iconEntry.SetImage(Icon, IconSetName);
211 entryComponent.SetEntry(
this);
217 return m_EntryComponent;
227 void SetInputAction(
string action)
229 m_sInputAction = action;
233 string GetInputAction()
235 return m_sInputAction;
248 Icon = DEFAULT_IMAGE_SET;