titlescreenmenu.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*! Xbox menu */
  2. class TitleScreenMenu extends UIScriptedMenu
  3. {
  4. RichTextWidget m_TextPress;
  5. void TitleScreenMenu()
  6. {
  7. g_Game.SetGameState(DayZGameState.MAIN_MENU);
  8. g_Game.SetLoadState(DayZLoadState.MAIN_MENU_START);
  9. }
  10. void ~TitleScreenMenu()
  11. {
  12. }
  13. override Widget Init()
  14. {
  15. layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/day_z_title_screen.layout");
  16. MissionMainMenu mission = MissionMainMenu.Cast(g_Game.GetMission());
  17. m_TextPress = RichTextWidget.Cast(layoutRoot.FindAnyWidget("InputPromptText"));
  18. if (m_TextPress)
  19. {
  20. string gamertag;
  21. string text = Widget.TranslateString("#console_start_game");
  22. GetGame().GetPlayerName(gamertag);
  23. #ifdef PLATFORM_XBOX
  24. BiosUserManager user_manager = GetGame().GetUserManager();
  25. if (user_manager && user_manager.GetSelectedUser())
  26. m_TextPress.SetText(string.Format(text, "<image set=\"xbox_buttons\" name=\"A\" />"));
  27. else
  28. m_TextPress.SetText(string.Format(text, "<image set=\"xbox_buttons\" name=\"A\" />"));
  29. #endif
  30. #ifdef PLATFORM_PS4
  31. string confirm = "cross";
  32. if (GetGame().GetInput().GetEnterButton() == GamepadButton.A)
  33. {
  34. confirm = "cross";
  35. }
  36. else
  37. {
  38. confirm = "circle";
  39. }
  40. m_TextPress.SetText(string.Format(text, "<image set=\"playstation_buttons\" name=\"" + confirm + "\" />"));
  41. #endif
  42. }
  43. return layoutRoot;
  44. }
  45. override void OnShow()
  46. {
  47. if (g_Game.GetGameState() != DayZGameState.CONNECTING)
  48. {
  49. #ifdef PLATFORM_CONSOLE
  50. g_Game.GamepadCheck();
  51. #endif
  52. }
  53. layoutRoot.FindAnyWidget("notification_root").Show(false);
  54. #ifdef PLATFORM_CONSOLE
  55. #ifdef PLATFORM_XBOX
  56. #ifdef BUILD_EXPERIMENTAL
  57. layoutRoot.FindAnyWidget("notification_root").Show(true);
  58. #endif
  59. #endif
  60. #endif
  61. SetWidgetAnimAlpha(m_TextPress);
  62. }
  63. override void OnHide()
  64. {
  65. layoutRoot.FindAnyWidget("notification_root").Show(false);
  66. }
  67. override void Update(float timeslice)
  68. {
  69. super.Update(timeslice);
  70. if (GetUApi().GetInputByID(UAUISelect).LocalPress())
  71. {
  72. #ifdef PLATFORM_WINDOWS
  73. EnterScriptedMenu(MENU_MAIN);
  74. #endif
  75. #ifdef PLATFORM_XBOX
  76. g_Game.GamepadCheck();
  77. #endif
  78. }
  79. }
  80. }