18 private float m_ExitButtonUpdateTimerSum;
19 private bool m_ExitOnCooldown;
56 ClientData.SyncEvent_OnPlayerListUpdate.Remove(SyncEvent_OnRecievedPlayerList);
57 OnlineServices.m_PermissionsAsyncInvoker.Remove(OnPermissionsUpdate);
62 IngameHud hud = IngameHud.Cast(
mission.GetHud());
66 hud.ShowQuickbarUI(
true);
72 PPERequesterBank.GetRequester(PPERequester_MenuEffects).Stop();
77 #ifdef PLATFORM_CONSOLE
84 bool mk =
g_Game.GetInput().IsEnabledMouseAndKeyboard();
85 bool mkServer =
g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
87 switch (pInputDeviceType)
93 g_Game.GetUIManager().ShowUICursor(
false);
103 #ifdef PLATFORM_MSSTORE
113 g_Game.GetUIManager().ShowUICursor(
true);
117 #ifdef PLATFORM_MSSTORE
131 layoutRoot =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/xbox/day_z_ingamemenu_xbox.layout");
133 m_OnlineMenu =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/xbox/ingamemenu_xbox/online_info_menu.layout", layoutRoot);
137 m_ContinueButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"continuebtn"));
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"));
146 m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget(
"version"));
147 m_ShowFeedback = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"feedbackbtn"));
149 m_FeedbackClose = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"close_button"));
151 m_DialogPanel = layoutRoot.FindAnyWidget(
"ingame_menu_dialog");
153 m_ExitButtonTime = TextWidget.Cast(layoutRoot.FindAnyWidget(
"exitbtn_time"));
160 #ifdef PLATFORM_MSSTORE
172 player.GetOnUnconsciousStart().Insert(
UpdateGUI);
174 player.GetOnUnconsciousStop().Insert(
UpdateGUI);
176 player.GetOnDeathStart().Insert(
UpdateGUI);
181 g_Game.GetVersion(version);
182 #ifdef PLATFORM_CONSOLE
183 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
185 version =
"#main_menu_version" +
" " + version;
189 if (
g_Game.IsMultiplayer())
193 TextWidget w_text = TextWidget.Cast(
m_OnlineMenu.FindAnyWidget(
"OnlineTextWidget"));
194 w_text.SetText(
g_Game.GetHostName());
198 OnlineServices.m_PermissionsAsyncInvoker.Insert(OnPermissionsUpdate);
199 ClientData.SyncEvent_OnPlayerListUpdate.Insert(SyncEvent_OnRecievedPlayerList);
226 UpdateExitButtonState();
230 layoutRoot.FindAnyWidget(
"onlinebtn").Show(
false);
231 layoutRoot.FindAnyWidget(
"invitebtn").Show(
false);
235 if (
g_Game.IsMultiplayer())
244 if (!ShouldRestartBeVisible(player))
252 IngameHud hud = IngameHud.Cast(
mission.GetHud());
255 hud.ShowHudUI(
false);
256 hud.ShowQuickbarUI(
false);
262 PPERequester_MenuEffects requester;
263 Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
264 requester.SetVignetteIntensity(0.6);
278 override bool OnClick(Widget w,
int x,
int y,
int button)
280 super.OnClick(w,
x,
y, button);
284 switch (w.GetUserID())
310 g_Game.GetUIManager().ShowDialog(
"#main_menu_exit",
"#main_menu_exit_desc",
IDC_INT_EXIT, DBT_YESNO, DBB_YES, DMT_QUESTION, NULL);
315 if (!
g_Game.IsMultiplayer())
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);
321 g_Game.GetUIManager().ShowDialog(
"#main_menu_respawn",
"#main_menu_respawn_question",
IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
385 PPERequesterBank.GetRequester(PPERequester_FeedbackBlur).Start();
389 PPERequesterBank.GetRequester(PPERequester_FeedbackBlur).Stop();
403 super.OnModalResult(w,
x,
y, code, result);
407 if (
g_Game.IsMultiplayer())
409 MissionGameplay
mission = MissionGameplay.Cast(
g_Game.GetMission());
412 g_Game.LogoutRequestTime();
413 scQueue.Call(
mission.CreateLogoutMenu,
this);
415 int logoutAfterCancelTimeout =
g_Game.GetLogoutAfterCancelTimeout();
416 if (logoutAfterCancelTimeout > 0)
418 mission.SetExitButtonDisabledRemainingTime(logoutAfterCancelTimeout);
419 UpdateExitButtonState();
426 g_Game.GetMission().AbortMission();
428 g_Game.CancelLoginTimeCountdown();
435 g_Game.CancelLoginTimeCountdown();
439 if (result == DBB_YES)
462 if (
g_Game.IsMultiplayer())
464 g_Game.GetMenuDefaultCharacterData(
false).SetRandomCharacterForced(random);
470 player.SimulateDeath(
true);
474 MissionGameplay missionGP = MissionGameplay.Cast(
g_Game.GetMission());
475 missionGP.DestroyAllMenus();
476 missionGP.SetPlayerRespawning(
true);
477 missionGP.Continue();
499 if (
g_Game.GetUserManager())
501 local_uid =
g_Game.GetUserManager().GetSelectedUser().GetUid();
504 return (uid == local_uid);
512 for (
int i = 0; i < player_count; i++)
515 sync_player.m_UID =
"uid" + i;
516 sync_player.m_PlayerName =
"Player " + i;
517 player_list.m_PlayerList.Insert(sync_player);
523 private void UpdateExitButtonState()
525 MissionGameplay
mission = MissionGameplay.Cast(
g_Game.GetMission());
526 float remainingTime =
mission.GetExitButtonDisabledRemainingTime();
527 if (remainingTime > 0)
529 m_ExitOnCooldown =
true;
531 m_ExitButtonTime.Show(
true);
532 layoutRoot.FindAnyWidget(
"exitbtn_label1").Show(
true);
533 layoutRoot.FindAnyWidget(
"spacer1").Show(
true);
534 layoutRoot.FindAnyWidget(
"spacer2").Show(
true);
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);
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(
"");
548 m_ExitButtonTime.Show(
false);
549 layoutRoot.FindAnyWidget(
"exitbtn_label1").Show(
false);
550 layoutRoot.FindAnyWidget(
"spacer1").Show(
false);
551 layoutRoot.FindAnyWidget(
"spacer2").Show(
false);
553 m_ExitOnCooldown =
false;
557 override void Update(
float timeslice)
559 super.Update(timeslice);
561 m_ExitButtonUpdateTimerSum += timeslice;
563 if (m_ExitButtonUpdateTimerSum >= 1)
565 UpdateExitButtonState();
566 m_ExitButtonUpdateTimerSum -= 1;
574 if (
g_Game.IsMultiplayer() && layoutRoot.FindAnyWidget(
"OnlineInfo").IsVisible())
576 PlayerListEntryScriptedWidget selected;
577 if (m_ServerInfoPanel)
579 selected = m_ServerInfoPanel.GetSelectedPlayer();
582 if (
GetUApi().GetInputByID(UAUICtrlX).LocalPress())
586 m_ServerInfoPanel.ToggleMute(selected.GetUID());
593 if (
GetUApi().GetInputByID(UAUICtrlY).LocalPress())
597 OnlineServices.ShowUserProfile(selected.GetUID());
604 bool ShouldRestartBeVisible(Man player)
606 PlayerBase p = PlayerBase.Cast(player);
607 return p && p.IsUnconsciousStateOnly() && !CfgGameplayHandler.GetDisableRespawnInUnconsciousness();
612 bool shouldUpdateMenuFocus =
false;
613 Man player =
g_Game.GetPlayer();
616 m_PlayerAlive = player.GetPlayerState() ==
EPlayerStates.ALIVE;
621 bool showRestartBtn = ShouldRestartBeVisible(player);
622 m_RestartButton.Show(showRestartBtn);
626 m_RestartButton.Show(
false);
627 m_BackAvailable =
false;
630 m_ContinueButton.Show(m_PlayerAlive);
631 m_RestartDeadButton.Show(!m_PlayerAlive);
638 return m_OnlineMenu.IsVisible();
643 m_OnlineMenu.Show(
false);
644 m_SelectAvailable =
true;
645 m_MuteAvailable =
false;
646 m_GamercardAvailable =
false;
649 SetFocus(m_OnlineButton);
654 if (m_ServerInfoPanel)
656 m_ServerInfoPanel.FocusFirst();
662 override bool OnItemSelected(Widget w,
int x,
int y,
int row,
int column,
int oldRow,
int oldColumn)
667 void SyncEvent_OnRecievedPlayerList(SyncPlayerList player_list)
669 m_ServerInfoPanel.Reload(player_list);
676 m_ServerInfoPanel.Reload(result_list);
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"));
694 warning.SetText(
"#str_mouse_and_keyboard_server_warning");
698 warning.SetText(
"#str_controller_server_warning");
714 if (w == m_ExitButton && m_ExitOnCooldown)
727 if (w == m_ExitButton && m_ExitOnCooldown)
738 override bool OnFocus(Widget w,
int x,
int y)
740 if (w == m_ExitButton && m_ExitOnCooldown)
753 if (w == m_ExitButton && m_ExitOnCooldown)
768 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)
779 g_Game.GetVersion(version);
780 #ifdef PLATFORM_CONSOLE
781 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
783 version =
"#main_menu_version" +
" " + version;
785 m_Version.SetText(version);
787 m_MuteAvailable =
false;
788 m_GamercardAvailable =
false;
790 if (
g_Game.IsMultiplayer() && layoutRoot.FindAnyWidget(
"OnlineInfo").IsVisible() && m_ServerInfoPanel)
792 PlayerListEntryScriptedWidget selected = m_ServerInfoPanel.GetSelectedPlayer();
793 if (selected && !selected.IsLocalPlayer())
795 m_MuteAvailable = !
g_Game.GetWorld().IsDisabledReceivingVoN() && !selected.IsGloballyMuted();
797 m_GamercardAvailable =
true;
808 #ifdef PLATFORM_WINDOWS
812 ButtonWidget button = ButtonWidget.Cast(w);
813 if (button && button != m_ContinueButton)
815 button.SetTextColor(
ARGB(255, 255, 255, 255));
828 int color_pnl =
ARGB(255, 0, 0, 0);
829 int color_lbl =
ARGB(255, 255, 0, 0);
831 #ifdef PLATFORM_CONSOLE
832 color_pnl =
ARGB(255, 200, 0, 0);
833 color_lbl =
ARGB(255, 255, 255, 255);
844 int color_pnl =
ARGB(0, 0, 0, 0);
845 int color_lbl =
ARGB(255, 255, 255, 255);
858 TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() +
"_label"));
873 Widget panel = w.FindWidget(w.GetName() +
"_panel");
876 panel.SetColor(color);
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"));
893 label.SetColor(color);
898 text.SetColor(color);
903 text2.SetColor(color);
941 TextWidget uiGamecardText = TextWidget.Cast(layoutRoot.FindAnyWidget(
"GamercardText"));
942 TextWidget uiBackText = TextWidget.Cast(layoutRoot.FindAnyWidget(
"BackText"));
943 TextWidget uiSelectText = TextWidget.Cast(layoutRoot.FindAnyWidget(
"SelectText"));
963 Man player =
g_Game.GetPlayer();
966 if (ShouldRestartBeVisible(player))
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);
991 layoutRoot.FindAnyWidget(
"bottom").Show(!toolbarShow);
995 layoutRoot.FindAnyWidget(
"bottom").Show(
true);
998 string contineBtnText =
"";
1001 string toolbarText =
"";
1028 if (!IsOnlineOpen())
1044 toolbarTextWidget.SetText(toolbarText);
1047 string continueBtnLabel =
"#main_menu_continue";
1049 continueBtnLabel =
"#layout_character_creation_back";
1051 TextWidget continueBtnTextWidget = TextWidget.Cast(layoutRoot.FindAnyWidget(
"continuebtn_label"));
1052 continueBtnTextWidget.SetText(continueBtnLabel);
1053 layoutRoot.FindAnyWidget(
"dayz_logo").Show(!onlineOpen);
array< ref BiosPrivacyUidResult > BiosPrivacyUidResultArray
Super root of all classes in Enforce script.
static bool IsPlayerMuted(string id)
static void ShowInviteScreen()
static map< string, bool > GetMuteList()
ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but l...
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
const int IDC_MAIN_OPTIONS
const int IDC_MULTI_INVITE
const int IDC_MAIN_CONTINUE
const int IDC_INT_RETRY
ingame menu
const int IDC_MAIN_FEEDBACK
const int IDC_MAIN_TUTORIAL
const int IDC_MAIN_ONLINE
int ARGB(int a, int r, int g, int b)
void SelectServer(ServerBrowserEntry server)