DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
InGameMenuXbox.c
См. документацию.
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
19 private bool m_ExitOnCooldown;
20
21 protected ref PlayerListScriptedWidget m_ServerInfoPanel;
22
24
27 protected ButtonWidget m_ContinueButton;
28 protected ButtonWidget m_ExitButton;
29 protected ButtonWidget m_RestartDeadButton;
30 protected ButtonWidget m_RestartButton;
31 protected ButtonWidget m_OptionsButton;
32 protected ButtonWidget m_InviteButton;
33 protected ButtonWidget m_ControlsButton;
34 protected ButtonWidget m_OnlineButton;
35 protected ButtonWidget m_TutorialsButton;
39
40 protected ButtonWidget m_ShowFeedback;
41 protected ImageWidget m_FeedbackQRCode;
42 protected ImageWidget m_FeedbackPlatformIcon;
43 protected ButtonWidget m_FeedbackClose;
45
46 const int BUTTON_XBOX_CONTROLS = 201;
47
49 {
50 g_Game.GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
51 g_Game.GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
52 }
53
55 {
58
59 Mission mission = g_Game.GetMission();
60 if (mission)
61 {
62 IngameHud hud = IngameHud.Cast(mission.GetHud());
63 if (hud)
64 {
65 hud.ShowHudUI(true);
66 hud.ShowQuickbarUI(true);
67 }
68
69 mission.Continue();
70 }
71
72 PPERequesterBank.GetRequester(PPERequester_MenuEffects).Stop();
73 }
74
75 protected void OnInputPresetChanged()
76 {
77 #ifdef PLATFORM_CONSOLE
79 #endif
80 }
81
82 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
83 {
84 bool mk = g_Game.GetInput().IsEnabledMouseAndKeyboard();
85 bool mkServer = g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
86
87 switch (pInputDeviceType)
88 {
89 case EInputDeviceType.CONTROLLER:
90 {
91 if (mk && mkServer)
92 {
93 g_Game.GetUIManager().ShowUICursor(false);
94 if (!GetFocus() || GetFocus() == m_FeedbackClose)
95 {
97 }
98
99 m_FeedbackClose.Show(false);
100 m_ShowFeedback.Show(false);
101 }
102
103 #ifdef PLATFORM_MSSTORE
104 // Enable controls button on MS Store
105 m_ControlsButton.Show(true);
106 #endif
107 break;
108 }
109 default:
110 {
111 if (mk && mkServer)
112 {
113 g_Game.GetUIManager().ShowUICursor(true);
114 m_ShowFeedback.Show(true);
115 m_FeedbackClose.Show(true);
116
117 #ifdef PLATFORM_MSSTORE
118 // Disable controls button on MS Store
119 m_ControlsButton.Show(false);
120 #endif
121 }
122 break;
123 }
124 }
125
127 }
128
129 override Widget Init()
130 {
131 layoutRoot = g_Game.GetWorkspace().CreateWidgets("gui/layouts/xbox/day_z_ingamemenu_xbox.layout");
132
133 m_OnlineMenu = g_Game.GetWorkspace().CreateWidgets("gui/layouts/xbox/ingamemenu_xbox/online_info_menu.layout", layoutRoot);
134 m_OnlineMenu.Show(false);
135
136 m_IngameMenuPanel = layoutRoot.FindAnyWidget("ingame_menu_panel");
137 m_ContinueButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("continuebtn"));
138 m_RestartDeadButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("restartbtn_dead"));
139 m_ExitButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("exitbtn"));
140 m_RestartButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("restartbtn"));
141 m_OptionsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("optionsbtn"));
142 m_InviteButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("invitebtn"));
143 m_ControlsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("controlsbtn"));
144 m_OnlineButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("onlinebtn"));
145 m_TutorialsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("tutorialsbtn"));
146 m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget("version"));
147 m_ShowFeedback = ButtonWidget.Cast(layoutRoot.FindAnyWidget("feedbackbtn"));
148 m_FeedbackQRCode = ImageWidget.Cast(layoutRoot.FindAnyWidget("qr_image"));
149 m_FeedbackClose = ButtonWidget.Cast(layoutRoot.FindAnyWidget("close_button"));
150 m_FeedbackCloseLabel = RichTextWidget.Cast(layoutRoot.FindAnyWidget("close_button_label"));
151 m_DialogPanel = layoutRoot.FindAnyWidget("ingame_menu_dialog");
152 m_ExitButtonLabel = TextWidget.Cast(layoutRoot.FindAnyWidget("exitbtn_label"));
153 m_ExitButtonTime = TextWidget.Cast(layoutRoot.FindAnyWidget("exitbtn_time"));
154
155 m_SelectAvailable = true;
156 m_MuteAvailable = false;
157 m_GamercardAvailable = false;
158 m_BackAvailable = true;
159
160 #ifdef PLATFORM_MSSTORE
161 // Hide "controls button" on MS Store
162 m_ControlsButton.Show(false);
163 #endif
164
165 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
166 if (player)
167 {
168 m_PlayerAlive = player.GetPlayerState() == EPlayerStates.ALIVE;
169 if (!m_PlayerAlive)
170 m_BackAvailable = false;
171
172 player.GetOnUnconsciousStart().Insert(UpdateGUI);
173 player.GetOnUnconsciousStart().Insert(UpdateMenuFocus);
174 player.GetOnUnconsciousStop().Insert(UpdateGUI);
175 player.GetOnUnconsciousStop().Insert(UpdateMenuFocus);
176 player.GetOnDeathStart().Insert(UpdateGUI);
177 player.GetOnDeathStart().Insert(UpdateMenuFocus);
178 }
179
180 string version;
181 g_Game.GetVersion(version);
182 #ifdef PLATFORM_CONSOLE
183 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
184 #else
185 version = "#main_menu_version" + " " + version;
186 #endif
187 m_Version.SetText(version);
188
189 if (g_Game.IsMultiplayer())
190 {
191 m_OnlineButton.Show(true);
192
193 TextWidget w_text = TextWidget.Cast(m_OnlineMenu.FindAnyWidget("OnlineTextWidget"));
194 w_text.SetText(g_Game.GetHostName());
195
196 m_ServerInfoPanel = new PlayerListScriptedWidget(m_OnlineMenu.FindAnyWidget("ServerInfoPanel"));
197
200
203
204 string uid = m_ServerInfoPanel.FindPlayerByWidget(GetFocus());
205 if (uid != "")
206 {
207 if (IsLocalPlayer(uid) || m_ServerInfoPanel.IsEmpty())
208 {
209 m_MuteAvailable = false;
210 m_GamercardAvailable = false;
211 }
212 else
213 {
214 m_MuteAvailable = !g_Game.GetWorld().IsDisabledReceivingVoN();
215 #ifndef PLATFORM_PS4
217 #endif
219 }
220
221 if (m_ServerInfoPanel.IsGloballyMuted(uid))
222 {
223 m_MuteAvailable = false;
224 }
225 }
227 }
228 else
229 {
230 layoutRoot.FindAnyWidget("onlinebtn").Show(false);
231 layoutRoot.FindAnyWidget("invitebtn").Show(false);
232 }
233
234 //RESPAWN & RESTART
235 if (g_Game.IsMultiplayer())
236 {
237 m_RestartButton.SetText("#main_menu_respawn");
238 }
239 else
240 {
241 m_RestartButton.SetText("#main_menu_restart");
242 }
243
244 if (!ShouldRestartBeVisible(player))
245 {
246 m_RestartButton.Show(false);
247 }
248
249 Mission mission = g_Game.GetMission();
250 if (mission)
251 {
252 IngameHud hud = IngameHud.Cast(mission.GetHud());
253 if (hud)
254 {
255 hud.ShowHudUI(false);
256 hud.ShowQuickbarUI(false);
257 }
258
259 mission.Pause();
260 }
261
262 PPERequester_MenuEffects requester;
263 Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
264 requester.SetVignetteIntensity(0.6);
265
268
269 m_FeedbackQRCode.LoadImageFile(0, "gui/textures/feedback_qr.edds");
270
271 return layoutRoot;
272 }
273
274 override bool OnClick(Widget w, int x, int y, int button)
275 {
276 super.OnClick(w, x, y, button);
277
279 {
280 switch (w.GetUserID())
281 {
283 {
284 if (!IsOnlineOpen())
285 {
286 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(g_Game.GetMission().Continue);
287 }
288 else
289 {
290 CloseOnline();
291 }
292 return true;
293 }
294 case IDC_MAIN_OPTIONS:
295 {
296 EnterScriptedMenu(MENU_OPTIONS);
297 return true;
298 }
300 {
301 EnterScriptedMenu(MENU_XBOX_CONTROLS);
302 return true;
303 }
304 case IDC_MAIN_QUIT:
305 {
306 g_Game.GetUIManager().ShowDialog("#main_menu_exit", "#main_menu_exit_desc", IDC_INT_EXIT, DBT_YESNO, DBB_YES, DMT_QUESTION, NULL);
307 return true;
308 }
309 case IDC_INT_RETRY:
310 {
311 if (!g_Game.IsMultiplayer())
312 {
313 g_Game.GetUIManager().ShowDialog("#main_menu_restart", "Are you sure you want to restart?", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
314 }
315 else
316 {
317 g_Game.GetUIManager().ShowDialog("#main_menu_respawn", "#main_menu_respawn_question", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
318 }
319 return true;
320 }
321 case IDC_MAIN_ONLINE:
322 {
323 OpenOnline();
324 return true;
325 }
327 {
328 EnterScriptedMenu(MENU_TUTORIAL);
329 return true;
330 }
331 case IDC_MULTI_INVITE:
332 {
334 return true;
335 }
336 }
337
338 if (w == m_RestartDeadButton)
339 {
340 if (g_Game.GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
341 {
342 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(g_Game.GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
343 }
344 else
345 {
346 GameRetry(true);
347 }
348 return true;
349 }
350 }
351 else
352 {
353 if (w == m_FeedbackClose)
354 {
356 return true;
357 }
358 }
359
360 if (w.GetUserID() == IDC_MAIN_FEEDBACK && !IsOnlineOpen())
361 {
363 return true;
364 }
365
366 return false;
367 }
368
369 protected void ToggleFeedbackDialog()
370 {
371 bool dialogVisible = FeedbackDialogVisible();
372 m_DialogPanel.Show(!dialogVisible);
373 m_IngameMenuPanel.Show(dialogVisible);
374
375 if (!dialogVisible)
376 {
377 PPERequesterBank.GetRequester(PPERequester_FeedbackBlur).Start();
378 }
379 else
380 {
381 PPERequesterBank.GetRequester(PPERequester_FeedbackBlur).Stop();
382 }
383
386 }
387
389 {
390 return m_DialogPanel.IsVisible();
391 }
392
393 override bool OnModalResult(Widget w, int x, int y, int code, int result)
394 {
395 super.OnModalResult(w, x, y, code, result);
396
397 if (code == IDC_INT_EXIT && result == DBB_YES)
398 {
399 if (g_Game.IsMultiplayer())
400 {
401 MissionGameplay mission = MissionGameplay.Cast(g_Game.GetMission());
402 ScriptCallQueue scQueue = g_Game.GetCallQueue(CALL_CATEGORY_GUI);
403
404 g_Game.LogoutRequestTime();
405 scQueue.Call(mission.CreateLogoutMenu, this);
406
407 int logoutAfterCancelTimeout = g_Game.GetLogoutAfterCancelTimeout();
408 if (logoutAfterCancelTimeout > 0)
409 {
410 mission.SetExitButtonDisabledRemainingTime(logoutAfterCancelTimeout);
413 }
414 }
415 else
416 {
417 // skip logout screen in singleplayer
418 g_Game.GetMission().AbortMission();
419 }
420 g_Game.CancelLoginTimeCountdown();
421
422 return true;
423
424 }
425 else if (code == IDC_INT_EXIT && result == DBB_NO)
426 {
427 g_Game.CancelLoginTimeCountdown();
428 }
429 else if (code == IDC_INT_RETRY)
430 {
431 if (result == DBB_YES)
432 {
433 if (g_Game.GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
434 {
435 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(g_Game.GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
436 }
437 else
438 {
439 GameRetry(true);
440 return true;
441 }
442 }
443 else
444 {
446 }
447 }
448
449 return false;
450 }
451
452 void GameRetry(bool random)
453 {
454 if (g_Game.IsMultiplayer())
455 {
456 g_Game.GetMenuDefaultCharacterData(false).SetRandomCharacterForced(random);
457 g_Game.RespawnPlayer();
458
459 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
460 if (player)
461 {
462 player.SimulateDeath(true);
463 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(player.ShowDeadScreen, true, 0);
464 }
465
466 MissionGameplay missionGP = MissionGameplay.Cast(g_Game.GetMission());
467 missionGP.DestroyAllMenus();
468 missionGP.SetPlayerRespawning(true);
469 missionGP.Continue();
470
471 Close();
472 }
473 else
474 {
475 g_Game.RestartMission();
476 }
477 }
478
479 void MenuRequestRespawn(UIScriptedMenu menu, bool random)
480 {
481 if (RespawnDialogue.Cast(menu))
482 {
483 GameRetry(random);
484 }
485 }
486
487 bool IsLocalPlayer(string uid)
488 {
489 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
490 string local_uid;
491 if (g_Game.GetUserManager())
492 {
493 local_uid = g_Game.GetUserManager().GetSelectedUser().GetUid();
494 }
495
496 return (uid == local_uid);
497 }
498
500 {
501 SyncPlayerList player_list = new SyncPlayerList;
502 player_list.m_PlayerList = new array<ref SyncPlayer>;
503
504 for (int i = 0; i < player_count; i++)
505 {
506 SyncPlayer sync_player = new SyncPlayer;
507 sync_player.m_UID = "uid" + i;
508 sync_player.m_PlayerName = "Player " + i;
509 player_list.m_PlayerList.Insert(sync_player);
510 }
511
512 return player_list;
513 }
514
515 private void UpdateExitButtonState()
516 {
517 MissionGameplay mission = MissionGameplay.Cast(g_Game.GetMission());
518 float remainingTime = mission.GetExitButtonDisabledRemainingTime();
519 if (remainingTime > 0)
520 {
521 m_ExitOnCooldown = true;
522
523 m_ExitButtonTime.Show(true);
524 layoutRoot.FindAnyWidget("exitbtn_label1").Show(true);
525 layoutRoot.FindAnyWidget("spacer1").Show(true);
526 layoutRoot.FindAnyWidget("spacer2").Show(true);
527
528 m_ExitButtonLabel.SetColor(ARGB(128, 255, 255, 255));
529 m_ExitButtonLabel.SetText("#main_menu_exit (");
530 m_ExitButtonTime.SetText("" + Math.Round(remainingTime) + "s");
531 m_ExitButton.Enable(false);
532 }
533 else
534 {
535 m_ExitButton.Enable(true);
536 m_ExitButtonLabel.SetColor(ARGB(255, 255, 255, 255));
537 m_ExitButtonLabel.SetText("#main_menu_exit");
538 m_ExitButtonTime.SetText("");
539
540 m_ExitButtonTime.Show(false);
541 layoutRoot.FindAnyWidget("exitbtn_label1").Show(false);
542 layoutRoot.FindAnyWidget("spacer1").Show(false);
543 layoutRoot.FindAnyWidget("spacer2").Show(false);
544
545 m_ExitOnCooldown = false;
546 }
547 }
548
549 override void Update(float timeslice)
550 {
551 super.Update(timeslice);
552
553 m_ExitButtonUpdateTimerSum += timeslice;
554
556 {
559 }
560
561 if (GetUApi().GetInputByID(UAUIThumbRight).LocalPress() && !IsOnlineOpen() || FeedbackDialogVisible() && GetUApi().GetInputByID(UAUIBack).LocalPress())
562 {
564 }
565
566 if (g_Game.IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible())
567 {
568 PlayerListEntryScriptedWidget selected;
570 {
571 selected = m_ServerInfoPanel.GetSelectedPlayer();
572 }
573
574 if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
575 {
576 if (selected)
577 {
578 m_ServerInfoPanel.ToggleMute(selected.GetUID());
579 }
580
581 Refresh();
582 }
583
584 #ifndef PLATFORM_PS4
585 if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
586 {
587 if (selected)
588 {
589 OnlineServices.ShowUserProfile(selected.GetUID());
590 }
591 }
592 #endif
593 }
594 }
595
596 bool ShouldRestartBeVisible(Man player)
597 {
598 PlayerBase p = PlayerBase.Cast(player);
599 return p && p.IsUnconsciousStateOnly() && !CfgGameplayHandler.GetDisableRespawnInUnconsciousness();
600 }
601
603 {
604 bool shouldUpdateMenuFocus = false;
605 Man player = g_Game.GetPlayer();
606 if (player)
607 {
608 m_PlayerAlive = player.GetPlayerState() == EPlayerStates.ALIVE;
609 }
610
611 if (m_PlayerAlive)
612 {
613 bool showRestartBtn = ShouldRestartBeVisible(player);
614 m_RestartButton.Show(showRestartBtn);
615 }
616 else
617 {
618 m_RestartButton.Show(false);
619 m_BackAvailable = false;
620 }
621
624
626 }
627
629 {
630 return m_OnlineMenu.IsVisible();
631 }
632
633 protected void OpenOnline()
634 {
635 m_ExitButton.Show(false);
636 m_OnlineMenu.Show(true);
637 m_SelectAvailable = false;
638
640 m_ServerInfoPanel.FocusFirst();
642 }
643
645 {
646 m_ExitButton.Show(true);
647 m_OnlineMenu.Show(false);
648 m_SelectAvailable = true;
649 m_MuteAvailable = false;
650 m_GamercardAvailable = false;
651
655 }
656
658 {
660 {
661 m_ServerInfoPanel.FocusFirst();
662
663 Refresh();
664 }
665 }
666
667 override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
668 {
669 return false;
670 }
671
673 {
674 m_ServerInfoPanel.Reload(player_list);
675
676 Refresh();
677 }
678
680 {
681 m_ServerInfoPanel.Reload(result_list);
682
683 Refresh();
684 }
685
686 override void OnShow()
687 {
688 super.OnShow();
689
690 #ifdef PLATFORM_CONSOLE
691 #ifndef PLATFORM_MSSTORE
692 bool mk = g_Game.GetInput().IsEnabledMouseAndKeyboard();
693 bool mk_server = g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
694 TextWidget warning = TextWidget.Cast(layoutRoot.FindAnyWidget("MouseAndKeyboardWarning"));
695 if (mk)
696 {
697 if (mk_server)
698 {
699 warning.SetText("#str_mouse_and_keyboard_server_warning");
700 }
701 else
702 {
703 warning.SetText("#str_controller_server_warning");
704 }
705 }
706
707 warning.Show(mk);
708 #endif
709 #endif
710
711 UpdateGUI();
712
714 OnInputDeviceChanged(g_Game.GetInput().GetCurrentInputDevice());
715 }
716
717 override bool OnMouseEnter(Widget w, int x, int y)
718 {
719 if (w == m_ExitButton && m_ExitOnCooldown)
720 return false;
721
722 if (IsFocusable(w))
723 {
725 return true;
726 }
727 return false;
728 }
729
730 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
731 {
732 if (w == m_ExitButton && m_ExitOnCooldown)
733 return false;
734
735 if (IsFocusable(w))
736 {
737 ColorNormal(w);
738 return true;
739 }
740 return false;
741 }
742
743 override bool OnFocus(Widget w, int x, int y)
744 {
745 if (w == m_ExitButton && m_ExitOnCooldown)
746 return false;
747
748 if (IsFocusable(w))
749 {
751 return true;
752 }
753 return false;
754 }
755
756 override bool OnFocusLost(Widget w, int x, int y)
757 {
758 if (w == m_ExitButton && m_ExitOnCooldown)
759 return false;
760
761 if (IsFocusable(w))
762 {
763 ColorNormal(w);
764 return true;
765 }
766 return false;
767 }
768
770 {
771 if (w)
772 {
774 {
775 return true;
776 }
777 }
778 return false;
779 }
780
781 override void Refresh()
782 {
783 string version;
784 g_Game.GetVersion(version);
785 #ifdef PLATFORM_CONSOLE
786 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
787 #else
788 version = "#main_menu_version" + " " + version;
789 #endif
790 m_Version.SetText(version);
791
792 m_MuteAvailable = false;
793 m_GamercardAvailable = false;
794
795 if (g_Game.IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible() && m_ServerInfoPanel)
796 {
797 PlayerListEntryScriptedWidget selected = m_ServerInfoPanel.GetSelectedPlayer();
798 if (selected && !selected.IsLocalPlayer())
799 {
800 m_MuteAvailable = !g_Game.GetWorld().IsDisabledReceivingVoN() && !selected.IsGloballyMuted();
801 #ifndef PLATFORM_PS4
803 #endif
804 SetMuteButtonText(selected.IsMuted());
805 }
806 }
807
809 }
810
812 {
813 #ifdef PLATFORM_WINDOWS
814 SetFocus(null);
815 #endif
816
817 ButtonWidget button = ButtonWidget.Cast(w);
818 if (button && button != m_ContinueButton)
819 {
820 button.SetTextColor(ARGB(255, 255, 255, 255));
821 }
822 ButtonSetColor(w, ARGB(0, 0, 0, 0));
823 ButtonSetTextColor(w, ARGB(60, 0, 0, 0));
824 }
825
827 {
828 if (!w)
829 {
830 return;
831 }
832
833 int color_pnl = ARGB(255, 0, 0, 0);
834 int color_lbl = ARGB(255, 255, 0, 0);
835
836 #ifdef PLATFORM_CONSOLE
837 color_pnl = ARGB(255, 200, 0, 0);
838 color_lbl = ARGB(255, 255, 255, 255);
839 #endif
840
841 ButtonSetColor(w, color_pnl);
842 ButtonSetTextColor(w, color_lbl);
843 }
844
846 {
847 if (!w) return;
848
849 int color_pnl = ARGB(0, 0, 0, 0);
850 int color_lbl = ARGB(255, 255, 255, 255);
851
852 ButtonSetColor(w, color_pnl);
853 ButtonSetTextColor(w, color_lbl);
854 }
855
856 void ButtonSetText(Widget w, string text)
857 {
858 if (!w)
859 {
860 return;
861 }
862
863 TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
864 if (label)
865 {
866 label.SetText(text);
867 }
868
869 }
870
871 void ButtonSetColor(Widget w, int color)
872 {
873 if (!w)
874 {
875 return;
876 }
877
878 Widget panel = w.FindWidget(w.GetName() + "_panel");
879 if (panel)
880 {
881 panel.SetColor(color);
882 }
883 }
884
885 void ButtonSetTextColor(Widget w, int color)
886 {
887 if (!w)
888 {
889 return;
890 }
891
892 TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
893 TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
894 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
895
896 if (label)
897 {
898 label.SetColor(color);
899 }
900
901 if (text)
902 {
903 text.SetColor(color);
904 }
905
906 if (text2)
907 {
908 text2.SetColor(color);
909 }
910 }
911
913 protected void SetMuteButtonText(bool isMuted)
914 {
915 if (isMuted)
916 {
918 }
919 else
920 {
922 }
923 }
924
926 protected void LoadTextStrings()
927 {
928 #ifdef PLATFORM_PS4
929 m_MuteButtonTextID = "#ps4_ingame_menu_mute";
930 m_UnmuteButtonTextID = "#ps4_ingame_menu_unmute";
931 m_BackButtonTextID = "#ps4_ingame_menu_back";
932 m_SelectButtonTextID = "#ps4_ingame_menu_select";
933 m_OpenGameCardButtonTextID = "#ps4_ingame_menu_opencard";
934 #else
935 m_MuteButtonTextID = "#xbox_ingame_menu_mute";
936 m_UnmuteButtonTextID = "#xbox_ingame_menu_unmute";
937 m_BackButtonTextID = "#STR_rootFrame_toolbar_bg_ConsoleToolbar_Back_BackText0";
938 m_SelectButtonTextID = "#layout_xbox_ingame_menu_select";
939 m_OpenGameCardButtonTextID = "#layout_xbox_ingame_menu_gamecard";
940 #endif
941 }
942
944 protected void LoadFooterButtonTexts()
945 {
946 TextWidget uiGamecardText = TextWidget.Cast(layoutRoot.FindAnyWidget("GamercardText"));
947 TextWidget uiBackText = TextWidget.Cast(layoutRoot.FindAnyWidget("BackText"));
948 TextWidget uiSelectText = TextWidget.Cast(layoutRoot.FindAnyWidget("SelectText"));
949
950 if (uiGamecardText)
951 {
952 uiGamecardText.SetText(m_OpenGameCardButtonTextID);
953 }
954
955 if (uiBackText)
956 {
957 uiBackText.SetText(m_BackButtonTextID);
958 }
959
960 if (uiSelectText)
961 {
962 uiSelectText.SetText(m_SelectButtonTextID);
963 }
964 }
965
967 {
968 Man player = g_Game.GetPlayer();
969 if (m_PlayerAlive)
970 {
971 if (ShouldRestartBeVisible(player))
972 {
974 }
975 else
976 {
978 }
979 }
980 else
981 {
983 }
984 }
985
986 protected void UpdateControlsElements()
987 {
988 bool toolbarShow = !g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || g_Game.GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
989 bool onlineOpen = IsOnlineOpen();
990 layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
991 layoutRoot.FindAnyWidget("top").Show(!onlineOpen);
992
993 RichTextWidget toolbarTextWidget = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
994 string toolbarText = "";
995
997 if (toolbarShow)
998 {
1000 {
1002 {
1003 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", m_SelectButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1004 }
1005
1006 if (m_MuteAvailable)
1007 {
1008 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", m_CurrentMuteButtonText, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1009 }
1010
1011 if (m_BackAvailable)
1012 {
1013 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", m_BackButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1014 }
1015
1017 {
1018 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", m_OpenGameCardButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1019 }
1020
1021 if (!IsOnlineOpen())
1022 {
1023 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIThumbRight", "#layout_main_menu_feedback", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1024 }
1025 }
1026 else
1027 {
1028 toolbarText = InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#close", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR);
1029 }
1030 }
1031
1032 toolbarTextWidget.SetText(toolbarText);
1033
1035 string continueBtnLabel = "#main_menu_continue";
1036 if (onlineOpen)
1037 continueBtnLabel = "#layout_character_creation_back";
1038
1039 TextWidget continueBtnTextWidget = TextWidget.Cast(layoutRoot.FindAnyWidget("continuebtn_label"));
1040 continueBtnTextWidget.SetText(continueBtnLabel);
1041 layoutRoot.FindAnyWidget("dayz_logo").Show(!onlineOpen);
1042 }
1043
1044 override void OnHide()
1045 {
1046 super.OnHide();
1048 {
1050 }
1051 }
1052}
array< ref BiosPrivacyUidResult > BiosPrivacyUidResultArray
Определения BiosPrivacyService.c:49
DayZGame g_Game
Определения DayZGame.c:4074
Mission mission
Определения DisplayStatus.c:28
EPlayerStates
Определения EPlayerStates.c:2
Icon x
Icon y
void Close()
proto native UAInputAPI GetUApi()
static bool GetDisableRespawnInUnconsciousness()
Определения CfgGameplayHandler.c:188
Super root of all classes in Enforce script.
Определения EnScript.c:11
static ref ScriptInvoker SyncEvent_OnPlayerListUpdate
Определения ClientData.c:3
static ref SyncPlayerList m_PlayerList
Определения ClientData.c:8
Определения ClientData.c:2
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Определения InputUtils.c:167
static const float ICON_SCALE_TOOLBAR
Определения InputUtils.c:15
Определения InputUtils.c:2
Определения EnMath.c:7
Mission class.
Определения gameplay.c:686
static ref ScriptInvoker m_PermissionsAsyncInvoker
Определения OnlineServices.c:4
static bool IsPlayerMuted(string id)
Определения OnlineServices.c:360
static void ShowInviteScreen()
Определения OnlineServices.c:395
static void ShowUserProfile(string uid)
Определения OnlineServices.c:250
static map< string, bool > GetMuteList()
Определения OnlineServices.c:390
Определения OnlineServices.c:2
Определения PlayerBaseClient.c:2
Определения gameplay.c:317
proto void Call(func fn, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but l...
Определения 2_GameLib/DayZ/tools.c:53
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
string m_PlayerName
Определения SyncPlayer.c:11
string m_UID
Keeping for backwards compatability with mods.
Определения SyncPlayer.c:8
Определения SyncPlayer.c:2
ref array< ref SyncPlayer > m_PlayerList
Определения SyncPlayerList.c:3
Определения SyncPlayerList.c:2
Определения EnWidgets.c:220
void LoadFooterButtonTexts()
Initial texts load for the footer buttons.
Определения InGameMenuXbox.c:944
void MenuRequestRespawn(UIScriptedMenu menu, bool random)
Определения InGameMenuXbox.c:479
TextWidget m_ExitButtonTime
Определения InGameMenuXbox.c:38
void SyncEvent_OnRecievedPlayerList(SyncPlayerList player_list)
Определения InGameMenuXbox.c:672
override bool OnMouseEnter(Widget w, int x, int y)
Определения InGameMenuXbox.c:717
Widget m_ExitButton
Определения InGameMenu.c:7
override void OnShow()
Определения InGameMenuXbox.c:686
bool FeedbackDialogVisible()
Определения InGameMenuXbox.c:388
void OnPermissionsUpdate(BiosPrivacyUidResultArray result_list)
Определения InGameMenuXbox.c:679
void ColorDisable(Widget w)
Определения InGameMenuXbox.c:811
ImageWidget m_FeedbackPlatformIcon
Определения InGameMenuXbox.c:42
ImageWidget m_FeedbackQRCode
Определения InGameMenuXbox.c:41
Widget m_DialogPanel
Определения InGameMenuXbox.c:26
override bool OnFocus(Widget w, int x, int y)
Определения InGameMenuXbox.c:743
void SetMuteButtonText(bool isMuted)
Set mute text button text (mute / unmute)
Определения InGameMenuXbox.c:913
override void Update(float timeslice)
Определения InGameMenuXbox.c:549
bool m_SelectAvailable
Определения InGameMenuXbox.c:11
override void Refresh()
Определения ChatInputMenu.c:70
RichTextWidget m_FeedbackCloseLabel
Определения InGameMenuXbox.c:44
TextWidget m_Version
Определения InGameMenuXbox.c:36
string m_BackButtonTextID
Определения ControlsXboxNew.c:30
void UpdateMenuFocus()
Определения InGameMenuXbox.c:966
Widget m_ContinueButton
Определения InGameMenu.c:5
bool m_PlayerAlive
Определения InGameMenuXbox.c:16
void ColorHighlight(Widget w)
Определения ControlsXboxNew.c:454
bool IsFocusable(Widget w)
Определения CameraToolsMenu.c:960
ButtonWidget m_ShowFeedback
Определения InGameMenuXbox.c:40
float m_ExitButtonUpdateTimerSum
Определения InGameMenuXbox.c:18
void LoadTextStrings()
Set correct bottom button texts based on platform (ps4 vs xbox texts)
Определения InGameMenuXbox.c:926
ButtonWidget m_OnlineButton
Определения InGameMenuXbox.c:34
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Определения ControlsXboxNew.c:71
Widget m_RestartButton
Определения InGameMenu.c:8
bool m_ExitOnCooldown
Определения InGameMenuXbox.c:19
void ButtonSetText(Widget w, string text)
Определения InGameMenuXbox.c:856
string m_OpenGameCardButtonTextID
Определения InGameMenuXbox.c:8
bool m_GamercardAvailable
Определения InGameMenuXbox.c:14
const int BUTTON_XBOX_CONTROLS
Определения InGameMenuXbox.c:46
SyncPlayerList CreateFakePlayerList(int player_count)
Определения InGameMenuXbox.c:499
Widget m_OptionsButton
Определения InGameMenu.c:12
void UpdateExitButtonState()
Определения InGameMenuXbox.c:515
TextWidget m_ExitButtonLabel
Определения InGameMenuXbox.c:37
override void OnHide()
Определения InGameMenuXbox.c:1044
override bool OnFocusLost(Widget w, int x, int y)
Определения InGameMenuXbox.c:756
override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
Определения InGameMenuXbox.c:667
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения InGameMenuXbox.c:730
ButtonWidget m_ControlsButton
Определения InGameMenuXbox.c:33
ButtonWidget m_InviteButton
Определения InGameMenuXbox.c:32
Widget m_ServerInfoPanel
Определения InGameMenu.c:13
void UpdateGUI()
Определения InGameMenu.c:314
ButtonWidget m_RestartDeadButton
Определения InGameMenuXbox.c:29
string m_SelectButtonTextID
Определения InGameMenuXbox.c:7
Widget m_IngameMenuPanel
Определения InGameMenuXbox.c:25
bool IsLocalPlayer(string uid)
Определения InGameMenuXbox.c:487
string m_MuteButtonTextID
Определения InGameMenuXbox.c:4
void InGameMenuXbox()
Определения InGameMenuXbox.c:48
Widget m_OnlineMenu
Определения InGameMenuXbox.c:23
void GameRetry(bool random)
Определения InGameMenuXbox.c:452
string m_UnmuteButtonTextID
Определения InGameMenuXbox.c:5
void UpdateControlsElements()
Определения ControlsXboxNew.c:535
void ~InGameMenuXbox()
Определения InGameMenuXbox.c:54
void RespawnDialogue()
void OpenOnline()
Определения InGameMenuXbox.c:633
void ButtonSetTextColor(Widget w, int color)
Определения ControlsXboxNew.c:510
ButtonWidget m_FeedbackClose
Определения InGameMenuXbox.c:43
bool m_MuteAvailable
Определения InGameMenuXbox.c:12
override Widget Init()
Определения InGameMenuXbox.c:129
void SelectServer()
Определения InGameMenuXbox.c:657
void CloseOnline()
Определения InGameMenuXbox.c:644
override bool OnClick(Widget w, int x, int y, int button)
Определения InGameMenuXbox.c:274
ButtonWidget m_TutorialsButton
Определения InGameMenuXbox.c:35
void ButtonSetColor(Widget w, int color)
Определения ControlsXboxNew.c:497
override bool OnModalResult(Widget w, int x, int y, int code, int result)
Определения InGameMenuXbox.c:393
void ColorNormal(Widget w)
Определения ControlsXboxNew.c:471
string m_CurrentMuteButtonText
Определения InGameMenuXbox.c:9
void ToggleFeedbackDialog()
Определения InGameMenuXbox.c:369
bool IsOnlineOpen()
Определения InGameMenuXbox.c:628
bool m_BackAvailable
Определения InGameMenuXbox.c:13
bool ShouldRestartBeVisible(Man player)
Определения InGameMenuXbox.c:596
void OnInputPresetChanged()
Определения ControlsXboxNew.c:63
Определения DayZGame.c:64
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
const int RESPAWN_MODE_CUSTOM
Определения 3_Game/DayZ/constants.c:1108
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Round(float f)
Returns mathematical round of value.
const int MENU_TUTORIAL
Определения 3_Game/DayZ/constants.c:210
const int MENU_XBOX_CONTROLS
Определения 3_Game/DayZ/constants.c:203
const int MENU_RESPAWN_DIALOGUE
Определения 3_Game/DayZ/constants.c:215
const int MENU_OPTIONS
Определения 3_Game/DayZ/constants.c:189
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 CALL_CATEGORY_GUI
Определения 3_Game/DayZ/tools/tools.c:9
const int IDC_INT_EXIT
Определения 3_Game/DayZ/constants.c:166
const int IDC_MAIN_OPTIONS
Определения 3_Game/DayZ/constants.c:148
const int IDC_MULTI_INVITE
Определения 3_Game/DayZ/constants.c:158
const int IDC_MAIN_QUIT
Определения 3_Game/DayZ/constants.c:150
const int IDC_MAIN_CONTINUE
Определения 3_Game/DayZ/constants.c:151
const int IDC_INT_RETRY
ingame menu
Определения 3_Game/DayZ/constants.c:164
const int IDC_MAIN_FEEDBACK
Определения 3_Game/DayZ/constants.c:156
const int IDC_MAIN_TUTORIAL
Определения 3_Game/DayZ/constants.c:152
const int IDC_MAIN_ONLINE
Определения 3_Game/DayZ/constants.c:155
proto native Widget GetFocus()
proto native void SetFocus(Widget w)
EInputDeviceType
Определения input.c:3
int ARGB(int a, int r, int g, int b)
Определения proto.c:322