DayZ 1.29
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 #ifdef PLATFORM_PS4
270 m_FeedbackQRCode.LoadImageFile(0, "gui/textures/feedback_qr_ps.edds");
271 #else
272 m_FeedbackQRCode.LoadImageFile(0, "gui/textures/feedback_qr_xbox.edds");
273 #endif
274
275 return layoutRoot;
276 }
277
278 override bool OnClick(Widget w, int x, int y, int button)
279 {
280 super.OnClick(w, x, y, button);
281
283 {
284 switch (w.GetUserID())
285 {
287 {
288 if (!IsOnlineOpen())
289 {
290 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(g_Game.GetMission().Continue);
291 }
292 else
293 {
294 CloseOnline();
295 }
296 return true;
297 }
298 case IDC_MAIN_OPTIONS:
299 {
300 EnterScriptedMenu(MENU_OPTIONS);
301 return true;
302 }
304 {
305 EnterScriptedMenu(MENU_XBOX_CONTROLS);
306 return true;
307 }
308 case IDC_MAIN_QUIT:
309 {
310 g_Game.GetUIManager().ShowDialog("#main_menu_exit", "#main_menu_exit_desc", IDC_INT_EXIT, DBT_YESNO, DBB_YES, DMT_QUESTION, NULL);
311 return true;
312 }
313 case IDC_INT_RETRY:
314 {
315 if (!g_Game.IsMultiplayer())
316 {
317 g_Game.GetUIManager().ShowDialog("#main_menu_restart", "Are you sure you want to restart?", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
318 }
319 else
320 {
321 g_Game.GetUIManager().ShowDialog("#main_menu_respawn", "#main_menu_respawn_question", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
322 }
323 return true;
324 }
325 case IDC_MAIN_ONLINE:
326 {
327 m_OnlineMenu.Show(true);
328 m_SelectAvailable = false;
329
331 m_ServerInfoPanel.FocusFirst();
332 return true;
333 }
335 {
336 EnterScriptedMenu(MENU_TUTORIAL);
337 return true;
338 }
339 case IDC_MULTI_INVITE:
340 {
342 return true;
343 }
344 }
345
346 if (w == m_RestartDeadButton)
347 {
348 if (g_Game.GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
349 {
350 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(g_Game.GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
351 }
352 else
353 {
354 GameRetry(true);
355 }
356 return true;
357 }
358 }
359 else
360 {
361 if (w == m_FeedbackClose)
362 {
364 return true;
365 }
366 }
367
368 if (w.GetUserID() == IDC_MAIN_FEEDBACK && !IsOnlineOpen())
369 {
371 return true;
372 }
373
374 return false;
375 }
376
377 protected void ToggleFeedbackDialog()
378 {
379 bool dialogVisible = FeedbackDialogVisible();
380 m_DialogPanel.Show(!dialogVisible);
381 m_IngameMenuPanel.Show(dialogVisible);
382
383 if (!dialogVisible)
384 {
385 PPERequesterBank.GetRequester(PPERequester_FeedbackBlur).Start();
386 }
387 else
388 {
389 PPERequesterBank.GetRequester(PPERequester_FeedbackBlur).Stop();
390 }
391
394 }
395
397 {
398 return m_DialogPanel.IsVisible();
399 }
400
401 override bool OnModalResult(Widget w, int x, int y, int code, int result)
402 {
403 super.OnModalResult(w, x, y, code, result);
404
405 if (code == IDC_INT_EXIT && result == DBB_YES)
406 {
407 if (g_Game.IsMultiplayer())
408 {
409 MissionGameplay mission = MissionGameplay.Cast(g_Game.GetMission());
410 ScriptCallQueue scQueue = g_Game.GetCallQueue(CALL_CATEGORY_GUI);
411
412 g_Game.LogoutRequestTime();
413 scQueue.Call(mission.CreateLogoutMenu, this);
414
415 int logoutAfterCancelTimeout = g_Game.GetLogoutAfterCancelTimeout();
416 if (logoutAfterCancelTimeout > 0)
417 {
418 mission.SetExitButtonDisabledRemainingTime(logoutAfterCancelTimeout);
421 }
422 }
423 else
424 {
425 // skip logout screen in singleplayer
426 g_Game.GetMission().AbortMission();
427 }
428 g_Game.CancelLoginTimeCountdown();
429
430 return true;
431
432 }
433 else if (code == IDC_INT_EXIT && result == DBB_NO)
434 {
435 g_Game.CancelLoginTimeCountdown();
436 }
437 else if (code == IDC_INT_RETRY)
438 {
439 if (result == DBB_YES)
440 {
441 if (g_Game.GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
442 {
443 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(g_Game.GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
444 }
445 else
446 {
447 GameRetry(true);
448 return true;
449 }
450 }
451 else
452 {
454 }
455 }
456
457 return false;
458 }
459
460 void GameRetry(bool random)
461 {
462 if (g_Game.IsMultiplayer())
463 {
464 g_Game.GetMenuDefaultCharacterData(false).SetRandomCharacterForced(random);
465 g_Game.RespawnPlayer();
466
467 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
468 if (player)
469 {
470 player.SimulateDeath(true);
471 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(player.ShowDeadScreen, true, 0);
472 }
473
474 MissionGameplay missionGP = MissionGameplay.Cast(g_Game.GetMission());
475 missionGP.DestroyAllMenus();
476 missionGP.SetPlayerRespawning(true);
477 missionGP.Continue();
478
479 Close();
480 }
481 else
482 {
483 g_Game.RestartMission();
484 }
485 }
486
487 void MenuRequestRespawn(UIScriptedMenu menu, bool random)
488 {
489 if (RespawnDialogue.Cast(menu))
490 {
491 GameRetry(random);
492 }
493 }
494
495 bool IsLocalPlayer(string uid)
496 {
497 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
498 string local_uid;
499 if (g_Game.GetUserManager())
500 {
501 local_uid = g_Game.GetUserManager().GetSelectedUser().GetUid();
502 }
503
504 return (uid == local_uid);
505 }
506
508 {
509 SyncPlayerList player_list = new SyncPlayerList;
510 player_list.m_PlayerList = new array<ref SyncPlayer>;
511
512 for (int i = 0; i < player_count; i++)
513 {
514 SyncPlayer sync_player = new SyncPlayer;
515 sync_player.m_UID = "uid" + i;
516 sync_player.m_PlayerName = "Player " + i;
517 player_list.m_PlayerList.Insert(sync_player);
518 }
519
520 return player_list;
521 }
522
523 private void UpdateExitButtonState()
524 {
525 MissionGameplay mission = MissionGameplay.Cast(g_Game.GetMission());
526 float remainingTime = mission.GetExitButtonDisabledRemainingTime();
527 if (remainingTime > 0)
528 {
529 m_ExitOnCooldown = true;
530
531 m_ExitButtonTime.Show(true);
532 layoutRoot.FindAnyWidget("exitbtn_label1").Show(true);
533 layoutRoot.FindAnyWidget("spacer1").Show(true);
534 layoutRoot.FindAnyWidget("spacer2").Show(true);
535
536 m_ExitButtonLabel.SetColor(ARGB(128, 255, 255, 255));
537 m_ExitButtonLabel.SetText("#main_menu_exit (");
538 m_ExitButtonTime.SetText("" + Math.Round(remainingTime) + "s");
539 m_ExitButton.Enable(false);
540 }
541 else
542 {
543 m_ExitButton.Enable(true);
544 m_ExitButtonLabel.SetColor(ARGB(255, 255, 255, 255));
545 m_ExitButtonLabel.SetText("#main_menu_exit");
546 m_ExitButtonTime.SetText("");
547
548 m_ExitButtonTime.Show(false);
549 layoutRoot.FindAnyWidget("exitbtn_label1").Show(false);
550 layoutRoot.FindAnyWidget("spacer1").Show(false);
551 layoutRoot.FindAnyWidget("spacer2").Show(false);
552
553 m_ExitOnCooldown = false;
554 }
555 }
556
557 override void Update(float timeslice)
558 {
559 super.Update(timeslice);
560
561 m_ExitButtonUpdateTimerSum += timeslice;
562
564 {
567 }
568
569 if (GetUApi().GetInputByID(UAUIThumbRight).LocalPress() && !IsOnlineOpen() || FeedbackDialogVisible() && GetUApi().GetInputByID(UAUIBack).LocalPress())
570 {
572 }
573
574 if (g_Game.IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible())
575 {
576 PlayerListEntryScriptedWidget selected;
578 {
579 selected = m_ServerInfoPanel.GetSelectedPlayer();
580 }
581
582 if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
583 {
584 if (selected)
585 {
586 m_ServerInfoPanel.ToggleMute(selected.GetUID());
587 }
588
589 Refresh();
590 }
591
592 #ifndef PLATFORM_PS4
593 if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
594 {
595 if (selected)
596 {
597 OnlineServices.ShowUserProfile(selected.GetUID());
598 }
599 }
600 #endif
601 }
602 }
603
604 bool ShouldRestartBeVisible(Man player)
605 {
606 PlayerBase p = PlayerBase.Cast(player);
607 return p && p.IsUnconsciousStateOnly() && !CfgGameplayHandler.GetDisableRespawnInUnconsciousness();
608 }
609
611 {
612 bool shouldUpdateMenuFocus = false;
613 Man player = g_Game.GetPlayer();
614 if (player)
615 {
616 m_PlayerAlive = player.GetPlayerState() == EPlayerStates.ALIVE;
617 }
618
619 if (m_PlayerAlive)
620 {
621 bool showRestartBtn = ShouldRestartBeVisible(player);
622 m_RestartButton.Show(showRestartBtn);
623 }
624 else
625 {
626 m_RestartButton.Show(false);
627 m_BackAvailable = false;
628 }
629
632
634 }
635
637 {
638 return m_OnlineMenu.IsVisible();
639 }
640
642 {
643 m_OnlineMenu.Show(false);
644 m_SelectAvailable = true;
645 m_MuteAvailable = false;
646 m_GamercardAvailable = false;
647
650 }
651
653 {
655 {
656 m_ServerInfoPanel.FocusFirst();
657
658 Refresh();
659 }
660 }
661
662 override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
663 {
664 return false;
665 }
666
668 {
669 m_ServerInfoPanel.Reload(player_list);
670
671 Refresh();
672 }
673
675 {
676 m_ServerInfoPanel.Reload(result_list);
677
678 Refresh();
679 }
680
681 override void OnShow()
682 {
683 super.OnShow();
684
685 #ifdef PLATFORM_CONSOLE
686 #ifndef PLATFORM_MSSTORE
687 bool mk = g_Game.GetInput().IsEnabledMouseAndKeyboard();
688 bool mk_server = g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
689 TextWidget warning = TextWidget.Cast(layoutRoot.FindAnyWidget("MouseAndKeyboardWarning"));
690 if (mk)
691 {
692 if (mk_server)
693 {
694 warning.SetText("#str_mouse_and_keyboard_server_warning");
695 }
696 else
697 {
698 warning.SetText("#str_controller_server_warning");
699 }
700 }
701
702 warning.Show(mk);
703 #endif
704 #endif
705
706 UpdateGUI();
707
709 OnInputDeviceChanged(g_Game.GetInput().GetCurrentInputDevice());
710 }
711
712 override bool OnMouseEnter(Widget w, int x, int y)
713 {
714 if (w == m_ExitButton && m_ExitOnCooldown)
715 return false;
716
717 if (IsFocusable(w))
718 {
720 return true;
721 }
722 return false;
723 }
724
725 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
726 {
727 if (w == m_ExitButton && m_ExitOnCooldown)
728 return false;
729
730 if (IsFocusable(w))
731 {
732 ColorNormal(w);
733 return true;
734 }
735 return false;
736 }
737
738 override bool OnFocus(Widget w, int x, int y)
739 {
740 if (w == m_ExitButton && m_ExitOnCooldown)
741 return false;
742
743 if (IsFocusable(w))
744 {
746 return true;
747 }
748 return false;
749 }
750
751 override bool OnFocusLost(Widget w, int x, int y)
752 {
753 if (w == m_ExitButton && m_ExitOnCooldown)
754 return false;
755
756 if (IsFocusable(w))
757 {
758 ColorNormal(w);
759 return true;
760 }
761 return false;
762 }
763
765 {
766 if (w)
767 {
769 {
770 return true;
771 }
772 }
773 return false;
774 }
775
776 override void Refresh()
777 {
778 string version;
779 g_Game.GetVersion(version);
780 #ifdef PLATFORM_CONSOLE
781 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
782 #else
783 version = "#main_menu_version" + " " + version;
784 #endif
785 m_Version.SetText(version);
786
787 m_MuteAvailable = false;
788 m_GamercardAvailable = false;
789
790 if (g_Game.IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible() && m_ServerInfoPanel)
791 {
792 PlayerListEntryScriptedWidget selected = m_ServerInfoPanel.GetSelectedPlayer();
793 if (selected && !selected.IsLocalPlayer())
794 {
795 m_MuteAvailable = !g_Game.GetWorld().IsDisabledReceivingVoN() && !selected.IsGloballyMuted();
796 #ifndef PLATFORM_PS4
798 #endif
799 SetMuteButtonText(selected.IsMuted());
800 }
801 }
802
804 }
805
807 {
808 #ifdef PLATFORM_WINDOWS
809 SetFocus(null);
810 #endif
811
812 ButtonWidget button = ButtonWidget.Cast(w);
813 if (button && button != m_ContinueButton)
814 {
815 button.SetTextColor(ARGB(255, 255, 255, 255));
816 }
817 ButtonSetColor(w, ARGB(0, 0, 0, 0));
818 ButtonSetTextColor(w, ARGB(60, 0, 0, 0));
819 }
820
822 {
823 if (!w)
824 {
825 return;
826 }
827
828 int color_pnl = ARGB(255, 0, 0, 0);
829 int color_lbl = ARGB(255, 255, 0, 0);
830
831 #ifdef PLATFORM_CONSOLE
832 color_pnl = ARGB(255, 200, 0, 0);
833 color_lbl = ARGB(255, 255, 255, 255);
834 #endif
835
836 ButtonSetColor(w, color_pnl);
837 ButtonSetTextColor(w, color_lbl);
838 }
839
841 {
842 if (!w) return;
843
844 int color_pnl = ARGB(0, 0, 0, 0);
845 int color_lbl = ARGB(255, 255, 255, 255);
846
847 ButtonSetColor(w, color_pnl);
848 ButtonSetTextColor(w, color_lbl);
849 }
850
851 void ButtonSetText(Widget w, string text)
852 {
853 if (!w)
854 {
855 return;
856 }
857
858 TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
859 if (label)
860 {
861 label.SetText(text);
862 }
863
864 }
865
866 void ButtonSetColor(Widget w, int color)
867 {
868 if (!w)
869 {
870 return;
871 }
872
873 Widget panel = w.FindWidget(w.GetName() + "_panel");
874 if (panel)
875 {
876 panel.SetColor(color);
877 }
878 }
879
880 void ButtonSetTextColor(Widget w, int color)
881 {
882 if (!w)
883 {
884 return;
885 }
886
887 TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
888 TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
889 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
890
891 if (label)
892 {
893 label.SetColor(color);
894 }
895
896 if (text)
897 {
898 text.SetColor(color);
899 }
900
901 if (text2)
902 {
903 text2.SetColor(color);
904 }
905 }
906
908 protected void SetMuteButtonText(bool isMuted)
909 {
910 if (isMuted)
911 {
913 }
914 else
915 {
917 }
918 }
919
921 protected void LoadTextStrings()
922 {
923 #ifdef PLATFORM_PS4
924 m_MuteButtonTextID = "#ps4_ingame_menu_mute";
925 m_UnmuteButtonTextID = "#ps4_ingame_menu_unmute";
926 m_BackButtonTextID = "#ps4_ingame_menu_back";
927 m_SelectButtonTextID = "#ps4_ingame_menu_select";
928 m_OpenGameCardButtonTextID = "#ps4_ingame_menu_opencard";
929 #else
930 m_MuteButtonTextID = "#xbox_ingame_menu_mute";
931 m_UnmuteButtonTextID = "#xbox_ingame_menu_unmute";
932 m_BackButtonTextID = "#STR_rootFrame_toolbar_bg_ConsoleToolbar_Back_BackText0";
933 m_SelectButtonTextID = "#layout_xbox_ingame_menu_select";
934 m_OpenGameCardButtonTextID = "#layout_xbox_ingame_menu_gamecard";
935 #endif
936 }
937
939 protected void LoadFooterButtonTexts()
940 {
941 TextWidget uiGamecardText = TextWidget.Cast(layoutRoot.FindAnyWidget("GamercardText"));
942 TextWidget uiBackText = TextWidget.Cast(layoutRoot.FindAnyWidget("BackText"));
943 TextWidget uiSelectText = TextWidget.Cast(layoutRoot.FindAnyWidget("SelectText"));
944
945 if (uiGamecardText)
946 {
947 uiGamecardText.SetText(m_OpenGameCardButtonTextID);
948 }
949
950 if (uiBackText)
951 {
952 uiBackText.SetText(m_BackButtonTextID);
953 }
954
955 if (uiSelectText)
956 {
957 uiSelectText.SetText(m_SelectButtonTextID);
958 }
959 }
960
962 {
963 Man player = g_Game.GetPlayer();
964 if (m_PlayerAlive)
965 {
966 if (ShouldRestartBeVisible(player))
967 {
969 }
970 else
971 {
973 }
974 }
975 else
976 {
978 }
979 }
980
981 protected void UpdateControlsElements()
982 {
983 bool toolbarShow = !g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || g_Game.GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
984 bool onlineOpen = IsOnlineOpen();
985 layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
986 layoutRoot.FindAnyWidget("top").Show(!onlineOpen);
987
989 if (onlineOpen)
990 {
991 layoutRoot.FindAnyWidget("bottom").Show(!toolbarShow);
992 }
993 else
994 {
995 layoutRoot.FindAnyWidget("bottom").Show(true);
996 }
997
998 string contineBtnText = "";
999
1000 RichTextWidget toolbarTextWidget = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
1001 string toolbarText = "";
1002
1004 if (toolbarShow)
1005 {
1006 if (!FeedbackDialogVisible())
1007 {
1009 {
1010 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", m_SelectButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1011 }
1012
1013 if (m_MuteAvailable)
1014 {
1015 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", m_CurrentMuteButtonText, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1016 }
1017
1018 if (m_BackAvailable)
1019 {
1020 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", m_BackButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1021 }
1022
1024 {
1025 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", m_OpenGameCardButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1026 }
1027
1028 if (!IsOnlineOpen())
1029 {
1030 toolbarText += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIThumbRight", "#layout_main_menu_feedback", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1031 }
1032 }
1033 else
1034 {
1035 toolbarText = InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#close", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR);
1036 }
1037 }
1038 else
1039 {
1041 contineBtnText = InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER);
1042 }
1043
1044 toolbarTextWidget.SetText(toolbarText);
1045
1047 string continueBtnLabel = "#main_menu_continue";
1048 if (onlineOpen)
1049 continueBtnLabel = "#layout_character_creation_back";
1050
1051 TextWidget continueBtnTextWidget = TextWidget.Cast(layoutRoot.FindAnyWidget("continuebtn_label"));
1052 continueBtnTextWidget.SetText(continueBtnLabel);
1053 layoutRoot.FindAnyWidget("dayz_logo").Show(!onlineOpen);
1054 }
1055
1056 override void OnHide()
1057 {
1058 super.OnHide();
1060 {
1062 }
1063 }
1064}
array< ref BiosPrivacyUidResult > BiosPrivacyUidResultArray
Определения BiosPrivacyService.c:49
DayZGame g_Game
Определения DayZGame.c:3942
Mission mission
Определения DisplayStatus.c:28
EPlayerStates
Определения EPlayerStates.c:2
Icon x
Icon y
void Close()
proto native UAInputAPI GetUApi()
static bool GetDisableRespawnInUnconsciousness()
Определения CfgGameplayHandler.c:178
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:939
void MenuRequestRespawn(UIScriptedMenu menu, bool random)
Определения InGameMenuXbox.c:487
TextWidget m_ExitButtonTime
Определения InGameMenuXbox.c:38
void SyncEvent_OnRecievedPlayerList(SyncPlayerList player_list)
Определения InGameMenuXbox.c:667
override bool OnMouseEnter(Widget w, int x, int y)
Определения InGameMenuXbox.c:712
Widget m_ExitButton
Определения InGameMenu.c:7
override void OnShow()
Определения InGameMenuXbox.c:681
bool FeedbackDialogVisible()
Определения InGameMenuXbox.c:396
void OnPermissionsUpdate(BiosPrivacyUidResultArray result_list)
Определения InGameMenuXbox.c:674
void ColorDisable(Widget w)
Определения InGameMenuXbox.c:806
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:738
void SetMuteButtonText(bool isMuted)
Set mute text button text (mute / unmute)
Определения InGameMenuXbox.c:908
override void Update(float timeslice)
Определения InGameMenuXbox.c:557
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:961
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:921
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:851
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:507
Widget m_OptionsButton
Определения InGameMenu.c:12
void UpdateExitButtonState()
Определения InGameMenuXbox.c:523
TextWidget m_ExitButtonLabel
Определения InGameMenuXbox.c:37
override void OnHide()
Определения InGameMenuXbox.c:1056
override bool OnFocusLost(Widget w, int x, int y)
Определения InGameMenuXbox.c:751
override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
Определения InGameMenuXbox.c:662
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения InGameMenuXbox.c:725
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:495
string m_MuteButtonTextID
Определения InGameMenuXbox.c:4
void InGameMenuXbox()
Определения InGameMenuXbox.c:48
Widget m_OnlineMenu
Определения InGameMenuXbox.c:23
void GameRetry(bool random)
Определения InGameMenuXbox.c:460
string m_UnmuteButtonTextID
Определения InGameMenuXbox.c:5
void UpdateControlsElements()
Определения ControlsXboxNew.c:535
void ~InGameMenuXbox()
Определения InGameMenuXbox.c:54
void RespawnDialogue()
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:652
void CloseOnline()
Определения InGameMenuXbox.c:641
override bool OnClick(Widget w, int x, int y, int button)
Определения InGameMenuXbox.c:278
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:401
void ColorNormal(Widget w)
Определения ControlsXboxNew.c:471
string m_CurrentMuteButtonText
Определения InGameMenuXbox.c:9
void ToggleFeedbackDialog()
Определения InGameMenuXbox.c:377
bool IsOnlineOpen()
Определения InGameMenuXbox.c:636
bool m_BackAvailable
Определения InGameMenuXbox.c:13
bool ShouldRestartBeVisible(Man player)
Определения InGameMenuXbox.c:604
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:1050
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:204
const int MENU_XBOX_CONTROLS
Определения 3_Game/DayZ/constants.c:197
const int MENU_RESPAWN_DIALOGUE
Определения 3_Game/DayZ/constants.c:209
const int MENU_OPTIONS
Определения 3_Game/DayZ/constants.c:183
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:160
const int IDC_MAIN_OPTIONS
Определения 3_Game/DayZ/constants.c:142
const int IDC_MULTI_INVITE
Определения 3_Game/DayZ/constants.c:152
const int IDC_MAIN_QUIT
Определения 3_Game/DayZ/constants.c:144
const int IDC_MAIN_CONTINUE
Определения 3_Game/DayZ/constants.c:145
const int IDC_INT_RETRY
ingame menu
Определения 3_Game/DayZ/constants.c:158
const int IDC_MAIN_FEEDBACK
Определения 3_Game/DayZ/constants.c:150
const int IDC_MAIN_TUTORIAL
Определения 3_Game/DayZ/constants.c:146
const int IDC_MAIN_ONLINE
Определения 3_Game/DayZ/constants.c:149
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