Dayz Explorer
1.28.160049
Loading...
Searching...
No Matches
consoletoolbarhandler.c
Go to the documentation of this file.
1
2
class
ConsoleToolbarWidgetHandlerBase
: ScriptedWidgetEventHandler
3
{
4
Widget m_ToolbarWidget;
//'toolbar_bg'
5
RichTextWidget
m_ToolbarText;
6
7
void
OnWidgetScriptInit(Widget w)
8
{
9
m_ToolbarWidget
= w;
10
m_ToolbarWidget
.SetHandler(
this
);
11
12
m_ToolbarText
=
RichTextWidget
.Cast(
m_ToolbarWidget
.FindAnyWidget(
"ContextToolbarText"
));
13
#ifdef PLATFORM_CONSOLE
14
if
(
GetGame
().GetMission())
15
{
16
GetGame
().GetMission().GetOnInputDeviceChanged().Insert(
OnInputDeviceChanged
);
17
}
18
#endif
19
UpdateControlsElements
();
20
}
21
22
protected
void
OnInputDeviceChanged
(
EInputDeviceType
pInputDeviceType)
23
{
24
#ifdef PLATFORM_CONSOLE
25
UpdateControlsElements
(pInputDeviceType);
26
#endif
27
}
28
29
protected
void
UpdateControlsElements
(
EInputDeviceType
pInputDeviceType =
EInputDeviceType
.UNKNOWN)
30
{
31
#ifndef PLATFORM_CONSOLE
32
m_ToolbarWidget
.Show(
false
);
33
#endif
34
}
35
}
36
37
class
PasswordMenuToolbarHandler :
ConsoleToolbarWidgetHandlerBase
38
{
39
override
protected
void
UpdateControlsElements
(
EInputDeviceType
pInputDeviceType =
EInputDeviceType
.UNKNOWN)
40
{
41
#ifdef PLATFORM_CONSOLE
42
string
text =
""
;
43
text +=
string
.Format(
" %1"
,
InputUtils
.
GetRichtextButtonIconFromInputAction
(
"UAUICtrlY"
,
"#server_browser_show / #server_browser_hide"
, EUAINPUT_DEVICE_CONTROLLER,
InputUtils
.
ICON_SCALE_TOOLBAR
));
44
text +=
string
.Format(
" %1"
,
InputUtils
.
GetRichtextButtonIconFromInputAction
(
"UAUICtrlX"
,
"#server_browser_menu_connect"
, EUAINPUT_DEVICE_CONTROLLER,
InputUtils
.
ICON_SCALE_TOOLBAR
));
45
text +=
string
.Format(
" %1"
,
InputUtils
.
GetRichtextButtonIconFromInputAction
(
"UAUIBack"
,
"#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Back_BackText0"
, EUAINPUT_DEVICE_CONTROLLER,
InputUtils
.
ICON_SCALE_TOOLBAR
));
46
m_ToolbarText
.SetText(text);
47
48
bool
toolbarShow =
false
;
49
if
(pInputDeviceType ==
EInputDeviceType
.UNKNOWN)
50
{
51
toolbarShow = !
GetGame
().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() ||
GetGame
().GetInput().GetCurrentInputDevice() ==
EInputDeviceType
.CONTROLLER;
52
}
53
else
54
{
55
toolbarShow = pInputDeviceType ==
EInputDeviceType
.CONTROLLER;
56
}
57
m_ToolbarWidget
.Show(toolbarShow);
58
#endif
59
}
60
};
ConsoleToolbarWidgetHandlerBase
Definition
consoletoolbarhandler.c:3
ConsoleToolbarWidgetHandlerBase::UpdateControlsElements
void UpdateControlsElements(EInputDeviceType pInputDeviceType=EInputDeviceType.UNKNOWN)
Definition
consoletoolbarhandler.c:29
ConsoleToolbarWidgetHandlerBase::OnInputDeviceChanged
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition
consoletoolbarhandler.c:22
InputUtils
Definition
inpututils.c:2
InputUtils::GetRichtextButtonIconFromInputAction
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition
inpututils.c:167
InputUtils::ICON_SCALE_TOOLBAR
static const float ICON_SCALE_TOOLBAR
Definition
inpututils.c:15
RichTextWidget
Definition
gameplay.c:317
m_ToolbarText
RichTextWidget m_ToolbarText
Definition
consoletoolbarhandler.c:41
m_ToolbarWidget
Widget m_ToolbarWidget
Definition
consoletoolbarhandler.c:40
GetGame
proto native CGame GetGame()
EInputDeviceType
EInputDeviceType
Definition
input.c:3
UpdateControlsElements
void UpdateControlsElements()
Definition
itemdropwarningmenu.c:206
Daten
5_mission
gui
newui
consoletoolbarhandler.c
Generated by
1.12.0