Dayz Explorer 1.28.160049
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
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
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
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
111 bool mk = GetGame().GetInput().IsEnabledMouseAndKeyboard();
112 bool mkServer = GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
113
114 switch (pInputDeviceType)
115 {
116 case EInputDeviceType.CONTROLLER:
117 if (mk && mkServer)
118 {
119 GetGame().GetUIManager().ShowUICursor(false);
120 }
121 break;
122
123 default:
124 if (mk && mkServer)
125 {
126 GetGame().GetUIManager().ShowUICursor(true);
127 }
128 break;
129 }
130
132 #endif
133 }
134
135 override bool OnClick(Widget w, int x, int y, int button)
136 {
137 if (button == MouseState.LEFT)
138 {
139 switch (w)
140 {
141 case m_Apply:
142 {
143 Apply();
144 return true;
145 }
146 case m_Back:
147 {
148 Back();
149 return true;
150 }
151 case m_Reset:
152 {
154 return true;
155 }
156 case m_Defaults:
157 {
158 //SetToDefaults();
160 return true;
161 }
162 }
163 }
164 return false;
165 }
166
167 void OnTabSwitch(int tab)
168 {
169 switch (tab)
170 {
171 case 0:
172 {
173 m_GameTab.Focus();
174 break;
175 }
176 case 1:
177 {
178 m_SoundsTab.Focus();
179 break;
180 }
181 case 2:
182 {
183 #ifdef PLATFORM_XBOX
184 m_ControlsTab.Focus();
185 #else
186 m_VideoTab.Focus();
187 #endif
188 break;
189 }
190 case 3:
191 {
192 #ifndef PLATFORM_XBOX
193 m_ControlsTab.Focus();
194 #endif
195 break;
196 }
197 }
198
199 m_ActiveTabIdx = tab;
200 }
201
202 void Apply()
203 {
204 if (m_ControlsTab.IsChanged())
205 m_ControlsTab.Apply();
206
207 if (m_SoundsTab.IsChanged())
208 m_SoundsTab.Apply();
209
210 if (m_GameTab.IsChanged())
211 m_GameTab.Apply();
212
213 if (m_Options.IsChanged() || m_GameTab.IsChanged())
214 {
215 m_Options.Test();
216 m_Options.Apply();
217 }
218
219 // save input configuration
220 GetUApi().Export();
221
222 if (GetGame().GetInput().IsEnabledMouseAndKeyboard()) //useless on consoles
223 {
224 m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
225 ColorDisable(m_Apply);
226 m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
227 ColorDisable(m_Reset);
228 }
229
230 m_CanApplyOrReset = false;
231 #ifdef PLATFORM_CONSOLE
234
235 IngameHud hud;
236 if (GetGame().GetMission() && Class.CastTo(hud,GetGame().GetMission().GetHud()))
237 {
238 hud.ShowQuickBar(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
239 }
240 #endif
241
242 if (m_Options.NeedRestart())
243 g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#menu_restart_needed", 117, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
244 }
245
246 void Back()
247 {
248 if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
249 {
250 if (IsAnyTabChanged())
251 {
252 g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#main_menu_configure_desc", 1337, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
253 #ifdef PLATFORM_CONSOLE
255 #endif
256 }
257 else
258 {
259 m_Options.Revert();
260 GetGame().EndOptionsVideo();
261 GetGame().GetUIManager().Back();
262 }
263 }
264 }
265
266 void OnAttemptTabSwitch(int source, int target)
267 {
268 bool changed = IsAnyTabChanged();
269 if (changed)
270 {
271 if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
272 {
273 int id = target + DIALOG_TAB_OFFSET;
274 g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#main_menu_configure_desc", id, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
275 #ifdef PLATFORM_CONSOLE
277 #endif
278 }
279 }
280 else
281 {
283 }
284
285 m_Tabber.SetCanSwitch(!changed);
286 }
287
289 {
290 bool changed = (m_Options.IsChanged() || m_GameTab.IsChanged() || m_SoundsTab.IsChanged() || m_ControlsTab.IsChanged());
291 #ifndef PLATFORM_XBOX
292 changed |= m_VideoTab.IsChanged();
293 #endif
294
295 return changed;
296 }
297
299 {
300 bool changed = IsAnyTabChanged();
301
302 if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
303 {
304 if (changed)
305 {
306 m_Reset.ClearFlags(WidgetFlags.IGNOREPOINTER);
307 ColorNormal(m_Reset);
308 m_Apply.ClearFlags(WidgetFlags.IGNOREPOINTER);
309 ColorNormal(m_Apply);
310 }
311 else
312 {
313 m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
314 ColorDisable(m_Apply);
315 m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
316 ColorDisable(m_Reset);
317 }
318 }
319
320 m_CanApplyOrReset = changed;
321 #ifdef PLATFORM_CONSOLE
324 #endif
325
326 m_Tabber.AlignTabbers();
327 }
328
329 //resets it all
330 void Reset()
331 {
332 m_Options.Revert();
333 m_GameTab.Revert();
334 m_SoundsTab.Revert();
335 m_ControlsTab.Revert();
336 #ifndef PLATFORM_XBOX
337 m_VideoTab.Revert();
338 #endif
339
340 if (m_Options.IsChanged())
341 m_Options.Revert();
342
343 if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
344 {
345 m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
346 ColorDisable(m_Apply);
347 m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
348 ColorDisable(m_Reset);
349 }
350
351 m_CanApplyOrReset = false;
352 #ifdef PLATFORM_CONSOLE
355 #endif
356 }
357
359 {
360 if (m_Options.IsChanged())
361 {
362 m_Options.Revert();
363 }
364
365 switch (m_ActiveTabIdx)
366 {
367 case 0:
368 {
369 m_GameTab.Revert();
370 break;
371 }
372 case 1:
373 {
374 m_SoundsTab.Revert();
375 break;
376 }
377 case 2:
378 {
379 #ifdef PLATFORM_XBOX
380 m_ControlsTab.Revert();
381 #else
382 m_VideoTab.Revert();
383 #endif
384 break;
385 }
386 case 3:
387 {
388 #ifndef PLATFORM_XBOX
389 m_ControlsTab.Revert();
390 #endif
391 break;
392 }
393 }
394
395 if (m_Options.IsChanged())
396 {
397 m_Options.Revert();
398 }
399
400 if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
401 {
402 m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
403 ColorDisable(m_Apply);
404 m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
405 ColorDisable(m_Reset);
406 }
407
408 m_CanApplyOrReset = false;
409 #ifdef PLATFORM_CONSOLE
412 #endif
413
414 m_Tabber.AlignTabbers();
415 }
416
418 {
419 if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
420 {
421 g_Game.GetUIManager().ShowDialog("#menu_default_cap", "TODO - reset options to default", MODAL_ID_DEFAULT, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
422 }
423 }
424
426 {
427 switch (m_ActiveTabIdx)
428 {
429 case 0:
430 m_GameTab.SetToDefaults();
431 break;
432
433 case 1:
434 m_SoundsTab.SetToDefaults();
435 break;
436
437 case 2:
438 #ifdef PLATFORM_XBOX
439 m_ControlsTab.SetToDefaults();
440 #else
441 m_VideoTab.SetToDefaults();
442 #endif
443 break;
444
445 case 3:
446 #ifndef PLATFORM_XBOX
447 m_ControlsTab.SetToDefaults();
448 #endif
449 break;
450 }
451
452 if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
453 {
454 m_Reset.ClearFlags(WidgetFlags.IGNOREPOINTER);
455 ColorNormal(m_Reset);
456 m_Apply.ClearFlags(WidgetFlags.IGNOREPOINTER);
457 ColorNormal(m_Apply);
458 }
459
460 m_CanApplyOrReset = true;
461 #ifdef PLATFORM_CONSOLE
464 #endif
465 }
466
468 {
469 #ifdef PLATFORM_CONSOLE
470 m_CanToggle = false;
472 #endif
473 }
474
476 {
477 #ifdef PLATFORM_CONSOLE
478 m_CanToggle = true;
480 #endif
481 }
482
484 void ToggleDependentOptions(int mode, bool state)
485 {
486 m_GameTab.ToggleDependentOptions(mode,state);
487 m_SoundsTab.ToggleDependentOptions(mode,state);
488 m_ControlsTab.ToggleDependentOptions(mode,state);
489 #ifndef PLATFORM_XBOX
490 m_VideoTab.ToggleDependentOptions(mode,state);
491 #endif
492 }
493
495 {
496 m_Options = new GameOptions();
497
498 if (m_GameTab)
499 m_GameTab.SetOptions(m_Options);
500 if (m_SoundsTab)
501 m_SoundsTab.SetOptions(m_Options);
502 if (m_ControlsTab)
503 m_ControlsTab.SetOptions(m_Options);
504
505 #ifndef PLATFORM_XBOX
506 if (m_VideoTab)
507 m_VideoTab.SetOptions(m_Options);
508 #endif
509 }
510
512 {
513 #ifndef PLATFORM_XBOX
514 if (m_VideoTab)
515 m_VideoTab.SetOptions(m_Options);
516 #endif
517 }
518
519 override bool OnModalResult(Widget w, int x, int y, int code, int result)
520 {
521 bool ret = false;
522
523 if (code == 1337)
524 {
525 if (result == 2)
526 {
527 m_Options.Revert();
528 GetGame().EndOptionsVideo();
529 GetGame().GetUIManager().Back();
530 }
531 ret = true;
532 }
533 else if (code == 117)
534 {
535 g_Game.RequestRestart(IDC_MAIN_QUIT);
536 }
537 else if (code == MODAL_ID_DEFAULT)
538 {
539 if (result == 2)
540 {
542 }
543 }
544 else if (code >= DIALOG_TAB_OFFSET)
545 {
546 if (result == 2)
547 {
548 int id = code - DIALOG_TAB_OFFSET;
549 //m_Options.Revert();
551 m_Tabber.PerformSwitchTab(id);
552 }
553 ret = true;
554 }
555
556 m_ModalLock = ret; //prevents dialog being shown on the next update
557 return ret;
558 }
559
560 override bool OnMouseEnter(Widget w, int x, int y)
561 {
562 if (w && IsFocusable(w))
563 {
565 return true;
566 }
567 return false;
568 }
569
570 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
571 {
572 if (w && IsFocusable(w))
573 {
574 ColorNormal(w);
575 return true;
576 }
577 return false;
578 }
579
580 override bool OnFocus(Widget w, int x, int y)
581 {
582 if (w && IsFocusable(w))
583 {
585 return true;
586 }
587 else if (y == 1)
588 {
589 SliderFocus();
590 }
591 else
592 {
593 ToggleFocus();
594 }
595
596 return false;
597 }
598
599 override bool OnFocusLost(Widget w, int x, int y)
600 {
601 if (w && IsFocusable(w))
602 {
603 ColorNormal(w);
604 return true;
605 }
606 return false;
607 }
608
609 bool IsFocusable(Widget w)
610 {
611 if (w)
612 {
613 return (w == m_Apply || w == m_Back || w == m_Reset || w == m_Defaults);
614 }
615 return false;
616 }
617
618 override void Refresh()
619 {
620 string version;
621 GetGame().GetVersion(version);
622 #ifdef PLATFORM_CONSOLE
623 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
624 #else
625 version = "#main_menu_version" + " " + version;
626 #endif
627
628 m_Version.SetText(version);
629
630 #ifdef PLATFORM_CONSOLE
631 OnInputDeviceChanged(GetGame().GetInput().GetCurrentInputDevice());
633 #endif
634 }
635
636 override void OnShow()
637 {
638 super.OnShow();
639 m_GameTab.Focus();
640 Refresh();
641 }
642
643 override void Update(float timeslice)
644 {
645 super.Update(timeslice);
646
647 if (m_ModalLock)
648 {
649 m_ModalLock = false;
650 #ifdef PLATFORM_CONSOLE
652 #endif
653 return;
654 }
655
656 if (g_Game.GetUIManager().IsDialogVisible())
657 {
658 return;
659 }
660
661 if (GetUApi().GetInputByID(UAUITabLeft).LocalPress())
662 {
663 m_Tabber.PreviousTab();
664 }
665 else if (GetUApi().GetInputByID(UAUITabRight).LocalPress())
666 {
667 m_Tabber.NextTab();
668 }
669 else if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
670 {
671 if (m_CanApplyOrReset)
672 {
673 Apply();
674 }
675 }
676 else if (GetUApi().GetInputByID(UAUICredits).LocalPress())
677 {
678 if (m_CanApplyOrReset)
679 {
681 }
682
683 }
684 else if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
685 {
687 }
688 else if (GetUApi().GetInputByID(UAUIBack).LocalPress())
689 {
690 Back();
691 }
692 }
693
694 //Coloring functions (Until WidgetStyles are useful)
695 void ColorHighlight(Widget w)
696 {
697 if ((w.GetFlags() & WidgetFlags.IGNOREPOINTER) == WidgetFlags.IGNOREPOINTER)
698 {
699 return;
700 }
701
702 if (w.IsInherited(ButtonWidget))
703 {
704 ButtonWidget button = ButtonWidget.Cast(w);
705 button.SetTextColor(ARGB(255, 200, 0, 0));
706 }
707
708 w.SetColor(ARGB(255, 0, 0, 0));
709
710 TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
711 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
712 TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
713 ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
714 Widget option = Widget.Cast(w.FindAnyWidget(w.GetName() + "_option_wrapper"));
715 Widget option_label = w.FindAnyWidget("option_label");
716
717 if (text1)
718 {
719 text1.SetColor(ARGB(255, 255, 0, 0));
720 }
721
722 if (text2)
723 {
724 text2.SetColor(ARGB(255, 255, 0, 0));
725 }
726
727 if (text3)
728 {
729 text3.SetColor(ARGB(255, 255, 0, 0));
730 w.SetAlpha(1);
731 }
732
733 if (image)
734 {
735 image.SetColor(ARGB(255, 200, 0, 0));
736 }
737
738 if (option)
739 {
740 option.SetColor(ARGB(255, 255, 0, 0));
741 }
742
743 if (option_label)
744 {
745 option_label.SetColor(ARGB(255, 255, 0, 0));
746 }
747 }
748
749 void ColorNormal(Widget w)
750 {
751 if ((w.GetFlags() & WidgetFlags.IGNOREPOINTER) == WidgetFlags.IGNOREPOINTER)
752 {
753 return;
754 }
755
756 if (w.IsInherited(ButtonWidget))
757 {
758 ButtonWidget button = ButtonWidget.Cast(w);
759 button.SetTextColor(ARGB(255, 255, 255, 255));
760 }
761
762 TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
763 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
764 TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
765 ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
766 Widget option = w.FindAnyWidget(w.GetName() + "_option_wrapper");
767 Widget option_label = w.FindAnyWidget("option_label");
768
769 if (text1)
770 {
771 text1.SetColor(ARGB(255, 255, 255, 255));
772 }
773
774 if (text2)
775 {
776 text2.SetColor(ARGB(255, 255, 255, 255));
777 }
778
779 if (text3)
780 {
781 text3.SetColor(ARGB(255, 255, 255, 255));
782 w.SetAlpha(0);
783 }
784
785 if (image)
786 {
787 image.SetColor(ARGB(255, 255, 255, 255));
788 }
789
790 if (option)
791 {
792 option.SetColor(ARGB(150, 255, 255, 255));
793 }
794
795 if (option_label)
796 {
797 option_label.SetColor(ARGB(255, 255, 255, 255));
798 }
799 }
800
801 void ColorDisable(Widget w)
802 {
803 #ifdef PLATFORM_WINDOWS
804 SetFocus(null);
805 #endif
806
807 if (w)
808 {
809 ButtonWidget button = ButtonWidget.Cast(w);
810 if (button)
811 {
812 button.SetTextColor(ColorManager.COLOR_DISABLED_TEXT);
813 }
814 }
815 }
816
817 protected void UpdateControlsElements()
818 {
819 #ifdef PLATFORM_CONSOLE
820 RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
821 string text = "";
822 if (g_Game.GetUIManager().IsDialogVisible() || g_Game.GetUIManager().IsDialogQueued())
823 {
824 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#dialog_confirm", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
825
826 }
827 else
828 {
829 if (m_CanToggle)
830 {
831 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#dialog_change", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
832 }
833 if (m_CanApplyOrReset)
834 {
835 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Apply_ApplyText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
836 }
837 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "#menu_default", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
838 if (m_CanApplyOrReset)
839 {
840 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICredits", "#menu_undo", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
841 }
842 }
843 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Back_BackText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
844 toolbar_text.SetText(text);
845
846 RichTextWidget toolbar_b2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon0"));
847 RichTextWidget toolbar_x2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ApplyIcon0"));
848 RichTextWidget toolbar_y2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ResetIcon0"));
849 RichTextWidget toolbar_def2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("DefaultIcon0"));
850 toolbar_b2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER));
851 toolbar_x2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "", EUAINPUT_DEVICE_CONTROLLER));
852 toolbar_y2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICredits", "", EUAINPUT_DEVICE_CONTROLLER));
853 toolbar_def2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "", EUAINPUT_DEVICE_CONTROLLER));
854 #endif
855 }
856
858 {
859 bool toolbarShow = false;
860 #ifdef PLATFORM_CONSOLE
861 toolbarShow = !GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
862 #endif
863
864 layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
865 layoutRoot.FindAnyWidget("play_panel_root").Show(!toolbarShow);
866 }
867}
void OnInputPresetChanged()
Definition inventory.c:168
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition inventory.c:175
Super root of all classes in Enforce script.
Definition enscript.c:11
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
void UpdateControlsElementVisibility()
override bool OnMouseEnter(Widget w, int x, int y)
override void OnShow()
void ColorDisable(Widget w)
Definition ingamemenu.c:383
override bool OnFocus(Widget w, int x, int y)
override void Update(float timeslice)
void ReloadVideoOptions()
override void Refresh()
TextWidget m_Version
void OnAttemptTabSwitch(int source, int target)
void ColorHighlight(Widget w)
bool IsFocusable(Widget w)
void ~OptionsMenu()
Definition optionsmenu.c:97
void Apply()
renames character
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
void SetToDefaults()
ref GameOptions m_Options
Definition optionsmenu.c:12
bool m_CanApplyOrReset
Definition optionsmenu.c:24
void ResetCurrentTab()
override bool OnFocusLost(Widget w, int x, int y)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
void ReloadOptions()
ref OptionsMenuGame m_GameTab
Definition optionsmenu.c:7
ref OptionsMenuSounds m_SoundsTab
Definition optionsmenu.c:8
void ToggleDependentOptions(int mode, bool state)
Controls visibility and sometimes even state of specific, dependent options across sub-menus.
bool IsAnyTabChanged()
ButtonWidget m_Defaults
void UpdateControlsElements()
void OnTabSwitch(int tab)
ref OptionsMenuVideo m_VideoTab
Definition optionsmenu.c:9
ButtonWidget m_Back
override Widget Init()
Definition optionsmenu.c:32
override bool OnClick(Widget w, int x, int y, int button)
void OptionsMenu()
Definition optionsmenu.c:27
override bool OnModalResult(Widget w, int x, int y, int code, int result)
void ColorNormal(Widget w)
ButtonWidget m_Reset
ref OptionsMenuControls m_ControlsTab
Definition optionsmenu.c:10
void PerformSetToDefaults()
deprecated, resets all (as before ~1.20)
void OnInputPresetChanged()
ButtonWidget m_Back
DayZGame g_Game
Definition dayzgame.c:3868
proto native CGame GetGame()
MouseState
Definition ensystem.c:311
const int IDC_MAIN_QUIT
Definition constants.c:144
WidgetFlags
Definition enwidgets.c:58
Icon x
Icon y
EInputDeviceType
Definition input.c:3
int ARGB(int a, int r, int g, int b)
Definition proto.c:322
ref ServerBrowserDetailsContainer m_Details
void Refresh()
proto native UAInputAPI GetUApi()