DayZ 1.24
Loading...
Searching...
No Matches
TitleScreenMenu.c
Go to the documentation of this file.
1
2class TitleScreenMenu extends UIScriptedMenu
3{
5
7 {
8 g_Game.SetGameState(DayZGameState.MAIN_MENU);
9 g_Game.SetLoadState(DayZLoadState.MAIN_MENU_START);
10 }
11
13 {
14 }
15
16 override Widget Init()
17 {
18 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/day_z_title_screen.layout");
19
20 MissionMainMenu mission = MissionMainMenu.Cast(g_Game.GetMission());
21
22 m_TextPress = RichTextWidget.Cast(layoutRoot.FindAnyWidget("InputPromptText"));
23 if (m_TextPress)
24 {
25 string gamertag;
26 string text = Widget.TranslateString("#console_start_game");
27 GetGame().GetPlayerName(gamertag);
28#ifdef PLATFORM_XBOX
29 BiosUserManager user_manager = GetGame().GetUserManager();
30 if (user_manager && user_manager.GetSelectedUser())
31 m_TextPress.SetText(string.Format(text, "<image set=\"xbox_buttons\" name=\"A\" />"));
32 else
33 m_TextPress.SetText(string.Format(text, "<image set=\"xbox_buttons\" name=\"A\" />"));
34#endif
35
36#ifdef PLATFORM_PS4
37 string confirm = "cross";
38 if (GetGame().GetInput().GetEnterButton() == GamepadButton.A)
39 confirm = "cross";
40 else
41 confirm = "circle";
42 m_TextPress.SetText(string.Format(text, "<image set=\"playstation_buttons\" name=\"" + confirm + "\" />"));
43#endif
44 }
45 return layoutRoot;
46 }
47
48 override void OnShow()
49 {
50 if (g_Game.GetGameState() != DayZGameState.CONNECTING)
51 {
52#ifdef PLATFORM_CONSOLE
53 g_Game.GamepadCheck();
54#endif
55 }
56 layoutRoot.FindAnyWidget("notification_root").Show(false);
57
58#ifdef PLATFORM_CONSOLE
59#ifdef PLATFORM_XBOX
60#ifdef BUILD_EXPERIMENTAL
61 layoutRoot.FindAnyWidget("notification_root").Show(true);
62#endif
63#endif
64#endif
65 SetWidgetAnimAlpha(m_TextPress);
66 }
67
68 override void OnHide()
69 {
70 layoutRoot.FindAnyWidget("notification_root").Show(false);
71 }
72
73 override void Update(float timeslice)
74 {
75 super.Update(timeslice);
76
77 if (GetUApi().GetInputByID(UAUISelect).LocalPress())
78 {
79#ifdef PLATFORM_WINDOWS
80 EnterScriptedMenu(MENU_MAIN);
81#endif
82#ifdef PLATFORM_XBOX
83 g_Game.GamepadCheck();
84#endif
85 }
86 }
87}
ActionInput GetInput()
Definition ActionBase.c:989
DayZGame g_Game
Definition DayZGame.c:3528
Mission mission
proto native UAInputAPI GetUApi()
override void OnShow()
override void Update(float timeslice)
override void OnHide()
RichTextWidget m_TextPress
override Widget Init()
proto native CGame GetGame()
GamepadButton
Definition EnSystem.c:341
const int MENU_MAIN
Definition constants.c:172