12 protected ref array<ref SCR_MenuActionPreset> m_aActions;
15 protected int m_iDelay;
17 protected bool m_bHasActionListeners;
22 override void HandlerAttached(Widget w)
24 super.HandlerAttached(w);
34 override void HandlerDeattached(Widget w)
36 super.HandlerDeattached(w);
38 RemoveActionListeners();
52 RemoveActionListeners();
60 protected void OnAction(
float multiplier)
66 InputManager inputManager =
GetGame().GetInputManager();
67 foreach (SCR_MenuActionPreset action :
m_aActions)
69 if (inputManager.GetActionTriggered(action.m_sActionName) &&
m_OnAction)
70 m_OnAction.Invoke(action.m_sActionName, multiplier);
80 protected void AddActionListenersDelayed(
int delay)
85 GetGame().GetCallqueue().CallLater(AddActionListeners, delay);
89 protected void AddActionListeners()
91 GetGame().GetCallqueue().Remove(AddActionListeners);
98 InputManager inputManager =
GetGame().GetInputManager();
100 EActionTrigger trigger;
101 foreach (SCR_MenuActionPreset action :
m_aActions)
103 name = action.m_sActionName;
104 trigger = action.m_eActionTrigger;
105 inputManager.AddActionListener(name, trigger, OnAction);
110 protected void RemoveActionListeners()
112 GetGame().GetCallqueue().Remove(AddActionListeners);
119 InputManager inputManager =
GetGame().GetInputManager();
121 EActionTrigger trigger;
122 foreach (SCR_MenuActionPreset action :
m_aActions)
124 name = action.m_sActionName;
125 trigger = action.m_eActionTrigger;
126 inputManager.RemoveActionListener(name, trigger, OnAction);
131 void ActivateActions()
133 AddActionListenersDelayed(m_iDelay);
137 void DeactivateActions()
139 RemoveActionListeners();
146 array<ref SCR_MenuActionPreset> GetActions()
170 class SCR_MenuActionPreset
175 [
Attribute(
"4", UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EActionTrigger))]
176 EActionTrigger m_eActionTrigger;