Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
optionsmenu.c
Go to the documentation of this file.
1class 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 #ifdef PLATFORM_MSSTORE
28 protected ButtonWidget m_GamepadControls;
29 protected ButtonWidget m_KeyboardBindings;
30 #endif
31
33 {
34
35 }
36
37 override Widget Init()
38 {
39 m_Options = new GameOptions();
40
41 #ifdef PLATFORM_MSSTORE
42 layoutRoot = g_Game.GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/msstore/options_menu.layout", null);
43 #else
44 #ifdef PLATFORM_XBOX
45 layoutRoot = g_Game.GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/xbox/options_menu.layout", null);
46 #else
47 #ifdef PLATFORM_PS4
48 layoutRoot = g_Game.GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/ps/options_menu.layout", null);
49 #else
50 #ifdef PLATFORM_WINDOWS
51 layoutRoot = g_Game.GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/pc/options_menu.layout", null);
52 #endif
53 #endif
54 #endif
55 #endif
56
57 layoutRoot.FindAnyWidget("Tabber").GetScript(m_Tabber);
58
59 m_Details = layoutRoot.FindAnyWidget("settings_details");
60 m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget("version"));
61
62 m_GameTab = new OptionsMenuGame(layoutRoot.FindAnyWidget("Tab_0"), m_Details, m_Options, this);
63 m_SoundsTab = new OptionsMenuSounds(layoutRoot.FindAnyWidget("Tab_1"), m_Details, m_Options, this);
64
65 #ifdef PLATFORM_MSSTORE
66 m_VideoTab = new OptionsMenuVideo(layoutRoot.FindAnyWidget("Tab_2"), m_Details, m_Options, this);
67 m_ControlsTab = new OptionsMenuControls(layoutRoot.FindAnyWidget("Tab_3"), m_Details, m_Options, this);
68 m_GamepadControls = ButtonWidget.Cast(layoutRoot.FindAnyWidget("gamepad_controls"));
69 m_KeyboardBindings = ButtonWidget.Cast(layoutRoot.FindAnyWidget("keyboard_bindings"));
70 #else
71 #ifdef PLATFORM_XBOX
72 m_ControlsTab = new OptionsMenuControls(layoutRoot.FindAnyWidget("Tab_2"), m_Details, m_Options, this);
73 #else
74 m_VideoTab = new OptionsMenuVideo(layoutRoot.FindAnyWidget("Tab_2"), m_Details, m_Options, this);
75 m_ControlsTab = new OptionsMenuControls(layoutRoot.FindAnyWidget("Tab_3"), m_Details, m_Options, this);
76 #endif
77 #endif
78
79 m_Apply = ButtonWidget.Cast(layoutRoot.FindAnyWidget("apply"));
80 m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget("back"));
81 m_Reset = ButtonWidget.Cast(layoutRoot.FindAnyWidget("reset"));
82 m_Defaults = ButtonWidget.Cast(layoutRoot.FindAnyWidget("defaults"));
83
84 m_ModalLock = false;
85 m_CanApplyOrReset = false;
86 m_CanToggle = false;
87
88 string version;
89 g_Game.GetVersion(version);
90 #ifdef PLATFORM_CONSOLE
91 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
92 #else
93 version = "#main_menu_version" + " " + version;
94 #endif
95 m_Version.SetText(version);
96
97 #ifdef PLATFORM_WINDOWS
98 SetFocus(layoutRoot);
99 #else
100 ToggleFocus();
101 #endif
102
103 m_Tabber.m_OnTabSwitch.Insert(OnTabSwitch);
104 m_Tabber.m_OnAttemptTabSwitch.Insert(OnAttemptTabSwitch);
105
106 g_Game.GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
107 g_Game.GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
108 OnChanged();
109
110 return layoutRoot;
111 }
112
114 {
115 }
116
117 protected void OnInputPresetChanged()
118 {
119 #ifdef PLATFORM_CONSOLE
121 #endif
122 }
123
124 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
125 {
126 #ifdef PLATFORM_CONSOLE
127 bool mk = g_Game.GetInput().IsEnabledMouseAndKeyboard();
128 bool mkServer = g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
129
130 switch (pInputDeviceType)
131 {
132 case EInputDeviceType.CONTROLLER:
133 if (mk && mkServer)
134 {
135 g_Game.GetUIManager().ShowUICursor(false);
136 }
137 break;
138
139 default:
140 if (mk && mkServer)
141 {
142 g_Game.GetUIManager().ShowUICursor(true);
143 }
144 break;
145 }
146
148 #endif
149 }
150
151 override bool OnClick(Widget w, int x, int y, int button)
152 {
153 if (button == MouseState.LEFT)
154 {
155 switch (w)
156 {
157 #ifdef PLATFORM_MSSTORE
158 case m_GamepadControls:
159 {
160 EnterScriptedMenu(MENU_XBOX_CONTROLS);
161 return true;
162 }
163
164 case m_KeyboardBindings:
165 {
166 EnterScriptedMenu( MENU_KEYBINDINGS );
167 return true;
168 }
169 #endif
170
171 case m_Apply:
172 {
173 Apply();
174 return true;
175 }
176 case m_Back:
177 {
178 Back();
179 return true;
180 }
181 case m_Reset:
182 {
184 return true;
185 }
186 case m_Defaults:
187 {
188 //SetToDefaults();
190 return true;
191 }
192 }
193 }
194 return false;
195 }
196
197 void OnTabSwitch(int tab)
198 {
199 switch (tab)
200 {
201 case 0:
202 {
203 m_GameTab.Focus();
204 break;
205 }
206 case 1:
207 {
208 m_SoundsTab.Focus();
209 break;
210 }
211 case 2:
212 {
213 #ifdef PLATFORM_XBOX
214 m_ControlsTab.Focus();
215 #else
216 m_VideoTab.Focus();
217 #endif
218 break;
219 }
220 case 3:
221 {
222 #ifndef PLATFORM_XBOX
223 m_ControlsTab.Focus();
224 #endif
225 break;
226 }
227 }
228
229 m_ActiveTabIdx = tab;
230 }
231
232 void Apply()
233 {
234 if (m_ControlsTab.IsChanged())
235 m_ControlsTab.Apply();
236
237 if (m_SoundsTab.IsChanged())
238 m_SoundsTab.Apply();
239
240 if (m_GameTab.IsChanged())
241 m_GameTab.Apply();
242
243 if (m_Options.IsChanged() || m_GameTab.IsChanged())
244 {
245 m_Options.Test();
246 m_Options.Apply();
247 }
248
249 // save input configuration
250 GetUApi().Export();
251
252 if (g_Game.GetInput().IsEnabledMouseAndKeyboard()) //useless on consoles
253 {
254 m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
256 m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
258 }
259
260 m_CanApplyOrReset = false;
261 #ifdef PLATFORM_CONSOLE
264
265 IngameHud hud;
266 if (g_Game.GetMission() && Class.CastTo(hud,g_Game.GetMission().GetHud()))
267 {
268 hud.ShowQuickBar(g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
269 }
270 #endif
271
272 if (m_Options.NeedRestart())
273 g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#menu_restart_needed", 117, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
274 }
275
276 void Back()
277 {
278 if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
279 {
280 if (IsAnyTabChanged())
281 {
282 g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#main_menu_configure_desc", 1337, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
283 #ifdef PLATFORM_CONSOLE
285 #endif
286 }
287 else
288 {
289 m_Options.Revert();
290 g_Game.EndOptionsVideo();
291 g_Game.GetUIManager().Back();
292 }
293 }
294 }
295
296 void OnAttemptTabSwitch(int source, int target)
297 {
298 bool changed = IsAnyTabChanged();
299 if (changed)
300 {
301 if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
302 {
303 int id = target + DIALOG_TAB_OFFSET;
304 g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#main_menu_configure_desc", id, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
305 #ifdef PLATFORM_CONSOLE
307 #endif
308 }
309 }
310 else
311 {
313 }
314
315 m_Tabber.SetCanSwitch(!changed);
316 }
317
319 {
320 bool changed = (m_Options.IsChanged() || m_GameTab.IsChanged() || m_SoundsTab.IsChanged() || m_ControlsTab.IsChanged());
321 #ifndef PLATFORM_XBOX
322 changed |= m_VideoTab.IsChanged();
323 #endif
324
325 return changed;
326 }
327
329 {
330 bool changed = IsAnyTabChanged();
331
332 if (g_Game.GetInput().IsEnabledMouseAndKeyboard())
333 {
334 if (changed)
335 {
336 m_Reset.ClearFlags(WidgetFlags.IGNOREPOINTER);
338 m_Apply.ClearFlags(WidgetFlags.IGNOREPOINTER);
340 }
341 else
342 {
343 m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
345 m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
347 }
348 }
349
350 m_CanApplyOrReset = changed;
351 #ifdef PLATFORM_CONSOLE
354 #endif
355
356 m_Tabber.AlignTabbers();
357 }
358
359 //resets it all
360 void Reset()
361 {
362 m_Options.Revert();
363 m_GameTab.Revert();
364 m_SoundsTab.Revert();
365 m_ControlsTab.Revert();
366 #ifndef PLATFORM_XBOX
367 m_VideoTab.Revert();
368 #endif
369
370 if (m_Options.IsChanged())
371 m_Options.Revert();
372
373 if (g_Game.GetInput().IsEnabledMouseAndKeyboard())
374 {
375 m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
377 m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
379 }
380
381 m_CanApplyOrReset = false;
382 #ifdef PLATFORM_CONSOLE
385 #endif
386 }
387
389 {
390 if (m_Options.IsChanged())
391 {
392 m_Options.Revert();
393 }
394
395 switch (m_ActiveTabIdx)
396 {
397 case 0:
398 {
399 m_GameTab.Revert();
400 break;
401 }
402 case 1:
403 {
404 m_SoundsTab.Revert();
405 break;
406 }
407 case 2:
408 {
409 #ifdef PLATFORM_XBOX
410 m_ControlsTab.Revert();
411 #else
412 m_VideoTab.Revert();
413 #endif
414 break;
415 }
416 case 3:
417 {
418 #ifndef PLATFORM_XBOX
419 m_ControlsTab.Revert();
420 #endif
421 break;
422 }
423 }
424
425 if (m_Options.IsChanged())
426 {
427 m_Options.Revert();
428 }
429
430 if (g_Game.GetInput().IsEnabledMouseAndKeyboard())
431 {
432 m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
434 m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
436 }
437
438 m_CanApplyOrReset = false;
439 #ifdef PLATFORM_CONSOLE
442 #endif
443
444 m_Tabber.AlignTabbers();
445 }
446
448 {
449 if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
450 {
451 g_Game.GetUIManager().ShowDialog("#menu_default_cap", "TODO - reset options to default", MODAL_ID_DEFAULT, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
452 }
453 }
454
456 {
457 switch (m_ActiveTabIdx)
458 {
459 case 0:
460 m_GameTab.Focus();
461 break;
462
463 case 1:
464 m_SoundsTab.Focus();
465 break;
466
467 case 2:
468 #ifdef PLATFORM_XBOX
469 m_ControlsTab.Focus();
470 #else
471 m_VideoTab.Focus();
472 #endif
473 break;
474
475 case 3:
476 #ifndef PLATFORM_XBOX
477 m_ControlsTab.Focus();
478 #endif
479 break;
480 }
481 }
482
484 {
485 switch (m_ActiveTabIdx)
486 {
487 case 0:
488 m_GameTab.SetToDefaults();
489 break;
490
491 case 1:
492 m_SoundsTab.SetToDefaults();
493 break;
494
495 case 2:
496 #ifdef PLATFORM_XBOX
497 m_ControlsTab.SetToDefaults();
498 #else
499 m_VideoTab.SetToDefaults();
500 #endif
501 break;
502
503 case 3:
504 #ifndef PLATFORM_XBOX
505 m_ControlsTab.SetToDefaults();
506 #endif
507 break;
508 }
509
510 if (g_Game.GetInput().IsEnabledMouseAndKeyboard())
511 {
512 m_Reset.ClearFlags(WidgetFlags.IGNOREPOINTER);
514 m_Apply.ClearFlags(WidgetFlags.IGNOREPOINTER);
516 }
517
518 m_CanApplyOrReset = true;
519 #ifdef PLATFORM_CONSOLE
522 #endif
523 }
524
526 {
527 #ifdef PLATFORM_CONSOLE
528 m_CanToggle = false;
530 #endif
531 }
532
534 {
535 #ifdef PLATFORM_CONSOLE
536 m_CanToggle = true;
538 #endif
539 }
540
542 void ToggleDependentOptions(int mode, bool state)
543 {
544 m_GameTab.ToggleDependentOptions(mode,state);
545 m_SoundsTab.ToggleDependentOptions(mode,state);
546 m_ControlsTab.ToggleDependentOptions(mode,state);
547 #ifndef PLATFORM_XBOX
548 m_VideoTab.ToggleDependentOptions(mode,state);
549 #endif
550 }
551
553 {
554 m_Options = new GameOptions();
555
556 if (m_GameTab)
557 m_GameTab.SetOptions(m_Options);
558 if (m_SoundsTab)
559 m_SoundsTab.SetOptions(m_Options);
560 if (m_ControlsTab)
561 m_ControlsTab.SetOptions(m_Options);
562
563 #ifndef PLATFORM_XBOX
564 if (m_VideoTab)
565 m_VideoTab.SetOptions(m_Options);
566 #endif
567 }
568
570 {
571 #ifndef PLATFORM_XBOX
572 if (m_VideoTab)
573 m_VideoTab.SetOptions(m_Options);
574 #endif
575 }
576
577 override bool OnModalResult(Widget w, int x, int y, int code, int result)
578 {
579 bool ret = false;
580
581 if (code == 1337)
582 {
583 if (result == 2)
584 {
585 m_Options.Revert();
586 g_Game.EndOptionsVideo();
587 g_Game.GetUIManager().Back();
588 }
589 ret = true;
590 }
591 else if (code == 117)
592 {
593 g_Game.RequestRestart(IDC_MAIN_QUIT);
594 }
595 else if (code == MODAL_ID_DEFAULT)
596 {
597 if (result == 2)
598 {
600 }
601 }
602 else if (code >= DIALOG_TAB_OFFSET)
603 {
604 if (result == 2)
605 {
606 int id = code - DIALOG_TAB_OFFSET;
607 //m_Options.Revert();
609 m_Tabber.PerformSwitchTab(id);
610 }
611 ret = true;
612 }
613
614 m_ModalLock = ret; //prevents dialog being shown on the next update
615 return ret;
616 }
617
618 override bool OnMouseEnter(Widget w, int x, int y)
619 {
620 if (w && IsFocusable(w))
621 {
623 return true;
624 }
625 return false;
626 }
627
628 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
629 {
630 if (w && IsFocusable(w))
631 {
632 ColorNormal(w);
633 return true;
634 }
635 return false;
636 }
637
638 override bool OnFocus(Widget w, int x, int y)
639 {
640 if (w && IsFocusable(w))
641 {
643 return true;
644 }
645 else if (y == 1)
646 {
647 SliderFocus();
648 }
649 else
650 {
651 ToggleFocus();
652 }
653
654 return false;
655 }
656
657 override bool OnFocusLost(Widget w, int x, int y)
658 {
659 if (w && IsFocusable(w))
660 {
661 ColorNormal(w);
662 return true;
663 }
664 return false;
665 }
666
668 {
669 if (w)
670 {
671 return (w == m_Apply || w == m_Back || w == m_Reset || w == m_Defaults);
672 }
673 return false;
674 }
675
676 override void Refresh()
677 {
678 string version;
679 g_Game.GetVersion(version);
680 #ifdef PLATFORM_CONSOLE
681 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
682 #else
683 version = "#main_menu_version" + " " + version;
684 #endif
685
686 m_Version.SetText(version);
687
688 #ifdef PLATFORM_CONSOLE
689 OnInputDeviceChanged(g_Game.GetInput().GetCurrentInputDevice());
691 #endif
692 }
693
694 override void OnShow()
695 {
696 super.OnShow();
697 #ifdef PLATFORM_MSSTORE
698 // MSStore: When going back from keybindings/gamepad controls, game tab somehow gained focus.
699 // Focus last active tab
701 #else
702 m_GameTab.Focus();
703 #endif
704 Refresh();
705 }
706
707 override void Update(float timeslice)
708 {
709 super.Update(timeslice);
710
711 if (m_ModalLock)
712 {
713 m_ModalLock = false;
714 #ifdef PLATFORM_CONSOLE
716 #endif
717 return;
718 }
719
720 if (g_Game.GetUIManager().IsDialogVisible())
721 {
722 return;
723 }
724
725 if (GetUApi().GetInputByID(UAUITabLeft).LocalPress())
726 {
727 m_Tabber.PreviousTab();
728 }
729 else if (GetUApi().GetInputByID(UAUITabRight).LocalPress())
730 {
731 m_Tabber.NextTab();
732 }
733 else if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
734 {
736 {
737 Apply();
738 }
739 }
740 else if (GetUApi().GetInputByID(UAUICredits).LocalPress())
741 {
743 {
745 }
746
747 }
748 else if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
749 {
751 }
752 else if (GetUApi().GetInputByID(UAUIBack).LocalPress())
753 {
754 Back();
755 }
756 }
757
758 //Coloring functions (Until WidgetStyles are useful)
760 {
761 if ((w.GetFlags() & WidgetFlags.IGNOREPOINTER) == WidgetFlags.IGNOREPOINTER)
762 {
763 return;
764 }
765
766 if (w.IsInherited(ButtonWidget))
767 {
768 ButtonWidget button = ButtonWidget.Cast(w);
769 button.SetTextColor(ARGB(255, 200, 0, 0));
770 }
771
772 w.SetColor(ARGB(255, 0, 0, 0));
773
774 TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
775 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
776 TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
777 ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
778 Widget option = Widget.Cast(w.FindAnyWidget(w.GetName() + "_option_wrapper"));
779 Widget option_label = w.FindAnyWidget("option_label");
780
781 if (text1)
782 {
783 text1.SetColor(ARGB(255, 255, 0, 0));
784 }
785
786 if (text2)
787 {
788 text2.SetColor(ARGB(255, 255, 0, 0));
789 }
790
791 if (text3)
792 {
793 text3.SetColor(ARGB(255, 255, 0, 0));
794 w.SetAlpha(1);
795 }
796
797 if (image)
798 {
799 image.SetColor(ARGB(255, 200, 0, 0));
800 }
801
802 if (option)
803 {
804 option.SetColor(ARGB(255, 255, 0, 0));
805 }
806
807 if (option_label)
808 {
809 option_label.SetColor(ARGB(255, 255, 0, 0));
810 }
811 }
812
814 {
815 if ((w.GetFlags() & WidgetFlags.IGNOREPOINTER) == WidgetFlags.IGNOREPOINTER)
816 {
817 return;
818 }
819
820 if (w.IsInherited(ButtonWidget))
821 {
822 ButtonWidget button = ButtonWidget.Cast(w);
823 button.SetTextColor(ARGB(255, 255, 255, 255));
824 }
825
826 TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
827 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
828 TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
829 ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
830 Widget option = w.FindAnyWidget(w.GetName() + "_option_wrapper");
831 Widget option_label = w.FindAnyWidget("option_label");
832
833 if (text1)
834 {
835 text1.SetColor(ARGB(255, 255, 255, 255));
836 }
837
838 if (text2)
839 {
840 text2.SetColor(ARGB(255, 255, 255, 255));
841 }
842
843 if (text3)
844 {
845 text3.SetColor(ARGB(255, 255, 255, 255));
846 w.SetAlpha(0);
847 }
848
849 if (image)
850 {
851 image.SetColor(ARGB(255, 255, 255, 255));
852 }
853
854 if (option)
855 {
856 option.SetColor(ARGB(150, 255, 255, 255));
857 }
858
859 if (option_label)
860 {
861 option_label.SetColor(ARGB(255, 255, 255, 255));
862 }
863 }
864
866 {
867 #ifdef PLATFORM_WINDOWS
868 SetFocus(null);
869 #endif
870
871 if (w)
872 {
873 ButtonWidget button = ButtonWidget.Cast(w);
874 if (button)
875 {
876 button.SetTextColor(ColorManager.COLOR_DISABLED_TEXT);
877 }
878 }
879 }
880
881 protected void UpdateControlsElements()
882 {
883 #ifdef PLATFORM_CONSOLE
884 RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
885 string text = "";
886 if (g_Game.GetUIManager().IsDialogVisible() || g_Game.GetUIManager().IsDialogQueued())
887 {
888 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#dialog_confirm", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
889
890 }
891 else
892 {
893 if (m_CanToggle)
894 {
895 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#dialog_change", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
896 }
898 {
899 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Apply_ApplyText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
900 }
901 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "#menu_default", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
903 {
904 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICredits", "#menu_undo", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
905 }
906 }
907 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Back_BackText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
908 toolbar_text.SetText(text);
909 #endif
910 }
911
913 {
914 bool toolbarShow = false;
915 #ifdef PLATFORM_CONSOLE
916 toolbarShow = !g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || g_Game.GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
917 #endif
918
919 layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
920 layoutRoot.FindAnyWidget("play_panel_root").Show(!toolbarShow);
921 }
922}
Super root of all classes in Enforce script.
Definition enscript.c:11
static int COLOR_DISABLED_TEXT
static const float ICON_SCALE_TOOLBAR
Definition inpututils.c:15
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
proto native void Export()
Xbox menu.
Definition dayzgame.c:64
void OnInputPresetChanged()
void SetToDefaults()
void UpdateControlsElementVisibility()
override void Update(float timeslice)
ButtonWidget m_Reset
ref OptionsMenuControls m_ControlsTab
Definition optionsmenu.c:10
void ColorDisable(Widget w)
Definition ingamemenu.c:383
override void Refresh()
bool m_CanApplyOrReset
Definition optionsmenu.c:24
void ReloadVideoOptions()
ref OptionsMenuSounds m_SoundsTab
Definition optionsmenu.c:8
override void OnShow()
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
const int MODAL_ID_DEFAULT
ref OptionsMenuVideo m_VideoTab
Definition optionsmenu.c:9
void PerformSetToDefaults()
deprecated, resets all (as before ~1.20)
void ReloadOptions()
TextWidget m_Version
void OnAttemptTabSwitch(int source, int target)
void Apply()
renames character
ButtonWidget m_Back
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
void ColorNormal(Widget w)
ButtonWidget m_Defaults
void ResetCurrentTab()
void OnTabSwitch(int tab)
override Widget Init()
Definition optionsmenu.c:37
override bool OnModalResult(Widget w, int x, int y, int code, int result)
ref OptionsMenuGame m_GameTab
Definition optionsmenu.c:7
void UpdateControlsElements()
const int DIALOG_TAB_OFFSET
Definition optionsmenu.c:4
bool IsAnyTabChanged()
override bool OnFocusLost(Widget w, int x, int y)
bool IsFocusable(Widget w)
override bool OnMouseEnter(Widget w, int x, int y)
void ~OptionsMenu()
void OptionsMenu()
Definition optionsmenu.c:32
void ColorHighlight(Widget w)
override bool OnFocus(Widget w, int x, int y)
void FocusLastActiveTab()
override bool OnClick(Widget w, int x, int y, int button)
void ToggleDependentOptions(int mode, bool state)
Controls visibility and sometimes even state of specific, dependent options across sub-menus.
DayZGame g_Game
Definition dayzgame.c:3942
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int MENU_KEYBINDINGS
Definition constants.c:203
const int MENU_XBOX_CONTROLS
Definition constants.c:197
MouseState
Definition ensystem.c:311
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int IDC_MAIN_QUIT
Definition constants.c:144
WidgetFlags
Definition enwidgets.c:58
proto native void SetFocus(Widget w)
Icon x
Icon y
EInputDeviceType
Definition input.c:3
int ARGB(int a, int r, int g, int b)
Definition proto.c:322
proto native UAInputAPI GetUApi()