Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_GamepadRemovalUI.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
4 {
5  protected const string GAMEPAD_ANY_BUTTON_ACTION = "GamepadAnyButton";
6 
7  protected static ref ScriptInvokerDialog m_OnGamepadRemovalDialogOpen;
8  protected static ref ScriptInvokerDialog m_OnGamepadRemovalDialogClose;
9 
10  protected Widget m_wBackground;
11 
12  //------------------------------------------------------------------------------------------------
13  override void OnMenuOpen()
14  {
15  super.OnMenuOpen();
16 
18  {
19  // Default background opacity is 0.8. In Core Menus, we want it to be fully opaque
20  m_wBackground = GetRootWidget().FindAnyWidget("BackgroundRounded");
21  if (m_wBackground)
22  m_wBackground.SetOpacity(1);
23  }
24 
25  GetGame().GetInputManager().AddActionListener(GAMEPAD_ANY_BUTTON_ACTION, EActionTrigger.PRESSED, Close);
26 
27  if (m_OnGamepadRemovalDialogOpen)
28  m_OnGamepadRemovalDialogOpen.Invoke(this);
29  }
30 
31  //------------------------------------------------------------------------------------------------
32  override void OnMenuClose()
33  {
34  super.OnMenuClose();
35 
36  GetGame().GetInputManager().RemoveActionListener(GAMEPAD_ANY_BUTTON_ACTION, EActionTrigger.PRESSED, Close);
37 
38  if (m_OnGamepadRemovalDialogClose)
39  m_OnGamepadRemovalDialogClose.Invoke(this);
40  }
41 
42  //------------------------------------------------------------------------------------------------
43  static SCR_GamepadRemovalUI OpenGamepadRemovalDialog()
44  {
45  MenuBase dialog;
46  MenuManager menuManager;
47  ArmaReforgerScripted game = GetGame();
48  if (game)
49  menuManager = game.GetMenuManager();
50 
51  if (menuManager && game.IsPlatformGameConsole())
52  dialog = menuManager.OpenDialog(ChimeraMenuPreset.GamepadRemovalDialog, DialogPriority.CRITICAL, 0, true);
53 
54  return SCR_GamepadRemovalUI.Cast(dialog);
55 
56  //TODO: What happens during interaction with input fields, if the controller is removed while the console keyboard is displayed?
57  }
58 
59  //------------------------------------------------------------------------------------------------
60  static ScriptInvokerDialog GetOnGamepadRemovalDialogOpen()
61  {
62  if (!m_OnGamepadRemovalDialogOpen)
63  m_OnGamepadRemovalDialogOpen = new ScriptInvokerDialog();
64 
65  return m_OnGamepadRemovalDialogOpen;
66  }
67 
68  //------------------------------------------------------------------------------------------------
69  static ScriptInvokerDialog GetOnGamepadRemovalDialogClose()
70  {
71  if (!m_OnGamepadRemovalDialogClose)
72  m_OnGamepadRemovalDialogClose = new ScriptInvokerDialog();
73 
74  return m_OnGamepadRemovalDialogClose;
75  }
76 }
m_bIsMainMenuOpen
bool m_bIsMainMenuOpen
Definition: game.c:63
SCR_GamepadRemovalUI
Dialog displayed when the gamepad is removed.
Definition: SCR_GamepadRemovalUI.c:3
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GetRootWidget
Widget GetRootWidget()
Definition: SCR_UITaskManagerComponent.c:160
DialogUI
Definition: DialogUI.c:1
m_wBackground
protected ImageWidget m_wBackground
Definition: SCR_InventoryHitZonePointUI.c:382
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition: ChimeraMenuBase.c:3
ScriptInvokerDialog
ScriptInvokerBase< ScriptInvokerDialogMethod > ScriptInvokerDialog
Definition: SCR_MenuHelper.c:8