Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_InventoryNavigationButtonBack.c
Go to the documentation of this file.
1 
3 //------------------------------------------------------------------------------------------------
5 {
6  protected bool m_bCloseWithGamepad;
7  protected SCR_InventoryStorageBaseUI m_pParentStorage = null;
8  protected int m_iStorageIndex = -1;
9 
10  //------------------------------------------------------------------------------------------------
11  void OnActivate(Widget w)
12  {
13  if (GetGame().GetInputManager().GetLastUsedInputDevice() == EInputDeviceType.MOUSE)
14  return;
15 
16  OnClick(w, 0, 0, 0);
17  }
18 
19  //------------------------------------------------------------------------------------------------
20  override bool OnClick(Widget w, int x, int y, int button)
21  {
22  if (button != 0 || !m_wRoot.IsVisible() || !m_wRoot.IsEnabled())
23  return false;
24 
25  m_OnActivated.Invoke(this, m_sActionName, m_pParentStorage, m_iStorageIndex);
26  return false;
27  }
28 
29  //------------------------------------------------------------------------------------------------
30  override protected void OnInput()
31  {
32  if (!m_wRoot)
33  return;
34 
35  if (!m_bCloseWithGamepad)
36  return;
37 
38  bool bEnabled = m_wRoot.IsEnabled();
39  bool bVisible = m_wRoot.IsVisible();
40 
41  if (!bEnabled || !bVisible)
42  return;
43 
44  m_OnActivated.Invoke(this, m_sActionName, m_pParentStorage, m_iStorageIndex);
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  override void SetAction(string action)
49  {
50  // Remove old listener and add a new one
51  GetGame().GetInputManager().RemoveActionListener(m_sActionName, EActionTrigger.DOWN, OnInput);
52  GetGame().GetInputManager().AddActionListener(m_sActionName, EActionTrigger.DOWN, OnInput);
53  }
54 
55  //------------------------------------------------------------------------------------------------
56  override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
57  {
58  super.OnMouseLeave(w, enterW, x, y);
59 
60  GetGame().GetWorkspace().SetFocusedWidget(null);
61 
62  return false;
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  void SetParentStorage(SCR_InventoryStorageBaseUI pParentStorage)
67  {
68  m_pParentStorage = pParentStorage;
69  }
70 
71  //------------------------------------------------------------------------------------------------
72  void SetStorageIndex(int index)
73  {
74  m_iStorageIndex = index;
75  }
76 
77  //------------------------------------------------------------------------------------------------
78  void EnableCloseWithGamepad(bool enable)
79  {
80  m_bCloseWithGamepad = enable;
81  }
82 
83  //------------------------------------------------------------------------------------------------
84  int GetStorageIndex()
85  {
86  return m_iStorageIndex;
87  }
88 };
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_sActionName
protected string m_sActionName
Definition: SCR_ActionsRadialMenuEditorComponent.c:24
SCR_InventoryStorageBaseUI
Definition: SCR_InventoryStorageBaseUI.c:6
SCR_InventoryNavigationButtonBack
Interactive non-focus button showing hint, and triggering actions.
Definition: SCR_InventoryNavigationButtonBack.c:4
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
GetInputManager
protected InputManager GetInputManager()
Definition: SCR_BaseManualCameraComponent.c:65
SCR_InputButtonComponent
Definition: SCR_InputButtonComponent.c:1