123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792 |
- class InGameMenuXbox extends UIScriptedMenu
- {
- // Widgets texts id
- protected string m_MuteButtonTextID;
- protected string m_UnmuteButtonTextID;
- protected string m_BackButtonTextID;
- protected string m_SelectButtonTextID;
- protected string m_OpenGameCardButtonTextID;
- protected string m_CurrentMuteButtonText;
-
- protected bool m_SelectAvailable;
- protected bool m_MuteAvailable;
- protected bool m_BackAvailable;
- protected bool m_GamercardAvailable;
-
- protected bool m_PlayerAlive;
-
- protected ref PlayerListScriptedWidget m_ServerInfoPanel;
-
- protected Widget m_OnlineMenu;
-
- protected ButtonWidget m_ContinueButton;
- protected ButtonWidget m_ExitButton;
- protected ButtonWidget m_RestartDeadButton;
- protected ButtonWidget m_RestartButton;
- protected ButtonWidget m_OptionsButton;
- protected ButtonWidget m_ControlsButton;
- protected ButtonWidget m_OnlineButton;
- protected ButtonWidget m_TutorialsButton;
-
- protected TextWidget m_Version;
-
- const int BUTTON_XBOX_CONTROLS = 201;
-
- void InGameMenuXbox()
- {
- GetGame().GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
- GetGame().GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
- }
- void ~InGameMenuXbox()
- {
- ClientData.SyncEvent_OnPlayerListUpdate.Remove(SyncEvent_OnRecievedPlayerList);
- OnlineServices.m_PermissionsAsyncInvoker.Remove(OnPermissionsUpdate);
-
- Mission mission = GetGame().GetMission();
- if (mission)
- {
- IngameHud hud = IngameHud.Cast(mission.GetHud());
- if (hud)
- {
- hud.ShowHudUI(true);
- hud.ShowQuickbarUI(true);
- }
-
- mission.Continue();
- }
-
- PPERequesterBank.GetRequester(PPERequester_MenuEffects).Stop();
- }
-
- protected void OnInputPresetChanged()
- {
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- #endif
- }
-
- protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
- {
- UpdateControlsElements();
- }
-
- override Widget Init()
- {
- layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/day_z_ingamemenu_xbox.layout");
-
- m_OnlineMenu = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/ingamemenu_xbox/online_info_menu.layout", layoutRoot);
- m_OnlineMenu.Show(false);
-
- m_ContinueButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("continuebtn"));
- m_RestartDeadButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("restartbtn_dead"));
- m_ExitButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("exitbtn"));
- m_RestartButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("restartbtn"));
- m_OptionsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("optionsbtn"));
- m_ControlsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("controlsbtn"));
- m_OnlineButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("onlinebtn"));
- m_TutorialsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("tutorialsbtn"));
- m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget("version"));
-
- m_SelectAvailable = true;
- m_MuteAvailable = false;
- m_GamercardAvailable = false;
- m_BackAvailable = true;
-
- PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
- if (player)
- {
- m_PlayerAlive = player.GetPlayerState() == EPlayerStates.ALIVE;
- if (!m_PlayerAlive)
- m_BackAvailable = false;
-
- player.GetOnUnconsciousStart().Insert(UpdateGUI);
- player.GetOnUnconsciousStart().Insert(UpdateMenuFocus);
- player.GetOnUnconsciousStop().Insert(UpdateGUI);
- player.GetOnUnconsciousStop().Insert(UpdateMenuFocus);
- player.GetOnDeathStart().Insert(UpdateGUI);
- player.GetOnDeathStart().Insert(UpdateMenuFocus);
- }
-
- string version;
- GetGame().GetVersion(version);
- #ifdef PLATFORM_CONSOLE
- version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
- #else
- version = "#main_menu_version" + " " + version;
- #endif
- m_Version.SetText(version);
-
- if (GetGame().IsMultiplayer())
- {
- m_OnlineButton.Show(true);
-
- TextWidget w_text = TextWidget.Cast(m_OnlineMenu.FindAnyWidget("OnlineTextWidget"));
- w_text.SetText(g_Game.GetHostName());
-
- m_ServerInfoPanel = new PlayerListScriptedWidget(m_OnlineMenu.FindAnyWidget("ServerInfoPanel"));
-
- OnlineServices.m_PermissionsAsyncInvoker.Insert(OnPermissionsUpdate);
- ClientData.SyncEvent_OnPlayerListUpdate.Insert(SyncEvent_OnRecievedPlayerList);
-
- m_ServerInfoPanel.Reload(ClientData.m_PlayerList);
- m_ServerInfoPanel.ReloadLocal(OnlineServices.GetMuteList());
-
- string uid = m_ServerInfoPanel.FindPlayerByWidget(GetFocus());
- if (uid != "")
- {
- if (IsLocalPlayer(uid) || m_ServerInfoPanel.IsEmpty())
- {
- m_MuteAvailable = false;
- m_GamercardAvailable = false;
- }
- else
- {
- m_MuteAvailable = !GetGame().GetWorld().IsDisabledReceivingVoN();
- #ifndef PLATFORM_PS4
- m_GamercardAvailable = true;
- #endif
- SetMuteButtonText(OnlineServices.IsPlayerMuted(uid));
- }
-
- if (m_ServerInfoPanel.IsGloballyMuted(uid))
- {
- m_MuteAvailable = false;
- }
- }
- }
- else
- {
- layoutRoot.FindAnyWidget("onlinebtn").Show(false);
- layoutRoot.FindAnyWidget("invitebtn").Show(false);
- }
-
- //RESPAWN & RESTART
- if (GetGame().IsMultiplayer())
- {
- m_RestartButton.SetText("#main_menu_respawn");
- }
- else
- {
- m_RestartButton.SetText("#main_menu_restart");
- }
-
- if (!ShouldRestartBeVisible(player))
- {
- //m_RestartButton.Enable(false);
- m_RestartButton.Show(false);
- }
-
- Mission mission = GetGame().GetMission();
- if (mission)
- {
- IngameHud hud = IngameHud.Cast(mission.GetHud());
- if (hud)
- {
- hud.ShowHudUI(false);
- hud.ShowQuickbarUI(false);
- }
-
- mission.Pause();
- }
-
- PPERequester_MenuEffects requester;
- Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
- requester.SetVignetteIntensity(0.6);
-
- UpdateControlsElements();
- LoadTextStrings();
- LoadFooterButtonTexts();
-
- OnInputDeviceChanged(GetGame().GetInput().GetCurrentInputDevice());
-
- return layoutRoot;
- }
-
- override bool OnClick(Widget w, int x, int y, int button)
- {
- super.OnClick(w, x, y, button);
-
- switch (w.GetUserID())
- {
- case IDC_MAIN_CONTINUE:
- {
- GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetMission().Continue);
- return true;
- }
- case IDC_MAIN_OPTIONS:
- {
- EnterScriptedMenu(MENU_OPTIONS);
- return true;
- }
- case BUTTON_XBOX_CONTROLS:
- {
- EnterScriptedMenu(MENU_XBOX_CONTROLS);
- return true;
- }
- case IDC_MAIN_QUIT:
- {
- GetGame().GetUIManager().ShowDialog("#main_menu_exit", "#main_menu_exit_desc", IDC_INT_EXIT, DBT_YESNO, DBB_YES, DMT_QUESTION, NULL);
- return true;
- }
- case IDC_INT_RETRY:
- {
- if (!GetGame().IsMultiplayer())
- {
- GetGame().GetUIManager().ShowDialog("#main_menu_restart", "Are you sure you want to restart?", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
- }
- else
- {
- GetGame().GetUIManager().ShowDialog("#main_menu_respawn", "#main_menu_respawn_question", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
- }
- return true;
- }
- case IDC_MAIN_ONLINE:
- {
- m_OnlineMenu.Show(true);
- m_SelectAvailable = false;
-
- UpdateControlsElements();
- m_ServerInfoPanel.FocusFirst();
- return true;
- }
- case 117:
- {
- EnterScriptedMenu(MENU_TUTORIAL);
- return true;
- }
- case IDC_MULTI_INVITE:
- {
- OnlineServices.ShowInviteScreen();
- return true;
- }
- }
-
- if (w == layoutRoot.FindAnyWidget("backbtn"))
- {
- CloseOnline();
- }
- else if (w == m_RestartDeadButton)
- {
- if (GetGame().GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
- {
- GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
- }
- else
- {
- GameRetry(true);
- }
- return true;
- }
- return false;
- }
-
- override bool OnModalResult(Widget w, int x, int y, int code, int result)
- {
- super.OnModalResult(w, x, y, code, result);
-
- if (code == IDC_INT_EXIT && result == DBB_YES)
- {
- if (GetGame().IsMultiplayer())
- {
- GetGame().LogoutRequestTime();
- GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetMission().CreateLogoutMenu, this);
- }
- else
- {
- // skip logout screen in singleplayer
- GetGame().GetMission().AbortMission();
- }
- g_Game.CancelLoginTimeCountdown();
-
- return true;
-
- }
- else if (code == IDC_INT_EXIT && result == DBB_NO)
- {
- g_Game.CancelLoginTimeCountdown();
- }
- else if (code == IDC_INT_RETRY)
- {
- if (result == DBB_YES)
- {
- if (GetGame().GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
- {
- GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
- }
- else
- {
- GameRetry(true);
- return true;
- }
- }
- else
- {
- UpdateMenuFocus();
- }
- }
-
- return false;
- }
-
- void GameRetry(bool random)
- {
- if (GetGame().IsMultiplayer())
- {
- //GetGame().GetUIManager().CloseAll();
- GetGame().GetMenuDefaultCharacterData(false).SetRandomCharacterForced(random);
- GetGame().RespawnPlayer();
- PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
- if (player)
- {
- player.SimulateDeath(true);
- GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(player.ShowDeadScreen, true, 0);
- }
-
- MissionGameplay missionGP = MissionGameplay.Cast(GetGame().GetMission());
- missionGP.DestroyAllMenus();
- missionGP.SetPlayerRespawning(true);
- missionGP.Continue();
- Close();
- }
- else
- GetGame().RestartMission();
- }
-
- void MenuRequestRespawn(UIScriptedMenu menu, bool random)
- {
- if (RespawnDialogue.Cast(menu))
- GameRetry(random);
- }
-
- bool IsLocalPlayer(string uid)
- {
- PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
- string local_uid;
- if (GetGame().GetUserManager())
- local_uid = GetGame().GetUserManager().GetSelectedUser().GetUid();
- return (uid == local_uid);
- }
-
- SyncPlayerList CreateFakePlayerList(int player_count)
- {
- SyncPlayerList player_list = new SyncPlayerList;
- player_list.m_PlayerList = new array<ref SyncPlayer>;
- for (int i = 0; i < player_count; i++)
- {
- SyncPlayer sync_player = new SyncPlayer;
- sync_player.m_UID = "uid" + i;
- sync_player.m_PlayerName = "Player " + i;
- player_list.m_PlayerList.Insert(sync_player);
- }
- return player_list;
- }
-
- override void Update(float timeslice)
- {
- if (GetGame().IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible())
- {
- PlayerListEntryScriptedWidget selected;
- if (m_ServerInfoPanel)
- selected = m_ServerInfoPanel.GetSelectedPlayer();
- if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
- {
- if (selected)
- m_ServerInfoPanel.ToggleMute(selected.GetUID());
- Refresh();
- }
-
- #ifndef PLATFORM_PS4
- if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
- {
- if (selected)
- OnlineServices.ShowUserProfile(selected.GetUID());
- }
- #endif
- }
- }
-
- bool ShouldRestartBeVisible(Man player)
- {
- PlayerBase p = PlayerBase.Cast(player);
- return p && p.IsUnconsciousStateOnly() && !CfgGameplayHandler.GetDisableRespawnInUnconsciousness();
- }
- void UpdateGUI()
- {
- bool shouldUpdateMenuFocus = false;
- Man player = GetGame().GetPlayer();
- if (player)
- m_PlayerAlive = player.GetPlayerState() == EPlayerStates.ALIVE;
-
- if (m_PlayerAlive)
- {
- bool showRestartBtn = ShouldRestartBeVisible(player);
- m_RestartButton.Show(showRestartBtn);
- }
- else
- {
- m_RestartButton.Show(false);
- m_BackAvailable = false;
- }
-
- m_ContinueButton.Show(m_PlayerAlive);
- m_RestartDeadButton.Show(!m_PlayerAlive);
-
- UpdateMenuFocus();
- }
-
- bool IsOnlineOpen()
- {
- return m_OnlineMenu.IsVisible();
- }
- void CloseOnline()
- {
- m_OnlineMenu.Show(false);
- m_SelectAvailable = true;
- m_MuteAvailable = false;
- m_GamercardAvailable = false;
- UpdateControlsElements();
-
- SetFocus(m_OnlineButton);
- }
-
- void SelectServer()
- {
- if (m_ServerInfoPanel)
- {
- m_ServerInfoPanel.FocusFirst();
-
- Refresh();
- }
- }
-
- override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
- {
- return false;
- }
-
- void SyncEvent_OnRecievedPlayerList(SyncPlayerList player_list)
- {
- m_ServerInfoPanel.Reload(player_list);
-
- Refresh();
- }
-
- void OnPermissionsUpdate(BiosPrivacyUidResultArray result_list)
- {
- m_ServerInfoPanel.Reload(result_list);
-
- Refresh();
- }
-
- override void OnShow()
- {
- super.OnShow();
- #ifdef PLATFORM_CONSOLE
- bool mk = GetGame().GetInput().IsEnabledMouseAndKeyboard();
- bool mk_server = GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
- TextWidget warning = TextWidget.Cast(layoutRoot.FindAnyWidget("MouseAndKeyboardWarning"));
- if (mk)
- {
- if (mk_server)
- {
- warning.SetText("#str_mouse_and_keyboard_server_warning");
- }
- else
- {
- warning.SetText("#str_controller_server_warning");
- }
- }
-
- warning.Show(mk);
- #endif
-
- UpdateGUI();
-
- UpdateMenuFocus();
- UpdateControlsElements();
- }
-
- override bool OnMouseEnter(Widget w, int x, int y)
- {
- if (IsFocusable(w))
- {
- ColorHighlight(w);
- return true;
- }
- return false;
- }
-
- override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
- {
- if (IsFocusable(w))
- {
- ColorNormal(w);
- return true;
- }
- return false;
- }
-
- override bool OnFocus(Widget w, int x, int y)
- {
- if (IsFocusable(w))
- {
- ColorHighlight(w);
- return true;
- }
- return false;
- }
-
- override bool OnFocusLost(Widget w, int x, int y)
- {
- if (IsFocusable(w))
- {
- ColorNormal(w);
- return true;
- }
- return false;
- }
-
- bool IsFocusable(Widget w)
- {
- if (w)
- {
- if (w == m_ContinueButton || w == m_ExitButton || w == m_RestartButton || w == m_OptionsButton || w == m_ControlsButton || w == m_OnlineButton || w == m_TutorialsButton);
- return true;
- }
- return false;
- }
-
- override void Refresh()
- {
- string version;
- GetGame().GetVersion(version);
- #ifdef PLATFORM_CONSOLE
- version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
- #else
- version = "#main_menu_version" + " " + version;
- #endif
- m_Version.SetText(version);
-
- m_MuteAvailable = false;
- m_GamercardAvailable = false;
-
- if (GetGame().IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible() && m_ServerInfoPanel)
- {
- PlayerListEntryScriptedWidget selected = m_ServerInfoPanel.GetSelectedPlayer();
- if (selected && !selected.IsLocalPlayer())
- {
- m_MuteAvailable = !GetGame().GetWorld().IsDisabledReceivingVoN() && !selected.IsGloballyMuted();
- #ifndef PLATFORM_PS4
- m_GamercardAvailable = true;
- #endif
- SetMuteButtonText(selected.IsMuted());
- }
- }
-
- UpdateControlsElements();
- }
-
- void ColorDisable(Widget w)
- {
- #ifdef PLATFORM_WINDOWS
- SetFocus(null);
- #endif
-
- ButtonWidget button = ButtonWidget.Cast(w);
- if (button && button != m_ContinueButton)
- {
- button.SetTextColor(ARGB(255, 255, 255, 255));
- }
- ButtonSetColor(w, ARGB(0, 0, 0, 0));
- ButtonSetTextColor(w, ARGB(60, 0, 0, 0));
- }
-
- void ColorHighlight(Widget w)
- {
- if (!w)
- return;
-
- int color_pnl = ARGB(255, 0, 0, 0);
- int color_lbl = ARGB(255, 255, 0, 0);
-
- #ifdef PLATFORM_CONSOLE
- color_pnl = ARGB(255, 200, 0, 0);
- color_lbl = ARGB(255, 255, 255, 255);
- #endif
-
- ButtonSetColor(w, color_pnl);
- ButtonSetTextColor(w, color_lbl);
- }
-
- void ColorNormal(Widget w)
- {
- if (!w)
- return;
-
- int color_pnl = ARGB(0, 0, 0, 0);
- int color_lbl = ARGB(255, 255, 255, 255);
-
- ButtonSetColor(w, color_pnl);
- ButtonSetTextColor(w, color_lbl);
- }
-
- void ButtonSetText(Widget w, string text)
- {
- if (!w)
- return;
-
- TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
-
- if (label)
- {
- label.SetText(text);
- }
-
- }
-
- void ButtonSetColor(Widget w, int color)
- {
- if (!w)
- return;
-
- Widget panel = w.FindWidget(w.GetName() + "_panel");
-
- if (panel)
- {
- panel.SetColor(color);
- }
- }
-
- void ButtonSetTextColor(Widget w, int color)
- {
- if (!w)
- return;
- TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
- TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
- TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
-
- if (label)
- {
- label.SetColor(color);
- }
-
- if (text)
- {
- text.SetColor(color);
- }
-
- if (text2)
- {
- text2.SetColor(color);
- }
- }
-
- /// Set mute text button text (mute / unmute)
- protected void SetMuteButtonText(bool isMuted)
- {
- if (isMuted)
- {
- m_CurrentMuteButtonText = m_UnmuteButtonTextID;
- }
- else
- {
- m_CurrentMuteButtonText = m_MuteButtonTextID;
- }
- }
-
- /// Set correct bottom button texts based on platform (ps4 vs xbox texts)
- protected void LoadTextStrings()
- {
- #ifdef PLATFORM_PS4
- m_MuteButtonTextID = "#ps4_ingame_menu_mute";
- m_UnmuteButtonTextID = "#ps4_ingame_menu_unmute";
- m_BackButtonTextID = "#ps4_ingame_menu_back";
- m_SelectButtonTextID = "#ps4_ingame_menu_select";
- m_OpenGameCardButtonTextID = "#ps4_ingame_menu_opencard";
- #else
- m_MuteButtonTextID = "#xbox_ingame_menu_mute";
- m_UnmuteButtonTextID = "#xbox_ingame_menu_unmute";
- m_BackButtonTextID = "#STR_rootFrame_toolbar_bg_ConsoleToolbar_Back_BackText0";
- m_SelectButtonTextID = "#layout_xbox_ingame_menu_select";
- m_OpenGameCardButtonTextID = "#layout_xbox_ingame_menu_gamecard";
- #endif
- }
-
- /// Initial texts load for the footer buttons
- protected void LoadFooterButtonTexts()
- {
- TextWidget uiGamecardText = TextWidget.Cast(layoutRoot.FindAnyWidget("GamercardText"));
- TextWidget uiBackText = TextWidget.Cast(layoutRoot.FindAnyWidget("BackText"));
- TextWidget uiSelectText = TextWidget.Cast(layoutRoot.FindAnyWidget("SelectText"));
-
- if (uiGamecardText)
- {
- uiGamecardText.SetText(m_OpenGameCardButtonTextID);
- }
- if (uiBackText)
- {
- uiBackText.SetText(m_BackButtonTextID);
- }
- if (uiSelectText)
- {
- uiSelectText.SetText(m_SelectButtonTextID);
- }
- }
-
- void UpdateMenuFocus()
- {
- Man player = GetGame().GetPlayer();
- if (m_PlayerAlive)
- {
- if (ShouldRestartBeVisible(player))
- SetFocus(m_RestartButton);
- else
- SetFocus(m_ContinueButton);
- }
- else
- {
- SetFocus(m_RestartDeadButton);
- }
- }
-
- protected void UpdateControlsElements()
- {
- bool toolbarShow = false;
- #ifdef PLATFORM_CONSOLE
- toolbarShow = !GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
- #endif
-
- if (toolbarShow)
- {
- RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
- string text = "";
- if (m_SelectAvailable)
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", m_SelectButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
- if (m_MuteAvailable)
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", m_CurrentMuteButtonText, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
- if (m_BackAvailable)
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", m_BackButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
- if (m_GamercardAvailable)
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", m_OpenGameCardButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
-
- toolbar_text.SetText(text);
- }
-
- RichTextWidget toolbar_b2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon0"));
- toolbar_b2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER));
-
- bool onlineOpen = IsOnlineOpen();
- layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
- layoutRoot.FindAnyWidget("play_panel_root").Show(!onlineOpen);
- layoutRoot.FindAnyWidget("play_panel_root2").Show(onlineOpen && !toolbarShow);
- layoutRoot.FindAnyWidget("dayz_logo").Show(!onlineOpen);
- }
- }
|