3 [
Attribute(
"{39D815C843414C76}UI/layouts/Menus/DeployMenu/LoadoutButton.layout")]
4 protected ResourceName m_sLoadoutButton;
5 protected ref set<SCR_LoadoutButton> m_aLoadoutButtons =
new set<SCR_LoadoutButton>();
7 protected ref ScriptInvoker<SCR_LoadoutButton> m_OnLoadoutClicked;
8 protected ref ScriptInvoker<SCR_BasePlayerLoadout> m_OnLoadoutHovered;
10 protected bool m_bFocused;
12 override void HandlerAttached(Widget w)
14 super.HandlerAttached(w);
15 EnablePagingInputListeners(
false);
20 return m_OnFocusChange;
23 void SetGalleryFocused(
bool focused)
25 Widget focusedWidget =
GetGame().GetWorkspace().GetFocusedWidget();
26 if (m_bFocused && (focusedWidget && focusedWidget.IsInherited(
SCR_LoadoutButton)))
30 m_OnFocusChange.Invoke(m_bFocused);
33 override bool OnFocus(Widget w,
int x,
int y)
35 super.OnFocus(w, x, y);
36 SetGalleryFocused(
true);
41 override bool OnFocusLost(Widget w,
int x,
int y)
43 super.OnFocusLost(w, x, y);
44 SetGalleryFocused(
false);
54 void EnablePagingInputListeners(
bool enable)
56 GetGame().GetInputManager().RemoveActionListener(
m_sActionLeft, EActionTrigger.DOWN, OnCustomLeft);
68 Widget loadoutEntry =
GetGame().GetWorkspace().CreateWidgets(m_sLoadoutButton);
73 loadoutBtn.SetEnabled(enabled);
75 loadoutBtn.m_OnClicked.Insert(OnLoadoutClicked);
76 loadoutBtn.m_OnFocus.Insert(OnLoadoutHovered);
77 loadoutBtn.m_OnMouseEnter.Insert(OnLoadoutHovered);
79 m_aLoadoutButtons.Insert(loadoutBtn);
82 int itm = AddItem(loadoutEntry);
88 override void ShowPagingButtons(
bool animate =
true)
90 bool show = (
m_aWidgets.Count() > m_iCountShownItems);
100 GetOnLoadoutClicked().Invoke(loadoutBtn);
103 protected void OnLoadoutHovered(Widget btn)
107 GetOnLoadoutHovered().Invoke(loadoutBtn.GetLoadout());
110 Widget GetContentRoot()
112 return m_wContentRoot;
119 loadoutBtn.SetSelected(loadoutBtn.GetLoadout() ==
loadout)
123 override void ClearAll()
126 m_aLoadoutButtons.Clear();
133 if (btn.GetLoadout() ==
loadout)
140 ScriptInvoker GetOnLoadoutClicked()
142 if (!m_OnLoadoutClicked)
143 m_OnLoadoutClicked =
new ScriptInvoker();
145 return m_OnLoadoutClicked;
148 ScriptInvoker GetOnLoadoutHovered()
150 if (!m_OnLoadoutHovered)
151 m_OnLoadoutHovered =
new ScriptInvoker();
153 return m_OnLoadoutHovered;