Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
ingamemenuxbox.c
Go to the documentation of this file.
1class InGameMenuXbox extends UIScriptedMenu
2{
3 // Widgets texts id
4 protected string m_MuteButtonTextID;
5 protected string m_UnmuteButtonTextID;
6 protected string m_BackButtonTextID;
7 protected string m_SelectButtonTextID;
8 protected string m_OpenGameCardButtonTextID;
9 protected string m_CurrentMuteButtonText;
10
11 protected bool m_SelectAvailable;
12 protected bool m_MuteAvailable;
13 protected bool m_BackAvailable;
14 protected bool m_GamercardAvailable;
15
16 protected bool m_PlayerAlive;
17
18 protected ref PlayerListScriptedWidget m_ServerInfoPanel;
19
20 protected Widget m_OnlineMenu;
21
22 protected Widget m_IngameMenuPanel;
23 protected Widget m_DialogPanel;
24 protected ButtonWidget m_ContinueButton;
25 protected ButtonWidget m_ExitButton;
26 protected ButtonWidget m_RestartDeadButton;
27 protected ButtonWidget m_RestartButton;
28 protected ButtonWidget m_OptionsButton;
29 protected ButtonWidget m_InviteButton;
30 protected ButtonWidget m_ControlsButton;
31 protected ButtonWidget m_OnlineButton;
32 protected ButtonWidget m_TutorialsButton;
33 protected TextWidget m_Version;
34
35 protected ButtonWidget m_ShowFeedback;
36 protected ImageWidget m_FeedbackQRCode;
37 protected ImageWidget m_FeedbackPlatformIcon;
38 protected ButtonWidget m_FeedbackClose;
40
41 const int BUTTON_XBOX_CONTROLS = 201;
42
44 {
45 GetGame().GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
46 GetGame().GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
47 }
48
50 {
51 ClientData.SyncEvent_OnPlayerListUpdate.Remove(SyncEvent_OnRecievedPlayerList);
52 OnlineServices.m_PermissionsAsyncInvoker.Remove(OnPermissionsUpdate);
53
54 Mission mission = GetGame().GetMission();
55 if (mission)
56 {
57 IngameHud hud = IngameHud.Cast(mission.GetHud());
58 if (hud)
59 {
60 hud.ShowHudUI(true);
61 hud.ShowQuickbarUI(true);
62 }
63
64 mission.Continue();
65 }
66
67 PPERequesterBank.GetRequester(PPERequester_MenuEffects).Stop();
68 }
69
70 protected void OnInputPresetChanged()
71 {
72 #ifdef PLATFORM_CONSOLE
74 #endif
75 }
76
77 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
78 {
79 bool mk = GetGame().GetInput().IsEnabledMouseAndKeyboard();
80 bool mkServer = GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
81
82 switch (pInputDeviceType)
83 {
84 case EInputDeviceType.CONTROLLER:
85 {
86 if (mk && mkServer)
87 {
88 GetGame().GetUIManager().ShowUICursor(false);
89 if (!GetFocus() || GetFocus() == m_FeedbackClose)
90 {
92 }
93
94 m_FeedbackClose.Show(false);
95 m_ShowFeedback.Show(false);
96 }
97 break;
98 }
99 default:
100 {
101 if (mk && mkServer)
102 {
103 GetGame().GetUIManager().ShowUICursor(true);
104 m_ShowFeedback.Show(true);
105 m_FeedbackClose.Show(true);
106 m_FeedbackCloseLabel.SetText(string.Format("%1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#close", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_NORMAL)));
107 }
108 break;
109 }
110 }
111
113 }
114
115 override Widget Init()
116 {
117 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/day_z_ingamemenu_xbox.layout");
118
119 m_OnlineMenu = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/ingamemenu_xbox/online_info_menu.layout", layoutRoot);
120 m_OnlineMenu.Show(false);
121
122 m_IngameMenuPanel = layoutRoot.FindAnyWidget("ingame_menu_panel");
123 m_ContinueButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("continuebtn"));
124 m_RestartDeadButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("restartbtn_dead"));
125 m_ExitButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("exitbtn"));
126 m_RestartButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("restartbtn"));
127 m_OptionsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("optionsbtn"));
128 m_InviteButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("invitebtn"));
129 m_ControlsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("controlsbtn"));
130 m_OnlineButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("onlinebtn"));
131 m_TutorialsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("tutorialsbtn"));
132 m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget("version"));
133 m_ShowFeedback = ButtonWidget.Cast(layoutRoot.FindAnyWidget("feedbackbtn"));
134 m_FeedbackQRCode = ImageWidget.Cast(layoutRoot.FindAnyWidget("qr_image"));
135 m_FeedbackClose = ButtonWidget.Cast(layoutRoot.FindAnyWidget("close_button"));
136 m_FeedbackCloseLabel = RichTextWidget.Cast(layoutRoot.FindAnyWidget("close_button_label"));
137 m_DialogPanel = layoutRoot.FindAnyWidget("ingame_menu_dialog");
138
139 m_SelectAvailable = true;
140 m_MuteAvailable = false;
141 m_GamercardAvailable = false;
142 m_BackAvailable = true;
143
144 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
145 if (player)
146 {
147 m_PlayerAlive = player.GetPlayerState() == EPlayerStates.ALIVE;
148 if (!m_PlayerAlive)
149 m_BackAvailable = false;
150
151 player.GetOnUnconsciousStart().Insert(UpdateGUI);
152 player.GetOnUnconsciousStart().Insert(UpdateMenuFocus);
153 player.GetOnUnconsciousStop().Insert(UpdateGUI);
154 player.GetOnUnconsciousStop().Insert(UpdateMenuFocus);
155 player.GetOnDeathStart().Insert(UpdateGUI);
156 player.GetOnDeathStart().Insert(UpdateMenuFocus);
157 }
158
159 string version;
160 GetGame().GetVersion(version);
161 #ifdef PLATFORM_CONSOLE
162 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
163 #else
164 version = "#main_menu_version" + " " + version;
165 #endif
166 m_Version.SetText(version);
167
168 if (GetGame().IsMultiplayer())
169 {
170 m_OnlineButton.Show(true);
171
172 TextWidget w_text = TextWidget.Cast(m_OnlineMenu.FindAnyWidget("OnlineTextWidget"));
173 w_text.SetText(g_Game.GetHostName());
174
175 m_ServerInfoPanel = new PlayerListScriptedWidget(m_OnlineMenu.FindAnyWidget("ServerInfoPanel"));
176
177 OnlineServices.m_PermissionsAsyncInvoker.Insert(OnPermissionsUpdate);
178 ClientData.SyncEvent_OnPlayerListUpdate.Insert(SyncEvent_OnRecievedPlayerList);
179
180 m_ServerInfoPanel.Reload(ClientData.m_PlayerList);
181 m_ServerInfoPanel.ReloadLocal(OnlineServices.GetMuteList());
182
183 string uid = m_ServerInfoPanel.FindPlayerByWidget(GetFocus());
184 if (uid != "")
185 {
186 if (IsLocalPlayer(uid) || m_ServerInfoPanel.IsEmpty())
187 {
188 m_MuteAvailable = false;
189 m_GamercardAvailable = false;
190 }
191 else
192 {
193 m_MuteAvailable = !GetGame().GetWorld().IsDisabledReceivingVoN();
194 #ifndef PLATFORM_PS4
195 m_GamercardAvailable = true;
196 #endif
198 }
199
200 if (m_ServerInfoPanel.IsGloballyMuted(uid))
201 {
202 m_MuteAvailable = false;
203 }
204 }
205 }
206 else
207 {
208 layoutRoot.FindAnyWidget("onlinebtn").Show(false);
209 layoutRoot.FindAnyWidget("invitebtn").Show(false);
210 }
211
212 //RESPAWN & RESTART
213 if (GetGame().IsMultiplayer())
214 {
215 m_RestartButton.SetText("#main_menu_respawn");
216 }
217 else
218 {
219 m_RestartButton.SetText("#main_menu_restart");
220 }
221
222 if (!ShouldRestartBeVisible(player))
223 {
224 m_RestartButton.Show(false);
225 }
226
227 Mission mission = GetGame().GetMission();
228 if (mission)
229 {
230 IngameHud hud = IngameHud.Cast(mission.GetHud());
231 if (hud)
232 {
233 hud.ShowHudUI(false);
234 hud.ShowQuickbarUI(false);
235 }
236
237 mission.Pause();
238 }
239
240 PPERequester_MenuEffects requester;
241 Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
242 requester.SetVignetteIntensity(0.6);
243
246
247 #ifdef PLATFORM_PS4
248 m_FeedbackQRCode.LoadImageFile(0, "gui/textures/feedback_qr_ps.edds");
249 #else
250 m_FeedbackQRCode.LoadImageFile(0, "gui/textures/feedback_qr_xbox.edds");
251 #endif
252
253 return layoutRoot;
254 }
255
256 override bool OnClick(Widget w, int x, int y, int button)
257 {
258 super.OnClick(w, x, y, button);
259
261 {
262 switch (w.GetUserID())
263 {
265 {
266 if (!IsOnlineOpen())
267 {
268 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetMission().Continue);
269 }
270 else
271 {
272 CloseOnline();
273 }
274 return true;
275 }
276 case IDC_MAIN_OPTIONS:
277 {
278 EnterScriptedMenu(MENU_OPTIONS);
279 return true;
280 }
282 {
283 EnterScriptedMenu(MENU_XBOX_CONTROLS);
284 return true;
285 }
286 case IDC_MAIN_QUIT:
287 {
288 GetGame().GetUIManager().ShowDialog("#main_menu_exit", "#main_menu_exit_desc", IDC_INT_EXIT, DBT_YESNO, DBB_YES, DMT_QUESTION, NULL);
289 return true;
290 }
291 case IDC_INT_RETRY:
292 {
293 if (!GetGame().IsMultiplayer())
294 {
295 GetGame().GetUIManager().ShowDialog("#main_menu_restart", "Are you sure you want to restart?", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
296 }
297 else
298 {
299 GetGame().GetUIManager().ShowDialog("#main_menu_respawn", "#main_menu_respawn_question", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
300 }
301 return true;
302 }
303 case IDC_MAIN_ONLINE:
304 {
305 m_OnlineMenu.Show(true);
306 m_SelectAvailable = false;
307
309 m_ServerInfoPanel.FocusFirst();
310 return true;
311 }
313 {
314 EnterScriptedMenu(MENU_TUTORIAL);
315 return true;
316 }
317 case IDC_MULTI_INVITE:
318 {
320 return true;
321 }
322 }
323
324 if (w == m_RestartDeadButton)
325 {
326 if (GetGame().GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
327 {
328 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
329 }
330 else
331 {
332 GameRetry(true);
333 }
334 return true;
335 }
336 }
337 else
338 {
339 if (w == m_FeedbackClose)
340 {
342 return true;
343 }
344 }
345
346 if (w.GetUserID() == IDC_MAIN_FEEDBACK && !IsOnlineOpen())
347 {
349 return true;
350 }
351
352 return false;
353 }
354
355 protected void ToggleFeedbackDialog()
356 {
357 bool dialogVisible = FeedbackDialogVisible();
358 m_DialogPanel.Show(!dialogVisible);
359 m_IngameMenuPanel.Show(dialogVisible);
360
361 if (!dialogVisible)
362 {
363 PPERequesterBank.GetRequester(PPERequester_FeedbackBlur).Start();
364 }
365 else
366 {
367 PPERequesterBank.GetRequester(PPERequester_FeedbackBlur).Stop();
368 }
369
372 }
373
375 {
376 return m_DialogPanel.IsVisible();
377 }
378
379 override bool OnModalResult(Widget w, int x, int y, int code, int result)
380 {
381 super.OnModalResult(w, x, y, code, result);
382
383 if (code == IDC_INT_EXIT && result == DBB_YES)
384 {
385 if (GetGame().IsMultiplayer())
386 {
388 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetMission().CreateLogoutMenu, this);
389 }
390 else
391 {
392 // skip logout screen in singleplayer
393 GetGame().GetMission().AbortMission();
394 }
395 g_Game.CancelLoginTimeCountdown();
396
397 return true;
398
399 }
400 else if (code == IDC_INT_EXIT && result == DBB_NO)
401 {
402 g_Game.CancelLoginTimeCountdown();
403 }
404 else if (code == IDC_INT_RETRY)
405 {
406 if (result == DBB_YES)
407 {
408 if (GetGame().GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
409 {
410 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
411 }
412 else
413 {
414 GameRetry(true);
415 return true;
416 }
417 }
418 else
419 {
421 }
422 }
423
424 return false;
425 }
426
427 void GameRetry(bool random)
428 {
429 if (GetGame().IsMultiplayer())
430 {
431 GetGame().GetMenuDefaultCharacterData(false).SetRandomCharacterForced(random);
433
434 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
435 if (player)
436 {
437 player.SimulateDeath(true);
438 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(player.ShowDeadScreen, true, 0);
439 }
440
441 MissionGameplay missionGP = MissionGameplay.Cast(GetGame().GetMission());
442 missionGP.DestroyAllMenus();
443 missionGP.SetPlayerRespawning(true);
444 missionGP.Continue();
445
446 Close();
447 }
448 else
449 {
451 }
452 }
453
454 void MenuRequestRespawn(UIScriptedMenu menu, bool random)
455 {
456 if (RespawnDialogue.Cast(menu))
457 {
458 GameRetry(random);
459 }
460 }
461
462 bool IsLocalPlayer(string uid)
463 {
464 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
465 string local_uid;
466 if (GetGame().GetUserManager())
467 {
468 local_uid = GetGame().GetUserManager().GetSelectedUser().GetUid();
469 }
470
471 return (uid == local_uid);
472 }
473
475 {
476 SyncPlayerList player_list = new SyncPlayerList;
477 player_list.m_PlayerList = new array<ref SyncPlayer>;
478
479 for (int i = 0; i < player_count; i++)
480 {
481 SyncPlayer sync_player = new SyncPlayer;
482 sync_player.m_UID = "uid" + i;
483 sync_player.m_PlayerName = "Player " + i;
484 player_list.m_PlayerList.Insert(sync_player);
485 }
486
487 return player_list;
488 }
489
490 override void Update(float timeslice)
491 {
492 super.Update(timeslice);
493
494 if (GetUApi().GetInputByID(UAUIThumbRight).LocalPress() && !IsOnlineOpen() || FeedbackDialogVisible() && GetUApi().GetInputByID(UAUIBack).LocalPress())
495 {
497 }
498
499 if (GetGame().IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible())
500 {
501 PlayerListEntryScriptedWidget selected;
502 if (m_ServerInfoPanel)
503 {
504 selected = m_ServerInfoPanel.GetSelectedPlayer();
505 }
506
507 if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
508 {
509 if (selected)
510 {
511 m_ServerInfoPanel.ToggleMute(selected.GetUID());
512 }
513
514 Refresh();
515 }
516
517 #ifndef PLATFORM_PS4
518 if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
519 {
520 if (selected)
521 {
522 OnlineServices.ShowUserProfile(selected.GetUID());
523 }
524 }
525 #endif
526 }
527 }
528
529 bool ShouldRestartBeVisible(Man player)
530 {
531 PlayerBase p = PlayerBase.Cast(player);
532 return p && p.IsUnconsciousStateOnly() && !CfgGameplayHandler.GetDisableRespawnInUnconsciousness();
533 }
534
536 {
537 bool shouldUpdateMenuFocus = false;
538 Man player = GetGame().GetPlayer();
539 if (player)
540 {
541 m_PlayerAlive = player.GetPlayerState() == EPlayerStates.ALIVE;
542 }
543
544 if (m_PlayerAlive)
545 {
546 bool showRestartBtn = ShouldRestartBeVisible(player);
547 m_RestartButton.Show(showRestartBtn);
548 }
549 else
550 {
551 m_RestartButton.Show(false);
552 m_BackAvailable = false;
553 }
554
555 m_ContinueButton.Show(m_PlayerAlive);
556 m_RestartDeadButton.Show(!m_PlayerAlive);
557
559 }
560
562 {
563 return m_OnlineMenu.IsVisible();
564 }
565
567 {
568 m_OnlineMenu.Show(false);
569 m_SelectAvailable = true;
570 m_MuteAvailable = false;
571 m_GamercardAvailable = false;
572
574 SetFocus(m_OnlineButton);
575 }
576
578 {
579 if (m_ServerInfoPanel)
580 {
581 m_ServerInfoPanel.FocusFirst();
582
583 Refresh();
584 }
585 }
586
587 override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
588 {
589 return false;
590 }
591
593 {
594 m_ServerInfoPanel.Reload(player_list);
595
596 Refresh();
597 }
598
600 {
601 m_ServerInfoPanel.Reload(result_list);
602
603 Refresh();
604 }
605
606 override void OnShow()
607 {
608 super.OnShow();
609
610 #ifdef PLATFORM_CONSOLE
611 bool mk = GetGame().GetInput().IsEnabledMouseAndKeyboard();
612 bool mk_server = GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
613 TextWidget warning = TextWidget.Cast(layoutRoot.FindAnyWidget("MouseAndKeyboardWarning"));
614 if (mk)
615 {
616 if (mk_server)
617 {
618 warning.SetText("#str_mouse_and_keyboard_server_warning");
619 }
620 else
621 {
622 warning.SetText("#str_controller_server_warning");
623 }
624 }
625
626 warning.Show(mk);
627 #endif
628
629 UpdateGUI();
630
632 OnInputDeviceChanged(GetGame().GetInput().GetCurrentInputDevice());
633 }
634
635 override bool OnMouseEnter(Widget w, int x, int y)
636 {
637 if (IsFocusable(w))
638 {
640 return true;
641 }
642 return false;
643 }
644
645 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
646 {
647 if (IsFocusable(w))
648 {
649 ColorNormal(w);
650 return true;
651 }
652 return false;
653 }
654
655 override bool OnFocus(Widget w, int x, int y)
656 {
657 if (IsFocusable(w))
658 {
660 return true;
661 }
662 return false;
663 }
664
665 override bool OnFocusLost(Widget w, int x, int y)
666 {
667 if (IsFocusable(w))
668 {
669 ColorNormal(w);
670 return true;
671 }
672 return false;
673 }
674
675 bool IsFocusable(Widget w)
676 {
677 if (w)
678 {
679 if (w == m_ContinueButton || w == m_RestartDeadButton || w == m_ExitButton || w == m_RestartButton || w == m_OptionsButton || w == m_InviteButton || w == m_ControlsButton || w == m_OnlineButton || w == m_TutorialsButton || w == m_ShowFeedback)
680 {
681 return true;
682 }
683 }
684 return false;
685 }
686
687 override void Refresh()
688 {
689 string version;
690 GetGame().GetVersion(version);
691 #ifdef PLATFORM_CONSOLE
692 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
693 #else
694 version = "#main_menu_version" + " " + version;
695 #endif
696 m_Version.SetText(version);
697
698 m_MuteAvailable = false;
699 m_GamercardAvailable = false;
700
701 if (GetGame().IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible() && m_ServerInfoPanel)
702 {
703 PlayerListEntryScriptedWidget selected = m_ServerInfoPanel.GetSelectedPlayer();
704 if (selected && !selected.IsLocalPlayer())
705 {
706 m_MuteAvailable = !GetGame().GetWorld().IsDisabledReceivingVoN() && !selected.IsGloballyMuted();
707 #ifndef PLATFORM_PS4
708 m_GamercardAvailable = true;
709 #endif
710 SetMuteButtonText(selected.IsMuted());
711 }
712 }
713
715 }
716
717 void ColorDisable(Widget w)
718 {
719 #ifdef PLATFORM_WINDOWS
720 SetFocus(null);
721 #endif
722
723 ButtonWidget button = ButtonWidget.Cast(w);
724 if (button && button != m_ContinueButton)
725 {
726 button.SetTextColor(ARGB(255, 255, 255, 255));
727 }
728 ButtonSetColor(w, ARGB(0, 0, 0, 0));
729 ButtonSetTextColor(w, ARGB(60, 0, 0, 0));
730 }
731
732 void ColorHighlight(Widget w)
733 {
734 if (!w)
735 {
736 return;
737 }
738
739 int color_pnl = ARGB(255, 0, 0, 0);
740 int color_lbl = ARGB(255, 255, 0, 0);
741
742 #ifdef PLATFORM_CONSOLE
743 color_pnl = ARGB(255, 200, 0, 0);
744 color_lbl = ARGB(255, 255, 255, 255);
745 #endif
746
747 ButtonSetColor(w, color_pnl);
748 ButtonSetTextColor(w, color_lbl);
749 }
750
751 void ColorNormal(Widget w)
752 {
753 if (!w) return;
754
755 int color_pnl = ARGB(0, 0, 0, 0);
756 int color_lbl = ARGB(255, 255, 255, 255);
757
758 ButtonSetColor(w, color_pnl);
759 ButtonSetTextColor(w, color_lbl);
760 }
761
762 void ButtonSetText(Widget w, string text)
763 {
764 if (!w)
765 {
766 return;
767 }
768
769 TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
770 if (label)
771 {
772 label.SetText(text);
773 }
774
775 }
776
777 void ButtonSetColor(Widget w, int color)
778 {
779 if (!w)
780 {
781 return;
782 }
783
784 Widget panel = w.FindWidget(w.GetName() + "_panel");
785 if (panel)
786 {
787 panel.SetColor(color);
788 }
789 }
790
791 void ButtonSetTextColor(Widget w, int color)
792 {
793 if (!w)
794 {
795 return;
796 }
797
798 TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
799 TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
800 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
801
802 if (label)
803 {
804 label.SetColor(color);
805 }
806
807 if (text)
808 {
809 text.SetColor(color);
810 }
811
812 if (text2)
813 {
814 text2.SetColor(color);
815 }
816 }
817
819 protected void SetMuteButtonText(bool isMuted)
820 {
821 if (isMuted)
822 {
823 m_CurrentMuteButtonText = m_UnmuteButtonTextID;
824 }
825 else
826 {
827 m_CurrentMuteButtonText = m_MuteButtonTextID;
828 }
829 }
830
832 protected void LoadTextStrings()
833 {
834 #ifdef PLATFORM_PS4
835 m_MuteButtonTextID = "#ps4_ingame_menu_mute";
836 m_UnmuteButtonTextID = "#ps4_ingame_menu_unmute";
837 m_BackButtonTextID = "#ps4_ingame_menu_back";
838 m_SelectButtonTextID = "#ps4_ingame_menu_select";
839 m_OpenGameCardButtonTextID = "#ps4_ingame_menu_opencard";
840 #else
841 m_MuteButtonTextID = "#xbox_ingame_menu_mute";
842 m_UnmuteButtonTextID = "#xbox_ingame_menu_unmute";
843 m_BackButtonTextID = "#STR_rootFrame_toolbar_bg_ConsoleToolbar_Back_BackText0";
844 m_SelectButtonTextID = "#layout_xbox_ingame_menu_select";
845 m_OpenGameCardButtonTextID = "#layout_xbox_ingame_menu_gamecard";
846 #endif
847 }
848
850 protected void LoadFooterButtonTexts()
851 {
852 TextWidget uiGamecardText = TextWidget.Cast(layoutRoot.FindAnyWidget("GamercardText"));
853 TextWidget uiBackText = TextWidget.Cast(layoutRoot.FindAnyWidget("BackText"));
854 TextWidget uiSelectText = TextWidget.Cast(layoutRoot.FindAnyWidget("SelectText"));
855
856 if (uiGamecardText)
857 {
858 uiGamecardText.SetText(m_OpenGameCardButtonTextID);
859 }
860
861 if (uiBackText)
862 {
863 uiBackText.SetText(m_BackButtonTextID);
864 }
865
866 if (uiSelectText)
867 {
868 uiSelectText.SetText(m_SelectButtonTextID);
869 }
870 }
871
873 {
874 Man player = GetGame().GetPlayer();
875 if (m_PlayerAlive)
876 {
877 if (ShouldRestartBeVisible(player))
878 {
879 SetFocus(m_RestartButton);
880 }
881 else
882 {
883 SetFocus(m_ContinueButton);
884 }
885 }
886 else
887 {
888 SetFocus(m_RestartDeadButton);
889 }
890 }
891
892 protected void UpdateControlsElements()
893 {
894 bool toolbarShow = !GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
895 bool onlineOpen = IsOnlineOpen();
896 layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
897 layoutRoot.FindAnyWidget("top").Show(!onlineOpen);
898
900 if (onlineOpen)
901 {
902 layoutRoot.FindAnyWidget("bottom").Show(!toolbarShow);
903 }
904 else
905 {
906 layoutRoot.FindAnyWidget("bottom").Show(true);
907 }
908
909 RichTextWidget continueBtnIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("continuebtn_icon"));
910 string contineBtnText = "";
911 continueBtnIcon.Show(!toolbarShow);
912
913 RichTextWidget toolbarTextWidget = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
914 string toolbarText = "";
915
917 if (toolbarShow)
918 {
920 {
921 if (m_SelectAvailable)
922 {
923 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", m_SelectButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
924 }
925
926 if (m_MuteAvailable)
927 {
928 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", m_CurrentMuteButtonText, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
929 }
930
931 if (m_BackAvailable)
932 {
933 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", m_BackButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
934 }
935
936 if (m_GamercardAvailable)
937 {
938 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", m_OpenGameCardButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
939 }
940
941 if (!IsOnlineOpen())
942 {
943 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIThumbRight", "#layout_main_menu_feedback", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
944 }
945 }
946 else
947 {
948 toolbarText = InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#close", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR);
949 }
950 }
951 else
952 {
954 contineBtnText = InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER);
955 }
956
957 toolbarTextWidget.SetText(toolbarText);
958 continueBtnIcon.SetText(contineBtnText);
959
961 string continueBtnLabel = "#main_menu_continue";
962 if (onlineOpen)
963 continueBtnLabel = "#layout_character_creation_back";
964
965 TextWidget continueBtnTextWidget = TextWidget.Cast(layoutRoot.FindAnyWidget("continuebtn_label"));
966 continueBtnTextWidget.SetText(continueBtnLabel);
967 layoutRoot.FindAnyWidget("dayz_logo").Show(!onlineOpen);
968 }
969
970 override void OnHide()
971 {
972 super.OnHide();
974 {
976 }
977 }
978}
void OnInputPresetChanged()
Definition inventory.c:168
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition inventory.c:175
proto native void RestartMission()
proto native BiosUserManager GetUserManager()
proto native void LogoutRequestTime()
Logout methods.
proto native void RespawnPlayer()
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition game.c:1548
Super root of all classes in Enforce script.
Definition enscript.c:11
static const float ICON_SCALE_NORMAL
Definition inpututils.c:14
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
Mission class.
Definition gameplay.c:687
static bool IsPlayerMuted(string id)
static void ShowInviteScreen()
static void ShowUserProfile(string uid)
static map< string, bool > GetMuteList()
void LoadFooterButtonTexts()
Initial texts load for the footer buttons.
void MenuRequestRespawn(UIScriptedMenu menu, bool random)
void SyncEvent_OnRecievedPlayerList(SyncPlayerList player_list)
override bool OnMouseEnter(Widget w, int x, int y)
override void OnShow()
bool FeedbackDialogVisible()
void OnPermissionsUpdate(BiosPrivacyUidResultArray result_list)
void ColorDisable(Widget w)
ImageWidget m_FeedbackPlatformIcon
ImageWidget m_FeedbackQRCode
override bool OnFocus(Widget w, int x, int y)
void SetMuteButtonText(bool isMuted)
Set mute text button text (mute / unmute)
override void Update(float timeslice)
override void Refresh()
RichTextWidget m_FeedbackCloseLabel
TextWidget m_Version
string m_BackButtonTextID
ButtonWidget m_RestartButton
void ColorHighlight(Widget w)
bool IsFocusable(Widget w)
ButtonWidget m_ShowFeedback
void LoadTextStrings()
Set correct bottom button texts based on platform (ps4 vs xbox texts)
ButtonWidget m_OnlineButton
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
void ButtonSetText(Widget w, string text)
string m_OpenGameCardButtonTextID
const int BUTTON_XBOX_CONTROLS
SyncPlayerList CreateFakePlayerList(int player_count)
ref PlayerListScriptedWidget m_ServerInfoPanel
override void OnHide()
ButtonWidget m_ContinueButton
override bool OnFocusLost(Widget w, int x, int y)
override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
ButtonWidget m_ControlsButton
ButtonWidget m_InviteButton
ButtonWidget m_RestartDeadButton
string m_SelectButtonTextID
Widget m_IngameMenuPanel
bool IsLocalPlayer(string uid)
ButtonWidget m_OptionsButton
string m_MuteButtonTextID
void GameRetry(bool random)
string m_UnmuteButtonTextID
void UpdateControlsElements()
void ButtonSetTextColor(Widget w, int color)
ButtonWidget m_FeedbackClose
override Widget Init()
override bool OnClick(Widget w, int x, int y, int button)
ButtonWidget m_ExitButton
ButtonWidget m_TutorialsButton
void ButtonSetColor(Widget w, int color)
override bool OnModalResult(Widget w, int x, int y, int code, int result)
void ColorNormal(Widget w)
string m_CurrentMuteButtonText
void ToggleFeedbackDialog()
bool ShouldRestartBeVisible(Man player)
void OnInputPresetChanged()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
class JsonControlMappingInfo m_BackButtonTextID
DayZGame g_Game
Definition dayzgame.c:3868
Mission mission
EPlayerStates
proto native CGame GetGame()
const int MENU_TUTORIAL
Definition constants.c:204
const int MENU_XBOX_CONTROLS
Definition constants.c:197
const int MENU_RESPAWN_DIALOGUE
Definition constants.c:209
const int MENU_OPTIONS
Definition constants.c:183
void Continue()
Timer continue when it was paused.
Definition tools.c:247
const int CALL_CATEGORY_GUI
Definition tools.c:9
const int IDC_INT_EXIT
Definition constants.c:160
const int IDC_MAIN_OPTIONS
Definition constants.c:142
const int IDC_MULTI_INVITE
Definition constants.c:152
const int IDC_MAIN_QUIT
Definition constants.c:144
const int IDC_MAIN_CONTINUE
Definition constants.c:145
const int IDC_INT_RETRY
ingame menu
Definition constants.c:158
const int IDC_MAIN_FEEDBACK
Definition constants.c:150
const int IDC_MAIN_TUTORIAL
Definition constants.c:146
const int IDC_MAIN_ONLINE
Definition constants.c:149
Icon x
Icon y
EInputDeviceType
Definition input.c:3
void Close()
PlayerBase GetPlayer()
int ARGB(int a, int r, int g, int b)
Definition proto.c:322
void Refresh()
proto native UAInputAPI GetUApi()