Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_GamepadRemovalUI.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
3
class
SCR_GamepadRemovalUI
:
DialogUI
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
11
protected
static
ref
ScriptInvokerDialog
m_OnGamepadRemovalDialogOpen
;
12
protected
static
ref
ScriptInvokerDialog
m_OnGamepadRemovalDialogClose
;
13
14
protected
Widget
m_wBackground
;
15
protected
ImageWidget
m_wImage
;
16
protected
Widget
m_wImageContainer
;
17
18
//------------------------------------------------------------------------------------------------
19
override
void
OnMenuOpen
()
20
{
21
super.OnMenuOpen();
22
23
if
(
GetGame
().
m_bIsMainMenuOpen
)
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"
));
33
UpdateImage
();
34
35
GetGame
().GetInputManager().AddActionListener(
GAMEPAD_ANY_BUTTON_ACTION
,
EActionTrigger
.PRESSED,
CloseAnimated
);
36
GetGame
().GetInputManager().AddActionListener(
KEYBOARD_ANY_BUTTON_ACTION
,
EActionTrigger
.PRESSED,
CloseAnimated
);
37
38
if
(
m_OnGamepadRemovalDialogOpen
)
39
m_OnGamepadRemovalDialogOpen
.Invoke(
this
);
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
50
if
(
m_OnGamepadRemovalDialogClose
)
51
m_OnGamepadRemovalDialogClose
.Invoke(
this
);
52
}
53
54
//------------------------------------------------------------------------------------------------
55
protected
void
UpdateImage
()
56
{
57
if
(!
m_wImage
)
58
{
59
if
(
m_wImageContainer
)
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
{
87
if
(
m_wImageContainer
)
88
m_wImageContainer
.SetVisible(
false
);
89
else
90
m_wImage
.SetVisible(
false
);
91
}
92
}
93
}
94
95
//------------------------------------------------------------------------------------------------
96
static
SCR_GamepadRemovalUI
OpenGamepadRemovalDialog
()
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
//------------------------------------------------------------------------------------------------
113
static
void
CloseGamepadRemovalDialog
()
114
{
115
ArmaReforgerScripted
game
=
GetGame
();
116
MenuManager
menuManager =
game
.GetMenuManager();
117
118
if
(
game
.IsPlatformGameConsole())
119
menuManager.
CloseMenuByPreset
(
ChimeraMenuPreset
.GamepadRemovalDialog);
120
}
121
122
//------------------------------------------------------------------------------------------------
123
static
ScriptInvokerDialog
GetOnGamepadRemovalDialogClose
()
124
{
125
if
(!
m_OnGamepadRemovalDialogClose
)
126
m_OnGamepadRemovalDialogClose
=
new
ScriptInvokerDialog
();
127
128
return
m_OnGamepadRemovalDialogClose
;
129
}
130
}
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition
ChimeraMenuBase.c:4
game
ref DSGameConfig game
Definition
DSConfig.c:81
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
m_bIsMainMenuOpen
bool m_bIsMainMenuOpen
Definition
game.c:57
ScriptInvokerDialog
ScriptInvokerBase< ScriptInvokerDialogMethod > ScriptInvokerDialog
Definition
SCR_MenuHelper.c:11
GetRootWidget
Widget GetRootWidget()
Definition
SCR_ModularButtonComponent.c:189
DialogUI
Definition
DialogUI.c:2
DialogUI::CloseAnimated
void CloseAnimated()
animates dialog closure
Definition
DialogUI.c:220
ImageWidget
Definition
ImageWidget.c:13
MenuBase
Definition
MenuBase.c:32
MenuManager
Definition
MenuManager.c:13
MenuManager::OpenDialog
proto external MenuBase OpenDialog(ScriptMenuPresetEnum preset, int priority=DialogPriority.INFORMATIVE, int iUserData=0, bool unique=false)
MenuManager::CloseMenuByPreset
proto external bool CloseMenuByPreset(ScriptMenuPresetEnum preset)
Put menu with given iPresetId into queue for closing (which is processed during next MenuManeger upda...
SCR_GamepadRemovalUI
Dialog displayed when the gamepad is removed.
Definition
SCR_GamepadRemovalUI.c:4
SCR_GamepadRemovalUI::OnMenuOpen
override void OnMenuOpen()
Definition
SCR_GamepadRemovalUI.c:19
SCR_GamepadRemovalUI::OnMenuClose
override void OnMenuClose()
Definition
SCR_GamepadRemovalUI.c:43
SCR_GamepadRemovalUI::TEXTURE_XBOX
const string TEXTURE_XBOX
Definition
SCR_GamepadRemovalUI.c:5
SCR_GamepadRemovalUI::CloseGamepadRemovalDialog
static void CloseGamepadRemovalDialog()
Definition
SCR_GamepadRemovalUI.c:113
SCR_GamepadRemovalUI::m_wImage
ImageWidget m_wImage
Definition
SCR_GamepadRemovalUI.c:15
SCR_GamepadRemovalUI::UpdateImage
void UpdateImage()
Definition
SCR_GamepadRemovalUI.c:55
SCR_GamepadRemovalUI::m_OnGamepadRemovalDialogOpen
static ref ScriptInvokerDialog m_OnGamepadRemovalDialogOpen
Definition
SCR_GamepadRemovalUI.c:11
SCR_GamepadRemovalUI::OpenGamepadRemovalDialog
static SCR_GamepadRemovalUI OpenGamepadRemovalDialog()
Definition
SCR_GamepadRemovalUI.c:96
SCR_GamepadRemovalUI::m_OnGamepadRemovalDialogClose
static ref ScriptInvokerDialog m_OnGamepadRemovalDialogClose
Definition
SCR_GamepadRemovalUI.c:12
SCR_GamepadRemovalUI::GetOnGamepadRemovalDialogClose
static ScriptInvokerDialog GetOnGamepadRemovalDialogClose()
Definition
SCR_GamepadRemovalUI.c:123
SCR_GamepadRemovalUI::m_wImageContainer
Widget m_wImageContainer
Definition
SCR_GamepadRemovalUI.c:16
SCR_GamepadRemovalUI::GAMEPAD_ANY_BUTTON_ACTION
const string GAMEPAD_ANY_BUTTON_ACTION
Definition
SCR_GamepadRemovalUI.c:8
SCR_GamepadRemovalUI::KEYBOARD_ANY_BUTTON_ACTION
const string KEYBOARD_ANY_BUTTON_ACTION
Definition
SCR_GamepadRemovalUI.c:9
SCR_GamepadRemovalUI::m_wBackground
Widget m_wBackground
Definition
SCR_GamepadRemovalUI.c:14
SCR_GamepadRemovalUI::TEXTURE_PLAYSTATION
const string TEXTURE_PLAYSTATION
Definition
SCR_GamepadRemovalUI.c:6
System
Definition
System.c:13
Widget
Definition
Widget.c:13
EActionTrigger
EActionTrigger
Definition
EActionTrigger.c:13
EPlatform
EPlatform
Definition
EPlatform.c:13
DialogPriority
DialogPriority
Definition
menuManager.c:5
scripts
Game
UI
Menu
Dialogs
SCR_GamepadRemovalUI.c
Generated by
1.17.0