Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
consoletoolbarhandler.c
Go to the documentation of this file.
1 
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 };
m_ToolbarWidget
Widget m_ToolbarWidget
Definition: consoletoolbarhandler.c:2
GetGame
proto native CGame GetGame()
ConsoleToolbarWidgetHandlerBase
Definition: consoletoolbarhandler.c:2
m_ToolbarText
RichTextWidget m_ToolbarText
Definition: consoletoolbarhandler.c:3
InputUtils
Definition: inpututils.c:1
UpdateControlsElements
ConsoleToolbarWidgetHandlerBase ScriptedWidgetEventHandler UpdateControlsElements(EInputDeviceType pInputDeviceType=EInputDeviceType.UNKNOWN)
Definition: consoletoolbarhandler.c:39
EInputDeviceType
EInputDeviceType
Definition: input.c:2
RichTextWidget
Definition: gameplay.c:315
Widget
Definition: enwidgets.c:189
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition: enwidgets.c:650