11 protected bool m_sEnableControl;
21 protected IEntity m_Owner;
25 protected ref ScriptInvoker<SCR_RadialMenuController, bool> m_OnInputOpen;
26 protected ref ScriptInvoker<SCR_RadialMenuController> m_OnTakeControl;
27 protected ref ScriptInvoker<SCR_RadialMenuController, bool> m_OnControllerChanged;
30 ScriptInvoker GetOnInputOpen()
33 m_OnInputOpen =
new ScriptInvoker();
39 protected void InvokeOnInputOpen(
bool hasControl)
42 m_OnInputOpen.Invoke(
this, hasControl);
46 ScriptInvoker GetOnTakeControl()
49 m_OnTakeControl =
new ScriptInvoker();
51 return m_OnTakeControl;
55 protected void InvokeOnTakeControl()
58 m_OnTakeControl.Invoke(
this);
62 protected void InvokeOnControllerChanged(
bool hasControl)
64 if (m_OnControllerChanged)
65 m_OnControllerChanged.Invoke(
this, hasControl);
69 ScriptInvoker GetOnControllerChanged()
71 if (!m_OnControllerChanged)
72 m_OnControllerChanged =
new ScriptInvoker();
74 return m_OnControllerChanged;
84 radialMenu.GetOnControllerChanged().Remove(OnMenuControllerChanged);
89 if (radialMenu ==
null)
99 m_RadialMenu.GetOnControllerChanged().Insert(OnMenuControllerChanged);
101 InvokeOnTakeControl();
106 void StopControl(
bool closeMenu =
false)
110 m_RadialMenu.GetOnControllerChanged().Remove(OnMenuControllerChanged);
121 void SetMenuDisplay()
127 void UpdateMenuData()
140 bool hasControl = HasControl();
141 InvokeOnInputOpen(hasControl);
143 if (!m_sEnableControl)
147 Control(
m_Owner, m_RadialMenuToControl);
150 if (!m_RMControls.m_bShowWhileUnconcious)
153 if (controllerEntity)
155 CharacterControllerComponent characterControler = CharacterControllerComponent.Cast(controllerEntity.FindComponent(CharacterControllerComponent));
156 if (characterControler && characterControler.IsUnconscious())
179 if (controller != m_RMControls)
184 InvokeOnControllerChanged(
false);
196 void SetEnableControl(
bool enable)
198 m_sEnableControl = enable;
202 bool GetEnableControl()
204 return m_sEnableControl;
210 m_RadialMenuToControl = radialMenu;
237 Print(
"[SCR_RadialMenuController] - has no menu selected to control!", LogLevel.WARNING);
244 return m_RadialMenu.GetControllerInputs() == m_RMControls;
250 if (m_RMControls && !m_RMControls.m_sOpenAction.IsEmpty())
251 GetGame().GetInputManager().AddActionListener(m_RMControls.m_sOpenAction, EActionTrigger.DOWN, OnInputOpen);