Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_GamepadRemovalUI.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
4{
5 protected const string TEXTURE_XBOX = "{F669664236AE1AD7}UI/Textures/Common/Xbox_controller.edds";
6 protected const string TEXTURE_PLAYSTATION = "{7DB8A1E50905C0EB}UI/Textures/Common/PlayStation_controller.edds";
7
8 protected const string GAMEPAD_ANY_BUTTON_ACTION = "GamepadAnyButton";
9 protected const string KEYBOARD_ANY_BUTTON_ACTION = "KeyboardAnyButton";
10
13
17
18 //------------------------------------------------------------------------------------------------
19 override void OnMenuOpen()
20 {
21 super.OnMenuOpen();
22
24 {
25 // Default background opacity is semi-transparent. In Core Menus, we want it to be fully opaque
26 m_wBackground = GetRootWidget().FindAnyWidget("BackgroundRounded");
27 if (m_wBackground)
28 m_wBackground.SetOpacity(1);
29 }
30
31 m_wImageContainer = GetRootWidget().FindAnyWidget("ContentLayoutContainer");
32 m_wImage = ImageWidget.Cast(GetRootWidget().FindAnyWidget("ControllerImage"));
34
35 GetGame().GetInputManager().AddActionListener(GAMEPAD_ANY_BUTTON_ACTION, EActionTrigger.PRESSED, CloseAnimated);
36 GetGame().GetInputManager().AddActionListener(KEYBOARD_ANY_BUTTON_ACTION, EActionTrigger.PRESSED, CloseAnimated);
37
40 }
41
42 //------------------------------------------------------------------------------------------------
43 override void OnMenuClose()
44 {
45 super.OnMenuClose();
46
47 GetGame().GetInputManager().RemoveActionListener(GAMEPAD_ANY_BUTTON_ACTION, EActionTrigger.PRESSED, CloseAnimated);
48 GetGame().GetInputManager().RemoveActionListener(KEYBOARD_ANY_BUTTON_ACTION, EActionTrigger.PRESSED, CloseAnimated);
49
52 }
53
54 //------------------------------------------------------------------------------------------------
55 protected void UpdateImage()
56 {
57 if (!m_wImage)
58 {
60 m_wImageContainer.SetVisible(false);
61
62 return;
63 }
64
65 switch (System.GetPlatform())
66 {
67 case EPlatform.PS4:
68 case EPlatform.PS5:
69 case EPlatform.PS5_PRO:
70 {
71 m_wImage.LoadImageTexture(0, TEXTURE_PLAYSTATION);
72 break;
73 }
74
75 case EPlatform.XBOX_ONE:
76 case EPlatform.XBOX_ONE_S:
77 case EPlatform.XBOX_ONE_X:
78 case EPlatform.XBOX_SERIES_S:
79 case EPlatform.XBOX_SERIES_X:
80 {
81 m_wImage.LoadImageTexture(0, TEXTURE_XBOX);
82 break;
83 }
84
85 default:
86 {
88 m_wImageContainer.SetVisible(false);
89 else
90 m_wImage.SetVisible(false);
91 }
92 }
93 }
94
95 //------------------------------------------------------------------------------------------------
97 {
98 MenuBase dialog;
99 MenuManager menuManager;
100 ArmaReforgerScripted game = GetGame();
101 if (game)
102 menuManager = game.GetMenuManager();
103
104 if (menuManager && game.IsPlatformGameConsole())
105 dialog = menuManager.OpenDialog(ChimeraMenuPreset.GamepadRemovalDialog, DialogPriority.CRITICAL, 0, true);
106
107 return SCR_GamepadRemovalUI.Cast(dialog);
108
109 //TODO: What happens during interaction with input fields, if the controller is removed while the console keyboard is displayed?
110 }
111
112 //------------------------------------------------------------------------------------------------
114 {
115 ArmaReforgerScripted game = GetGame();
116 MenuManager menuManager = game.GetMenuManager();
117
118 if (game.IsPlatformGameConsole())
119 menuManager.CloseMenuByPreset(ChimeraMenuPreset.GamepadRemovalDialog);
120 }
121
122 //------------------------------------------------------------------------------------------------
130}
ChimeraMenuPreset
Menu presets.
ref DSGameConfig game
Definition DSConfig.c:81
ArmaReforgerScripted GetGame()
Definition game.c:1398
bool m_bIsMainMenuOpen
Definition game.c:57
ScriptInvokerBase< ScriptInvokerDialogMethod > ScriptInvokerDialog
Widget GetRootWidget()
void CloseAnimated()
animates dialog closure
Definition DialogUI.c:220
proto external MenuBase OpenDialog(ScriptMenuPresetEnum preset, int priority=DialogPriority.INFORMATIVE, int iUserData=0, bool unique=false)
proto external bool CloseMenuByPreset(ScriptMenuPresetEnum preset)
Put menu with given iPresetId into queue for closing (which is processed during next MenuManeger upda...
Dialog displayed when the gamepad is removed.
static void CloseGamepadRemovalDialog()
static ref ScriptInvokerDialog m_OnGamepadRemovalDialogOpen
static SCR_GamepadRemovalUI OpenGamepadRemovalDialog()
static ref ScriptInvokerDialog m_OnGamepadRemovalDialogClose
static ScriptInvokerDialog GetOnGamepadRemovalDialogClose()
const string GAMEPAD_ANY_BUTTON_ACTION
const string KEYBOARD_ANY_BUTTON_ACTION
EActionTrigger
EPlatform
Definition EPlatform.c:13
DialogPriority
Definition menuManager.c:5