4 protected bool m_bToolActive;
5 protected bool m_bIsEnabled =
true;
6 protected bool m_bIsVisible =
true;
8 bool m_bButtonSoundsDisabled;
10 ResourceName m_sImageSet;
15 ref ScriptInvoker m_OnClick =
new ScriptInvoker();
16 static protected ref ScriptInvoker<SCR_MapToolEntry> s_OnEntryToggled =
new ScriptInvoker();
20 static ScriptInvoker GetOnEntryToggledInvoker()
22 return s_OnEntryToggled;
27 void SetActive(
bool toolActive)
42 void SetEnabled(
bool isEnabled)
57 void SetVisible(
bool state)
65 void SetButtonSoundsDisabled(
bool state)
78 SetColor(Color.FromInt(
UIColors.CONTRAST_COLOR.PackToInt()));
80 SetColor(Color.FromInt(
UIColors.DARK_GREY.PackToInt()));
83 SetBorderColor(Color.FromInt(
UIColors.CONTRAST_COLOR.PackToInt()));
85 SetBorderColor(Color.FromInt(
UIColors.DARK_GREY.PackToInt()));
93 protected void SetColor(Color color)
101 protected void SetBorderColor(Color color)
115 protected void OnClick()
125 s_OnEntryToggled.Invoke(
this);
143 if (sortPriority > 0)
155 [
Attribute(
"{2EFEA2AF1F38E7F0}UI/Textures/Icons/icons_wrapperUI-64.imageset", UIWidgets.ResourceNamePicker,
"Menu icons imageset",
"imageset")]
156 ResourceName m_sToolMenuIcons;
158 [
Attribute(
"{47C1A2A23B9CAC97}UI/layouts/Map/MapToolButton.layout", UIWidgets.ResourceNamePicker,
"Entry button prefab",
"layout")]
161 [
Attribute(
"ToolMenu", UIWidgets.EditBox,
desc:
"Root frame widget name")]
164 [
Attribute(
"ToolMenuHoriz", UIWidgets.EditBox,
desc:
"Tool menu widget name")]
167 [
Attribute(
"ToolMenuButton", UIWidgets.EditBox,
desc:
"Default name for generated button widgets")]
170 static ResourceName s_sToolMenuIcons;
232 for (
int i = 0; i < count; i++)
250 buttonComp.m_OnClicked = entry.m_OnClick;
251 buttonComp.SetImage(entry.m_sImageSet, entry.m_sIconQuad);
253 entry.m_ButtonComp = buttonComp;
255 entry.UpdateVisual();
276 protected void OnMapPan(
float x,
float y,
bool adjusted)
310 GetGame().GetWorkspace().SetFocusedWidget(
null);
325 GetGame().GetWorkspace().SetFocusedWidget(w);
331 override event bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y)
333 if (RenderTargetWidget.Cast(enterW) && w.IsEnabled())
338 GetGame().GetWorkspace().SetFocusedWidget(
null);
355 InputManager inputMgr =
GetGame().GetInputManager();
358 inputMgr.AddActionListener(
"MapToolMenuFocus", EActionTrigger.DOWN,
OnFocusToolMenu);
359 inputMgr.AddActionListener(
"MapGamepadCursorX", EActionTrigger.DOWN,
OnFreeCursor);
360 inputMgr.AddActionListener(
"MapGamepadCursorY", EActionTrigger.DOWN,
OnFreeCursor);
376 InputManager inputMgr =
GetGame().GetInputManager();
379 inputMgr.RemoveActionListener(
"MapToolMenuFocus", EActionTrigger.DOWN,
OnFocusToolMenu);
380 inputMgr.RemoveActionListener(
"MapGamepadCursorX", EActionTrigger.DOWN,
OnFreeCursor);
381 inputMgr.RemoveActionListener(
"MapGamepadCursorY", EActionTrigger.DOWN,
OnFreeCursor);
391 s_sToolMenuIcons = m_sToolMenuIcons;