Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
optionsmenu.c
Go to the documentation of this file.
1 class OptionsMenu extends UIScriptedMenu
2 {
3  const int MODAL_ID_DEFAULT = 100;
4  const int DIALOG_TAB_OFFSET = 1400;
5 
6  protected TabberUI m_Tabber;
7  protected ref OptionsMenuGame m_GameTab;
8  protected ref OptionsMenuSounds m_SoundsTab;
9  protected ref OptionsMenuVideo m_VideoTab;
10  protected ref OptionsMenuControls m_ControlsTab;
11 
12  protected ref GameOptions m_Options;
13 
14  protected ButtonWidget m_Apply;
15  protected ButtonWidget m_Back;
16  protected ButtonWidget m_Reset; //undo
17  protected ButtonWidget m_Defaults; //defaults
18 
19  protected Widget m_Details;
20  protected TextWidget m_Version;
21 
22  protected int m_ActiveTabIdx = 0;
23  protected bool m_ModalLock;
24  protected bool m_CanApplyOrReset;
25  protected bool m_CanToggle;
26 
27  void OptionsMenu()
28  {
29 
30  }
31 
32  override Widget Init()
33  {
34  m_Options = new GameOptions();
35 
36  #ifdef PLATFORM_XBOX
37  layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/xbox/options_menu.layout", null);
38  #else
39  #ifdef PLATFORM_PS4
40  layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/ps/options_menu.layout", null);
41  #else
42  #ifdef PLATFORM_WINDOWS
43  layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/pc/options_menu.layout", null);
44  #endif
45  #endif
46  #endif
47 
48  layoutRoot.FindAnyWidget("Tabber").GetScript(m_Tabber);
49 
50  m_Details = layoutRoot.FindAnyWidget("settings_details");
51  m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget("version"));
52 
53  m_GameTab = new OptionsMenuGame(layoutRoot.FindAnyWidget("Tab_0"), m_Details, m_Options, this);
54  m_SoundsTab = new OptionsMenuSounds(layoutRoot.FindAnyWidget("Tab_1"), m_Details, m_Options, this);
55 
56  #ifdef PLATFORM_XBOX
57  m_ControlsTab = new OptionsMenuControls(layoutRoot.FindAnyWidget("Tab_2"), m_Details, m_Options, this);
58  #else
59  m_VideoTab = new OptionsMenuVideo(layoutRoot.FindAnyWidget("Tab_2"), m_Details, m_Options, this);
60  m_ControlsTab = new OptionsMenuControls(layoutRoot.FindAnyWidget("Tab_3"), m_Details, m_Options, this);
61  #endif
62 
63  m_Apply = ButtonWidget.Cast(layoutRoot.FindAnyWidget("apply"));
64  m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget("back"));
65  m_Reset = ButtonWidget.Cast(layoutRoot.FindAnyWidget("reset"));
66  m_Defaults = ButtonWidget.Cast(layoutRoot.FindAnyWidget("defaults"));
67 
68  m_ModalLock = false;
69  m_CanApplyOrReset = false;
70  m_CanToggle = false;
71 
72  string version;
73  GetGame().GetVersion(version);
74  #ifdef PLATFORM_CONSOLE
75  version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
76  #else
77  version = "#main_menu_version" + " " + version;
78  #endif
79  m_Version.SetText(version);
80 
81  #ifdef PLATFORM_WINDOWS
82  SetFocus(layoutRoot);
83  #else
84  ToggleFocus();
85  #endif
86 
87  m_Tabber.m_OnTabSwitch.Insert(OnTabSwitch);
88  m_Tabber.m_OnAttemptTabSwitch.Insert(OnAttemptTabSwitch);
89 
90  GetGame().GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
91  GetGame().GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
92  OnChanged();
93 
94  return layoutRoot;
95  }
96 
97  void ~OptionsMenu()
98  {
99  }
100 
101  protected void OnInputPresetChanged()
102  {
103  #ifdef PLATFORM_CONSOLE
105  #endif
106  }
107 
108  protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
109  {
110  #ifdef PLATFORM_CONSOLE
112  #endif
113  }
114 
115  override bool OnClick(Widget w, int x, int y, int button)
116  {
117  if (button == MouseState.LEFT)
118  {
119  switch (w)
120  {
121  case m_Apply:
122  {
123  Apply();
124  return true;
125  }
126  case m_Back:
127  {
128  Back();
129  return true;
130  }
131  case m_Reset:
132  {
133  ResetCurrentTab();
134  return true;
135  }
136  case m_Defaults:
137  {
138  //SetToDefaults();
139  PerformSetToDefaults();
140  return true;
141  }
142  }
143  }
144  return false;
145  }
146 
147  void OnTabSwitch(int tab)
148  {
149  switch (tab)
150  {
151  case 0:
152  {
153  m_GameTab.Focus();
154  break;
155  }
156  case 1:
157  {
158  m_SoundsTab.Focus();
159  break;
160  }
161  case 2:
162  {
163  #ifdef PLATFORM_XBOX
164  m_ControlsTab.Focus();
165  #else
166  m_VideoTab.Focus();
167  #endif
168  break;
169  }
170  case 3:
171  {
172  #ifndef PLATFORM_XBOX
173  m_ControlsTab.Focus();
174  #endif
175  break;
176  }
177  }
178 
179  m_ActiveTabIdx = tab;
180  }
181 
182  void Apply()
183  {
184  m_ControlsTab.Apply();
185 
186  if (m_GameTab.IsChanged())
187  {
188  m_GameTab.Apply();
189  }
190 
191  if (m_Options.IsChanged() || m_GameTab.IsChanged())
192  {
193  m_Options.Test();
194  m_Options.Apply();
195  }
196 
197  // save input configuration
198  GetUApi().Export();
199 
200  if (GetGame().GetInput().IsEnabledMouseAndKeyboard()) //useless on consoles
201  {
202  m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
203  ColorDisable(m_Apply);
204  m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
205  ColorDisable(m_Reset);
206  }
207 
208  m_CanApplyOrReset = false;
209  #ifdef PLATFORM_CONSOLE
212 
213  IngameHud hud;
214  if (GetGame().GetMission() && Class.CastTo(hud,GetGame().GetMission().GetHud()))
215  {
216  hud.ShowQuickBar(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
217  }
218  #endif
219 
220  if (m_Options.NeedRestart())
221  g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#menu_restart_needed", 117, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
222  }
223 
224  void Back()
225  {
226  if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
227  {
228  if (IsAnyTabChanged())
229  {
230  g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#main_menu_configure_desc", 1337, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
231  #ifdef PLATFORM_CONSOLE
233  #endif
234  }
235  else
236  {
237  m_Options.Revert();
238  GetGame().EndOptionsVideo();
239  GetGame().GetUIManager().Back();
240  }
241  }
242  }
243 
244  void OnAttemptTabSwitch(int source, int target)
245  {
246  bool changed = IsAnyTabChanged();
247  if (changed)
248  {
249  if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
250  {
251  int id = target + DIALOG_TAB_OFFSET;
252  g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#main_menu_configure_desc", id, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
253  #ifdef PLATFORM_CONSOLE
255  #endif
256  }
257  }
258  else
259  {
260  ResetCurrentTab();
261  }
262 
263  m_Tabber.SetCanSwitch(!changed);
264  }
265 
266  bool IsAnyTabChanged()
267  {
268  bool changed = (m_Options.IsChanged() || m_GameTab.IsChanged() || m_SoundsTab.IsChanged() || m_ControlsTab.IsChanged());
269  #ifndef PLATFORM_XBOX
270  changed |= m_VideoTab.IsChanged();
271  #endif
272 
273  return changed;
274  }
275 
276  void OnChanged()
277  {
278  bool changed = IsAnyTabChanged();
279 
280  if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
281  {
282  if (changed)
283  {
284  m_Reset.ClearFlags(WidgetFlags.IGNOREPOINTER);
285  ColorNormal(m_Reset);
286  m_Apply.ClearFlags(WidgetFlags.IGNOREPOINTER);
287  ColorNormal(m_Apply);
288  }
289  else
290  {
291  m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
292  ColorDisable(m_Apply);
293  m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
294  ColorDisable(m_Reset);
295  }
296  }
297 
298  m_CanApplyOrReset = changed;
299  #ifdef PLATFORM_CONSOLE
302  #endif
303 
304  m_Tabber.AlignTabbers();
305  }
306 
307  //resets it all
308  void Reset()
309  {
310  m_Options.Revert();
311  m_GameTab.Revert();
312  m_SoundsTab.Revert();
313  m_ControlsTab.Revert();
314  #ifndef PLATFORM_XBOX
315  m_VideoTab.Revert();
316  #endif
317 
318  if (m_Options.IsChanged())
319  m_Options.Revert();
320 
321  if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
322  {
323  m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
324  ColorDisable(m_Apply);
325  m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
326  ColorDisable(m_Reset);
327  }
328 
329  m_CanApplyOrReset = false;
330  #ifdef PLATFORM_CONSOLE
333  #endif
334  }
335 
336  void ResetCurrentTab()
337  {
338  if (m_Options.IsChanged())
339  {
340  m_Options.Revert();
341  }
342 
343  switch (m_ActiveTabIdx)
344  {
345  case 0:
346  {
347  m_GameTab.Revert();
348  break;
349  }
350  case 1:
351  {
352  m_SoundsTab.Revert();
353  break;
354  }
355  case 2:
356  {
357  #ifdef PLATFORM_XBOX
358  m_ControlsTab.Revert();
359  #else
360  m_VideoTab.Revert();
361  #endif
362  break;
363  }
364  case 3:
365  {
366  #ifndef PLATFORM_XBOX
367  m_ControlsTab.Revert();
368  #endif
369  break;
370  }
371  }
372 
373  if (m_Options.IsChanged())
374  {
375  m_Options.Revert();
376  }
377 
378  if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
379  {
380  m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
381  ColorDisable(m_Apply);
382  m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
383  ColorDisable(m_Reset);
384  }
385 
386  m_CanApplyOrReset = false;
387  #ifdef PLATFORM_CONSOLE
390  #endif
391 
392  m_Tabber.AlignTabbers();
393  }
394 
395  void SetToDefaults()
396  {
397  if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
398  {
399  g_Game.GetUIManager().ShowDialog("#menu_default_cap", "TODO - reset options to default", MODAL_ID_DEFAULT, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
400  }
401  }
402 
403  void PerformSetToDefaults()
404  {
405  switch (m_ActiveTabIdx)
406  {
407  case 0:
408  m_GameTab.SetToDefaults();
409  break;
410 
411  case 1:
412  m_SoundsTab.SetToDefaults();
413  break;
414 
415  case 2:
416  #ifdef PLATFORM_XBOX
417  m_ControlsTab.SetToDefaults();
418  #else
419  m_VideoTab.SetToDefaults();
420  #endif
421  break;
422 
423  case 3:
424  #ifndef PLATFORM_XBOX
425  m_ControlsTab.SetToDefaults();
426  #endif
427  break;
428  }
429 
430  if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
431  {
432  m_Reset.ClearFlags(WidgetFlags.IGNOREPOINTER);
433  ColorNormal(m_Reset);
434  m_Apply.ClearFlags(WidgetFlags.IGNOREPOINTER);
435  ColorNormal(m_Apply);
436  }
437 
438  m_CanApplyOrReset = true;
439  #ifdef PLATFORM_CONSOLE
442  #endif
443  }
444 
445  void SliderFocus()
446  {
447  #ifdef PLATFORM_CONSOLE
448  m_CanToggle = false;
450  #endif
451  }
452 
453  void ToggleFocus()
454  {
455  #ifdef PLATFORM_CONSOLE
456  m_CanToggle = true;
458  #endif
459  }
460 
462  void ToggleDependentOptions(int mode, bool state)
463  {
464  m_GameTab.ToggleDependentOptions(mode,state);
465  m_SoundsTab.ToggleDependentOptions(mode,state);
466  m_ControlsTab.ToggleDependentOptions(mode,state);
467  #ifndef PLATFORM_XBOX
468  m_VideoTab.ToggleDependentOptions(mode,state);
469  #endif
470  }
471 
472  void ReloadOptions()
473  {
474  m_Options = new GameOptions();
475 
476  if (m_GameTab)
477  m_GameTab.SetOptions(m_Options);
478  if (m_SoundsTab)
479  m_SoundsTab.SetOptions(m_Options);
480  if (m_ControlsTab)
481  m_ControlsTab.SetOptions(m_Options);
482 
483  #ifndef PLATFORM_XBOX
484  if (m_VideoTab)
485  m_VideoTab.SetOptions(m_Options);
486  #endif
487  }
488 
489  void ReloadVideoOptions()
490  {
491  #ifndef PLATFORM_XBOX
492  if (m_VideoTab)
493  m_VideoTab.SetOptions(m_Options);
494  #endif
495  }
496 
497  override bool OnModalResult(Widget w, int x, int y, int code, int result)
498  {
499  bool ret = false;
500 
501  if (code == 1337)
502  {
503  if (result == 2)
504  {
505  m_Options.Revert();
506  GetGame().EndOptionsVideo();
507  GetGame().GetUIManager().Back();
508  }
509  ret = true;
510  }
511  else if (code == 117)
512  {
513  g_Game.RequestRestart(IDC_MAIN_QUIT);
514  }
515  else if (code == MODAL_ID_DEFAULT)
516  {
517  if (result == 2)
518  {
519  PerformSetToDefaults();
520  }
521  }
522  else if (code >= DIALOG_TAB_OFFSET)
523  {
524  if (result == 2)
525  {
526  int id = code - DIALOG_TAB_OFFSET;
527  //m_Options.Revert();
528  ResetCurrentTab();
529  m_Tabber.PerformSwitchTab(id);
530  }
531  ret = true;
532  }
533 
534  m_ModalLock = ret; //prevents dialog being shown on the next update
535  return ret;
536  }
537 
538  override bool OnMouseEnter(Widget w, int x, int y)
539  {
540  if (w && IsFocusable(w))
541  {
542  ColorHighlight(w);
543  return true;
544  }
545  return false;
546  }
547 
548  override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
549  {
550  if (w && IsFocusable(w))
551  {
552  ColorNormal(w);
553  return true;
554  }
555  return false;
556  }
557 
558  override bool OnFocus(Widget w, int x, int y)
559  {
560  if (w && IsFocusable(w))
561  {
562  ColorHighlight(w);
563  return true;
564  }
565  else if (y == 1)
566  {
567  SliderFocus();
568  }
569  else
570  {
571  ToggleFocus();
572  }
573 
574  return false;
575  }
576 
577  override bool OnFocusLost(Widget w, int x, int y)
578  {
579  if (w && IsFocusable(w))
580  {
581  ColorNormal(w);
582  return true;
583  }
584  return false;
585  }
586 
587  bool IsFocusable(Widget w)
588  {
589  if (w)
590  {
591  return (w == m_Apply || w == m_Back || w == m_Reset || w == m_Defaults);
592  }
593  return false;
594  }
595 
596  override void Refresh()
597  {
598  string version;
599  GetGame().GetVersion(version);
600  #ifdef PLATFORM_CONSOLE
601  version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
602  #else
603  version = "#main_menu_version" + " " + version;
604  #endif
605 
606  m_Version.SetText(version);
607 
608  #ifdef PLATFORM_CONSOLE
611  #endif
612  }
613 
614  override void OnShow()
615  {
616  super.OnShow();
617  m_GameTab.Focus();
618  Refresh();
619  }
620 
621  override void Update(float timeslice)
622  {
623  super.Update(timeslice);
624 
625  if (m_ModalLock)
626  {
627  m_ModalLock = false;
628  #ifdef PLATFORM_CONSOLE
630  #endif
631  return;
632  }
633 
634  if (g_Game.GetUIManager().IsDialogVisible())
635  {
636  return;
637  }
638 
639  if (GetUApi().GetInputByID(UAUITabLeft).LocalPress())
640  {
641  m_Tabber.PreviousTab();
642  }
643  else if (GetUApi().GetInputByID(UAUITabRight).LocalPress())
644  {
645  m_Tabber.NextTab();
646  }
647  else if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
648  {
649  if (m_CanApplyOrReset)
650  {
651  Apply();
652  }
653  }
654  else if (GetUApi().GetInputByID(UAUICredits).LocalPress())
655  {
656  if (m_CanApplyOrReset)
657  {
658  ResetCurrentTab();
659  }
660 
661  }
662  else if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
663  {
664  PerformSetToDefaults();
665  }
666  else if (GetUApi().GetInputByID(UAUIBack).LocalPress())
667  {
668  Back();
669  }
670  }
671 
672  //Coloring functions (Until WidgetStyles are useful)
673  void ColorHighlight(Widget w)
674  {
675  if ((w.GetFlags() & WidgetFlags.IGNOREPOINTER) == WidgetFlags.IGNOREPOINTER)
676  {
677  return;
678  }
679 
680  if (w.IsInherited(ButtonWidget))
681  {
682  ButtonWidget button = ButtonWidget.Cast(w);
683  button.SetTextColor(ARGB(255, 200, 0, 0));
684  }
685 
686  w.SetColor(ARGB(255, 0, 0, 0));
687 
688  TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
689  TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
690  TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
691  ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
692  Widget option = Widget.Cast(w.FindAnyWidget(w.GetName() + "_option_wrapper"));
693  Widget option_label = w.FindAnyWidget("option_label");
694 
695  if (text1)
696  {
697  text1.SetColor(ARGB(255, 255, 0, 0));
698  }
699 
700  if (text2)
701  {
702  text2.SetColor(ARGB(255, 255, 0, 0));
703  }
704 
705  if (text3)
706  {
707  text3.SetColor(ARGB(255, 255, 0, 0));
708  w.SetAlpha(1);
709  }
710 
711  if (image)
712  {
713  image.SetColor(ARGB(255, 200, 0, 0));
714  }
715 
716  if (option)
717  {
718  option.SetColor(ARGB(255, 255, 0, 0));
719  }
720 
721  if (option_label)
722  {
723  option_label.SetColor(ARGB(255, 255, 0, 0));
724  }
725  }
726 
727  void ColorNormal(Widget w)
728  {
729  if ((w.GetFlags() & WidgetFlags.IGNOREPOINTER) == WidgetFlags.IGNOREPOINTER)
730  {
731  return;
732  }
733 
734  if (w.IsInherited(ButtonWidget))
735  {
736  ButtonWidget button = ButtonWidget.Cast(w);
737  button.SetTextColor(ARGB(255, 255, 255, 255));
738  }
739 
740  TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
741  TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
742  TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
743  ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
744  Widget option = w.FindAnyWidget(w.GetName() + "_option_wrapper");
745  Widget option_label = w.FindAnyWidget("option_label");
746 
747  if (text1)
748  {
749  text1.SetColor(ARGB(255, 255, 255, 255));
750  }
751 
752  if (text2)
753  {
754  text2.SetColor(ARGB(255, 255, 255, 255));
755  }
756 
757  if (text3)
758  {
759  text3.SetColor(ARGB(255, 255, 255, 255));
760  w.SetAlpha(0);
761  }
762 
763  if (image)
764  {
765  image.SetColor(ARGB(255, 255, 255, 255));
766  }
767 
768  if (option)
769  {
770  option.SetColor(ARGB(150, 255, 255, 255));
771  }
772 
773  if (option_label)
774  {
775  option_label.SetColor(ARGB(255, 255, 255, 255));
776  }
777  }
778 
779  void ColorDisable(Widget w)
780  {
781  #ifdef PLATFORM_WINDOWS
782  SetFocus(null);
783  #endif
784 
785  if (w)
786  {
787  ButtonWidget button = ButtonWidget.Cast(w);
788  if (button)
789  {
790  button.SetTextColor(ColorManager.COLOR_DISABLED_TEXT);
791  }
792  }
793  }
794 
795  protected void UpdateControlsElements()
796  {
797  #ifdef PLATFORM_CONSOLE
798  RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
799  string text = "";
800  if (g_Game.GetUIManager().IsDialogVisible() || g_Game.GetUIManager().IsDialogQueued())
801  {
802  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#dialog_confirm", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
803 
804  }
805  else
806  {
807  if (m_CanToggle)
808  {
809  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#dialog_change", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
810  }
811  if (m_CanApplyOrReset)
812  {
813  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Apply_ApplyText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
814  }
815  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "#menu_default", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
816  if (m_CanApplyOrReset)
817  {
818  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICredits", "#menu_undo", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
819  }
820  }
821  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Back_BackText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
822  toolbar_text.SetText(text);
823 
824  RichTextWidget toolbar_b2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon0"));
825  RichTextWidget toolbar_x2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ApplyIcon0"));
826  RichTextWidget toolbar_y2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ResetIcon0"));
827  RichTextWidget toolbar_def2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("DefaultIcon0"));
828  toolbar_b2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER));
829  toolbar_x2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "", EUAINPUT_DEVICE_CONTROLLER));
830  toolbar_y2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICredits", "", EUAINPUT_DEVICE_CONTROLLER));
831  toolbar_def2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "", EUAINPUT_DEVICE_CONTROLLER));
832  #endif
833  }
834 
835  protected void UpdateControlsElementVisibility()
836  {
837  bool toolbarShow = false;
838  #ifdef PLATFORM_CONSOLE
839  toolbarShow = !GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
840  #endif
841 
842  layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
843  layoutRoot.FindAnyWidget("play_panel_root").Show(!toolbarShow);
844  }
845 }
GetGame
proto native CGame GetGame()
UIScriptedMenu
Definition: dayzgame.c:63
InputUtils
Definition: inpututils.c:1
Back
void Back()
Definition: controlsxbox.c:36
UpdateControlsElements
protected void UpdateControlsElements()
Definition: itemdropwarningmenu.c:92
y
Icon y
GameOptions
Definition: gameplay.c:1420
Refresh
void Refresh()
Definition: sizetochild.c:108
ColorDisable
void ColorDisable(Widget w)
Definition: serverbrowsertab.c:720
OnInputDeviceChanged
protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition: inventory.c:167
EInputDeviceType
EInputDeviceType
Definition: input.c:2
OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition: uihintpanel.c:276
RichTextWidget
Definition: gameplay.c:315
IDC_MAIN_QUIT
const int IDC_MAIN_QUIT
Definition: constants.c:136
m_Back
protected ButtonWidget m_Back
Definition: controlsxbox.c:17
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
TextWidget
Definition: enwidgets.c:219
ColorNormal
void ColorNormal(Widget w)
Definition: serverbrowsertab.c:668
UpdateControlsElementVisibility
protected void UpdateControlsElementVisibility()
Definition: itemdropwarningmenu.c:100
ColorManager
Definition: colormanager.c:1
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
ColorHighlight
void ColorHighlight(Widget w)
Definition: serverbrowsertab.c:619
OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition: serverbrowsertab.c:235
MouseState
MouseState
Definition: ensystem.c:310
Update
proto native volatile void Update()
Definition: playersoundmanager.c:125
SetFocus
proto native void SetFocus(Widget w)
x
Icon x
Reset
void Reset()
Definition: inventory.c:1106
WidgetFlags
WidgetFlags
Definition: enwidgets.c:57
OnInputPresetChanged
protected void OnInputPresetChanged()
Definition: inventory.c:160
OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition: serverbrowsertab.c:217
OnShow
override void OnShow()
Definition: controlsxbox.c:349
Widget
Definition: enwidgets.c:189
GetUApi
proto native UAInputAPI GetUApi()
GetInput
ActionInput GetInput()
Definition: actionbase.c:1066
OnClick
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition: dayzgame.c:146
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition: uihintpanel.c:267
ARGB
int ARGB(int a, int r, int g, int b)
Definition: proto.c:322
IsFocusable
bool IsFocusable(Widget w)
Definition: serverbrowsertab.c:284