4 protected string m_MuteButtonTextID;
5 protected string m_UnmuteButtonTextID;
7 protected string m_SelectButtonTextID;
8 protected string m_OpenGameCardButtonTextID;
9 protected string m_CurrentMuteButtonText;
11 protected bool m_SelectAvailable;
12 protected bool m_MuteAvailable;
13 protected bool m_BackAvailable;
14 protected bool m_GamercardAvailable;
16 protected bool m_PlayerAlive;
18 protected ref PlayerListScriptedWidget m_ServerInfoPanel;
20 protected Widget m_OnlineMenu;
22 protected ButtonWidget m_ContinueButton;
23 protected ButtonWidget m_ExitButton;
24 protected ButtonWidget m_RestartDeadButton;
25 protected ButtonWidget m_RestartButton;
26 protected ButtonWidget m_OptionsButton;
27 protected ButtonWidget m_ControlsButton;
28 protected ButtonWidget m_OnlineButton;
29 protected ButtonWidget m_TutorialsButton;
33 const int BUTTON_XBOX_CONTROLS = 201;
41 void ~InGameMenuXbox()
43 ClientData.SyncEvent_OnPlayerListUpdate.Remove(SyncEvent_OnRecievedPlayerList);
44 OnlineServices.m_PermissionsAsyncInvoker.Remove(OnPermissionsUpdate);
49 IngameHud hud = IngameHud.Cast(
mission.GetHud());
53 hud.ShowQuickbarUI(
true);
59 PPERequesterBank.GetRequester(PPERequester_MenuEffects).Stop();
64 #ifdef PLATFORM_CONSOLE
76 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/xbox/day_z_ingamemenu_xbox.layout");
78 m_OnlineMenu =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/xbox/ingamemenu_xbox/online_info_menu.layout", layoutRoot);
79 m_OnlineMenu.Show(
false);
81 m_ContinueButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"continuebtn"));
82 m_RestartDeadButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"restartbtn_dead"));
83 m_ExitButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"exitbtn"));
84 m_RestartButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"restartbtn"));
85 m_OptionsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"optionsbtn"));
86 m_ControlsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"controlsbtn"));
87 m_OnlineButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"onlinebtn"));
88 m_TutorialsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"tutorialsbtn"));
89 m_Version =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"version"));
91 m_SelectAvailable =
true;
92 m_MuteAvailable =
false;
93 m_GamercardAvailable =
false;
94 m_BackAvailable =
true;
96 Man player =
GetGame().GetPlayer();
99 int life_state = player.GetPlayerState();
103 m_PlayerAlive =
true;
111 #ifdef PLATFORM_CONSOLE
112 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
114 version =
"#main_menu_version" +
" " + version;
116 m_Version.SetText(version);
120 m_OnlineButton.Show(
true);
123 w_text.SetText(
g_Game.GetHostName());
125 m_ServerInfoPanel =
new PlayerListScriptedWidget(m_OnlineMenu.FindAnyWidget(
"ServerInfoPanel"));
127 OnlineServices.m_PermissionsAsyncInvoker.Insert(OnPermissionsUpdate);
128 ClientData.SyncEvent_OnPlayerListUpdate.Insert(SyncEvent_OnRecievedPlayerList);
130 m_ServerInfoPanel.Reload(
ClientData.m_PlayerList);
133 string uid = m_ServerInfoPanel.FindPlayerByWidget(
GetFocus());
136 if (IsLocalPlayer(uid) || m_ServerInfoPanel.IsEmpty())
138 m_MuteAvailable =
false;
139 m_GamercardAvailable =
false;
143 m_MuteAvailable = !
GetGame().GetWorld().IsDisabledReceivingVoN();
145 m_GamercardAvailable =
true;
150 if (m_ServerInfoPanel.IsGloballyMuted(uid))
152 m_MuteAvailable =
false;
158 layoutRoot.FindAnyWidget(
"onlinebtn").Show(
false);
159 layoutRoot.FindAnyWidget(
"invitebtn").Show(
false);
163 ButtonWidget restart_btn = ButtonWidget.Cast(layoutRoot.FindAnyWidgetById(
IDC_INT_RETRY));
166 restart_btn.SetText(
"#main_menu_respawn");
170 restart_btn.SetText(
"#main_menu_restart");
173 if (
GetGame().IsMultiplayer() && !(
GetGame().CanRespawnPlayer() || (player && player.IsUnconscious())))
175 restart_btn.Enable(
false);
176 restart_btn.Show(
false);
187 IngameHud hud = IngameHud.Cast(
mission.GetHud());
190 hud.ShowHudUI(
false);
191 hud.ShowQuickbarUI(
false);
197 PPERequester_MenuEffects requester;
198 Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
199 requester.SetVignetteIntensity(0.6);
212 super.OnClick(w,
x,
y, button);
214 switch (w.GetUserID())
226 case BUTTON_XBOX_CONTROLS:
233 GetGame().GetUIManager().ShowDialog(
"#main_menu_exit",
"#main_menu_exit_desc",
IDC_INT_EXIT, DBT_YESNO, DBB_YES, DMT_QUESTION, NULL);
238 if (!
GetGame().IsMultiplayer())
240 GetGame().GetUIManager().ShowDialog(
"#main_menu_restart",
"Are you sure you want to restart?",
IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
244 GetGame().GetUIManager().ShowDialog(
"#main_menu_respawn",
"#main_menu_respawn_question",
IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
250 m_OnlineMenu.Show(
true);
251 m_SelectAvailable =
false;
254 m_ServerInfoPanel.FocusFirst();
269 if (w == layoutRoot.FindAnyWidget(
"backbtn"))
273 else if (w == m_RestartDeadButton)
289 override bool OnModalResult(
Widget w,
int x,
int y,
int code,
int result)
291 super.OnModalResult(w,
x,
y, code, result);
303 GetGame().GetMission().AbortMission();
305 g_Game.CancelLoginTimeCountdown();
312 g_Game.CancelLoginTimeCountdown();
316 if (result == DBB_YES)
337 void GameRetry(
bool random)
342 GetGame().GetMenuDefaultCharacterData(
false).SetRandomCharacterForced(random);
348 player.SimulateDeath(
true);
352 MissionGameplay missionGP = MissionGameplay.Cast(
GetGame().GetMission());
353 missionGP.DestroyAllMenus();
354 missionGP.SetPlayerRespawning(
true);
355 missionGP.Continue();
365 if (RespawnDialogue.Cast(menu))
369 bool IsLocalPlayer(
string uid)
373 if (
GetGame().GetUserManager())
374 local_uid =
GetGame().GetUserManager().GetSelectedUser().GetUid();
375 return (uid == local_uid);
382 for (
int i = 0; i < player_count; i++)
385 sync_player.m_UID =
"uid" + i;
386 sync_player.m_PlayerName =
"Player " + i;
387 player_list.m_PlayerList.Insert(sync_player);
392 override void Update(
float timeslice)
396 if (
GetGame().IsMultiplayer() && layoutRoot.FindAnyWidget(
"OnlineInfo").IsVisible())
398 PlayerListEntryScriptedWidget selected;
399 if (m_ServerInfoPanel)
400 selected = m_ServerInfoPanel.GetSelectedPlayer();
401 if (
GetUApi().GetInputByID(UAUICtrlX).LocalPress())
404 m_ServerInfoPanel.ToggleMute(selected.GetUID());
409 if (
GetUApi().GetInputByID(UAUICtrlY).LocalPress())
418 bool ShouldRestartBeVisible(Man player)
420 return player && player.IsUnconscious() && !
CfgGameplayHandler.GetDisableRespawnInUnconsciousness();
426 Man player =
GetGame().GetPlayer();
429 int life_state = player.GetPlayerState();
435 m_RestartButton.Show(ShouldRestartBeVisible(player));
439 m_RestartButton.Show(
false);
442 m_ContinueButton.Show(m_PlayerAlive);
443 m_RestartDeadButton.Show(!m_PlayerAlive);
448 return m_OnlineMenu.IsVisible();
453 m_OnlineMenu.Show(
false);
454 m_SelectAvailable =
true;
455 m_MuteAvailable =
false;
456 m_GamercardAvailable =
false;
464 if (m_ServerInfoPanel)
466 m_ServerInfoPanel.FocusFirst();
472 override bool OnItemSelected(
Widget w,
int x,
int y,
int row,
int column,
int oldRow,
int oldColumn)
479 m_ServerInfoPanel.Reload(player_list);
486 m_ServerInfoPanel.Reload(result_list);
494 Man player =
GetGame().GetPlayer();
497 int life_state = player.GetPlayerState();
501 m_PlayerAlive =
true;
508 m_RestartButton.Show(player.IsUnconscious());
512 m_RestartButton.Show(
false);
514 m_ContinueButton.Show(m_PlayerAlive);
515 m_RestartDeadButton.Show(!m_PlayerAlive);
519 #ifdef PLATFORM_CONSOLE
520 bool mk =
GetGame().GetInput().IsEnabledMouseAndKeyboard();
521 bool mk_server =
GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
527 warning.SetText(
"#str_mouse_and_keyboard_server_warning");
531 warning.SetText(
"#str_controller_server_warning");
584 if (w == m_ContinueButton || w == m_ExitButton || w == m_RestartButton || w == m_OptionsButton || w == m_ControlsButton || w == m_OnlineButton || w == m_TutorialsButton);
594 #ifdef PLATFORM_CONSOLE
595 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
597 version =
"#main_menu_version" +
" " + version;
599 m_Version.SetText(version);
601 m_MuteAvailable =
false;
602 m_GamercardAvailable =
false;
604 if (
GetGame().IsMultiplayer() && layoutRoot.FindAnyWidget(
"OnlineInfo").IsVisible() && m_ServerInfoPanel)
606 PlayerListEntryScriptedWidget selected = m_ServerInfoPanel.GetSelectedPlayer();
607 if (selected && !selected.IsLocalPlayer())
609 m_MuteAvailable = !
GetGame().GetWorld().IsDisabledReceivingVoN() && !selected.IsGloballyMuted();
611 m_GamercardAvailable =
true;
613 SetMuteButtonText(selected.IsMuted());
622 #ifdef PLATFORM_WINDOWS
626 ButtonWidget button = ButtonWidget.Cast(w);
627 if (button && button != m_ContinueButton)
629 button.SetTextColor(
ARGB(255, 255, 255, 255));
631 ButtonSetColor(w,
ARGB(0, 0, 0, 0));
632 ButtonSetTextColor(w,
ARGB(60, 0, 0, 0));
640 int color_pnl =
ARGB(255, 0, 0, 0);
641 int color_lbl =
ARGB(255, 255, 0, 0);
643 #ifdef PLATFORM_CONSOLE
644 color_pnl =
ARGB(255, 200, 0, 0);
645 color_lbl =
ARGB(255, 255, 255, 255);
648 ButtonSetColor(w, color_pnl);
649 ButtonSetTextColor(w, color_lbl);
657 int color_pnl =
ARGB(0, 0, 0, 0);
658 int color_lbl =
ARGB(255, 255, 255, 255);
660 ButtonSetColor(w, color_pnl);
661 ButtonSetTextColor(w, color_lbl);
664 void ButtonSetText(
Widget w,
string text)
678 void ButtonSetColor(
Widget w,
int color)
683 Widget panel = w.FindWidget(w.GetName() +
"_panel");
687 panel.SetColor(color);
691 void ButtonSetTextColor(
Widget w,
int color)
702 label.SetColor(color);
707 text.SetColor(color);
712 text2.SetColor(color);
717 protected void SetMuteButtonText(
bool isMuted)
721 m_CurrentMuteButtonText = m_UnmuteButtonTextID;
725 m_CurrentMuteButtonText = m_MuteButtonTextID;
733 m_MuteButtonTextID =
"#ps4_ingame_menu_mute";
734 m_UnmuteButtonTextID =
"#ps4_ingame_menu_unmute";
736 m_SelectButtonTextID =
"#ps4_ingame_menu_select";
737 m_OpenGameCardButtonTextID =
"#ps4_ingame_menu_opencard";
739 m_MuteButtonTextID =
"#xbox_ingame_menu_mute";
740 m_UnmuteButtonTextID =
"#xbox_ingame_menu_unmute";
742 m_SelectButtonTextID =
"#layout_xbox_ingame_menu_select";
743 m_OpenGameCardButtonTextID =
"#layout_xbox_ingame_menu_gamecard";
756 uiGamecardText.SetText(m_OpenGameCardButtonTextID);
764 uiSelectText.SetText(m_SelectButtonTextID);
768 void UpdateMenuFocus()
770 Man player =
GetGame().GetPlayer();
773 if (ShouldRestartBeVisible(player))
786 bool toolbarShow =
false;
787 #ifdef PLATFORM_CONSOLE
788 toolbarShow = !
GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() ||
GetGame().GetInput().GetCurrentInputDevice() ==
EInputDeviceType.CONTROLLER;
795 if (m_SelectAvailable)
796 text +=
string.Format(
" %1",
InputUtils.GetRichtextButtonIconFromInputAction(
"UAUISelect", m_SelectButtonTextID, EUAINPUT_DEVICE_CONTROLLER,
InputUtils.ICON_SCALE_TOOLBAR));
798 text +=
string.Format(
" %1",
InputUtils.GetRichtextButtonIconFromInputAction(
"UAUICtrlX", m_CurrentMuteButtonText, EUAINPUT_DEVICE_CONTROLLER,
InputUtils.ICON_SCALE_TOOLBAR));
801 if (m_GamercardAvailable)
802 text +=
string.Format(
" %1",
InputUtils.GetRichtextButtonIconFromInputAction(
"UAUICtrlY", m_OpenGameCardButtonTextID, EUAINPUT_DEVICE_CONTROLLER,
InputUtils.ICON_SCALE_TOOLBAR));
804 toolbar_text.SetText(text);
808 toolbar_b2.SetText(
InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIBack",
"", EUAINPUT_DEVICE_CONTROLLER));
810 bool onlineOpen = IsOnlineOpen();
811 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(toolbarShow);
812 layoutRoot.FindAnyWidget(
"play_panel_root").Show(!onlineOpen);
813 layoutRoot.FindAnyWidget(
"play_panel_root2").Show(onlineOpen && !toolbarShow);
814 layoutRoot.FindAnyWidget(
"dayz_logo").Show(!onlineOpen);