Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
consoletoolbarhandler.c
Go to the documentation of this file.
2class ConsoleToolbarWidgetHandlerBase : ScriptedWidgetEventHandler
3{
4 Widget m_ToolbarWidget; //'toolbar_bg'
5 RichTextWidget m_ToolbarText;
6
7 void OnWidgetScriptInit(Widget w)
8 {
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
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
37class 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};
void UpdateControlsElements(EInputDeviceType pInputDeviceType=EInputDeviceType.UNKNOWN)
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
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
static const float ICON_SCALE_TOOLBAR
Definition inpututils.c:15
RichTextWidget m_ToolbarText
Widget m_ToolbarWidget
proto native CGame GetGame()
EInputDeviceType
Definition input.c:3
void UpdateControlsElements()