3 protected ref MainMenuStats
m_Stats;
4 protected ref MainMenuVideo m_Video;
12 protected Widget m_CharacterRotationFrame;
15 protected Widget m_ChooseServer;
16 protected Widget m_CustomizeCharacter;
17 protected Widget m_PlayVideo;
18 protected Widget m_Tutorials;
19 protected Widget m_TutorialButton;
20 protected Widget m_MessageButton;
21 protected Widget m_SettingsButton;
23 protected Widget m_NewsMain;
24 protected Widget m_NewsSec1;
25 protected Widget m_NewsSec2;
26 protected Widget m_PrevCharacter;
27 protected Widget m_NextCharacter;
29 protected Widget m_LastPlayedTooltip;
30 protected Widget m_LastPlayedTooltipLabel;
35 protected ref WidgetFadeTimer m_LastPlayedTooltipTimer;
36 protected ref
Widget m_LastFocusedButton;
39 protected ref ModsMenuSimple m_ModsSimple;
40 protected ref ModsMenuDetailed m_ModsDetailed;
41 protected ref ModsMenuTooltip m_ModsTooltip;
43 protected Widget m_DlcFrame;
47 protected ref MainMenuDlcHandlerBase m_DisplayedDlcHandler;
52 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/main_menu.layout");
54 m_Play = layoutRoot.FindAnyWidget(
"play");
55 m_ChooseServer = layoutRoot.FindAnyWidget(
"choose_server");
56 m_CustomizeCharacter = layoutRoot.FindAnyWidget(
"customize_character");
57 m_PlayVideo = layoutRoot.FindAnyWidget(
"play_video");
58 m_Tutorials = layoutRoot.FindAnyWidget(
"tutorials");
59 m_TutorialButton = layoutRoot.FindAnyWidget(
"tutorial_button");
60 m_MessageButton = layoutRoot.FindAnyWidget(
"message_button");
61 m_SettingsButton = layoutRoot.FindAnyWidget(
"settings_button");
62 m_Exit = layoutRoot.FindAnyWidget(
"exit_button");
63 m_PrevCharacter = layoutRoot.FindAnyWidget(
"prev_character");
64 m_NextCharacter = layoutRoot.FindAnyWidget(
"next_character");
66 m_DlcFrame = layoutRoot.FindAnyWidget(
"dlc_Frame");
67 m_Version =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"version"));
69 m_CharacterRotationFrame = layoutRoot.FindAnyWidget(
"character_rotation_frame");
71 m_LastPlayedTooltip = layoutRoot.FindAnyWidget(
"last_server_info");
72 m_LastPlayedTooltip.Show(
false);
73 m_LastPlayedTooltipLabel = m_LastPlayedTooltip.FindAnyWidget(
"last_server_info_label");
74 m_LastPlayedTooltipName =
TextWidget.Cast(m_LastPlayedTooltip.FindAnyWidget(
"last_server_info_name"));
75 m_LastPlayedTooltipIP =
TextWidget.Cast(m_LastPlayedTooltip.FindAnyWidget(
"last_server_info_ip"));
76 m_LastPlayedTooltipPort =
TextWidget.Cast(m_LastPlayedTooltip.FindAnyWidget(
"last_server_info_port"));
78 m_LastPlayedTooltipTimer =
new WidgetFadeTimer();
80 m_Stats =
new MainMenuStats(layoutRoot.FindAnyWidget(
"character_stats_root"));
84 m_LastFocusedButton = m_Play;
90 m_ScenePC.ResetIntroCamera();
93 m_PlayVideo.Show(
false);
95 m_PlayerName =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"character_name_text"));
100 m_Version.SetText(
"#main_menu_version" +
" " + version);
102 GetGame().GetUIManager().ScreenFadeOut(0);
112 GetGame().GetMission().GetOnModMenuVisibilityChanged().Insert(ShowDlcFrame);
114 g_Game.SetLoadState(DayZLoadState.MAIN_MENU_CONTROLLER_SELECT);
123 GetGame().GetMission().GetOnModMenuVisibilityChanged().Remove(ShowDlcFrame);
130 GetGame().GetModInfos(modArray);
132 if (modArray.Count() > 0)
134 modArray.Remove(modArray.Count() - 1);
138 FilterDlcs(modArray);
143 delete m_ModsDetailed;
147 if (modArray.Count() > 0)
149 layoutRoot.FindAnyWidget(
"ModsSimple").Show(
true);
150 m_ModsTooltip =
new ModsMenuTooltip(layoutRoot);
152 m_ModsDetailed =
new ModsMenuDetailed(modArray, layoutRoot.FindAnyWidget(
"ModsDetailed"), m_ModsTooltip,
this);
154 m_ModsSimple =
new ModsMenuSimple(modArray, layoutRoot.FindAnyWidget(
"ModsSimple"), m_ModsDetailed);
162 m_AllDlcsMap.Clear();
164 int count = modArray.Count();
166 for (
int i = count - 1; i > -1; i--)
171 m_AllDlcsMap.Set(info.GetName(),info);
177 void ShowDlcFrame(
bool show)
179 m_DlcFrame.Show(show);
180 if (m_DisplayedDlcHandler)
181 m_DisplayedDlcHandler.ShowInfoPanel(show);
184 void PopulateDlcFrame()
190 int count = m_DlcData.DLCs.Count();
194 for (
int i = 0; i < count; i++)
196 data = m_DlcData.DLCs[i];
197 info = m_AllDlcsMap.Get(data.Name);
198 MainMenuDlcHandlerBase handler =
new MainMenuDlcHandlerBase(info, m_DlcFrame, data);
200 handler.ShowInfoPanel(
true);
201 m_DisplayedDlcHandler = handler;
203 m_DlcHandlers.Insert(handler);
209 if (w == m_CharacterRotationFrame)
212 m_ScenePC.CharacterRotationStart();
222 m_ScenePC.CharacterRotationStop();
232 m_LastFocusedButton = m_Play;
236 else if (w == m_ChooseServer)
238 m_LastFocusedButton = m_ChooseServer;
239 OpenMenuServerBrowser();
242 else if (w == m_CustomizeCharacter)
244 OpenMenuCustomizeCharacter();
247 else if (w == m_TutorialButton)
252 else if (w == m_MessageButton)
257 else if (w == m_SettingsButton)
262 else if (w == m_Exit)
267 else if (w == m_PrevCharacter)
272 else if (w == m_NextCharacter)
277 else if (w == m_PlayVideo)
279 m_LastFocusedButton = m_PlayVideo;
283 else if (w == m_Tutorials)
285 m_LastFocusedButton = m_Tutorials;
301 if (m_ScenePC && !m_ScenePC.GetIntroCharacter().IsDefaultCharacter())
303 int charID = m_ScenePC.GetIntroCharacter().GetCharacterID();
304 m_ScenePC.GetIntroCharacter().GetLastPlayedServer(charID, ip,
name, port);
306 m_LastPlayedTooltipName.SetText(
"#server_details_name " +
name);
307 m_LastPlayedTooltipIP.SetText(
"#main_menu_IP " + ip);
308 m_LastPlayedTooltipPort.SetText(
"#main_menu_port " + port);
310 m_LastPlayedTooltipTimer.FadeIn(m_LastPlayedTooltip, 0.3,
true);
326 m_LastPlayedTooltipTimer.FadeOut(m_LastPlayedTooltip, 0.3,
true);
361 if (w == m_Play || w == m_ChooseServer || w == m_CustomizeCharacter || w == m_TutorialButton || w == m_MessageButton || w == m_SettingsButton);
366 if (w == m_Exit || w == m_PlayVideo);
371 if (w == m_NewsMain || w == m_NewsSec1 || w == m_NewsSec2 || w == m_PrevCharacter || w == m_NextCharacter);
382 if (m_ScenePC &&
g_Game.GetGameState() == DayZGameState.MAIN_MENU)
387 m_Version.SetText(
"#main_menu_version" +
" " + version);
392 if (m_DisplayedDlcHandler)
393 m_DisplayedDlcHandler.ShowInfoPanel(
true);
396 OnChangeCharacter(
false);
404 if (m_DisplayedDlcHandler)
405 m_DisplayedDlcHandler.ShowInfoPanel(
false);
410 override void Update(
float timeslice)
412 super.Update(timeslice);
422 if (!
g_Game.IsNewCharacter())
432 bool CanSaveDefaultCharacter()
434 if (m_ScenePC && m_ScenePC.GetIntroCharacter() && m_ScenePC.GetIntroCharacter().GetCharacterID() == -1)
441 void OpenMenuServerBrowser()
446 void OpenMenuCustomizeCharacter()
453 if (m_ScenePC && m_ScenePC.GetIntroCharacter())
455 int charID = m_ScenePC.GetIntroCharacter().GetNextCharacterID();
456 if (charID != m_ScenePC.GetIntroCharacter().GetCharacterID())
458 m_ScenePC.GetIntroCharacter().SetCharacterID(charID);
464 void PreviousCharacter()
466 if (m_ScenePC && m_ScenePC.GetIntroCharacter())
468 int charID = m_ScenePC.GetIntroCharacter().GetPrevCharacterID();
469 if (charID != m_ScenePC.GetIntroCharacter().GetCharacterID())
471 m_ScenePC.GetIntroCharacter().SetCharacterID(charID);
477 void OnChangeCharacter(
bool create_character =
true)
479 if (m_ScenePC && m_ScenePC.GetIntroCharacter())
481 int charID = m_ScenePC.GetIntroCharacter().GetCharacterID();
482 if (create_character)
484 m_ScenePC.GetIntroCharacter().CreateNewCharacterById(charID);
486 m_PlayerName.SetText(m_ScenePC.GetIntroCharacter().GetCharacterNameById(charID));
488 Widget w = m_CustomizeCharacter.FindAnyWidget(m_CustomizeCharacter.GetName() +
"_label");
494 if (m_ScenePC.GetIntroCharacter().IsDefaultCharacter())
496 text.SetText(
"#layout_main_menu_customize_char");
500 text.SetText(
"#layout_main_menu_rename");
503 if (m_ScenePC.GetIntroCharacter().GetCharacterObj())
505 if (m_ScenePC.GetIntroCharacter().GetCharacterObj().IsMale())
506 m_ScenePC.GetIntroCharacter().SetCharacterGender(
ECharGender.Male);
508 m_ScenePC.GetIntroCharacter().SetCharacterGender(
ECharGender.Female);
549 GetGame().GetUIManager().ShowDialog(
"#main_menu_exit",
"#main_menu_exit_desc",
IDC_MAIN_QUIT, DBT_YESNO, DBB_YES, DMT_QUESTION,
this);
552 bool TryConnectLastSession(out
string ip, out
int port)
554 if (
g_Game.GetLastVisitedServer(ip, port))
566 void ConnectLastSession()
572 if (!m_ScenePC.GetIntroCharacter().IsDefaultCharacter())
574 int charID = m_ScenePC.GetIntroCharacter().GetCharacterID();
575 m_ScenePC.GetIntroCharacter().GetLastPlayedServer(charID,ip,
name,port);
580 g_Game.ConnectFromServerBrowser(ip, port,
"");
584 OpenMenuServerBrowser();
588 void ConnectBestServer()
590 ConnectLastSession();
593 override bool OnModalResult(
Widget w,
int x,
int y,
int code,
int result)
603 else if (code == 555)
617 int color_pnl =
ARGB(255, 0, 0, 0);
618 int color_lbl =
ARGB(255, 255, 0, 0);
619 int color_img =
ARGB(255, 200, 0, 0);
621 ButtonSetColor(w, color_pnl);
622 ButtonSetTextColor(w, color_lbl);
623 ImagenSetColor(w, color_img);
631 int color_pnl =
ARGB(0, 0, 0, 0);
632 int color_lbl =
ARGB(255, 255, 255, 255);
633 int color_img =
ARGB(255, 255, 255, 255);
635 ButtonSetColor(w, color_pnl);
636 ButtonSetTextColor(w, color_lbl);
637 ImagenSetColor(w, color_img);
640 void ButtonSetText(
Widget w,
string text)
654 void ButtonSetColor(
Widget w,
int color)
659 Widget panel = w.FindWidget(w.GetName() +
"_panel");
663 panel.SetColor(color);
667 void ImagenSetColor(
Widget w,
int color)
672 Widget panel = w.FindWidget(w.GetName() +
"_image");
676 panel.SetColor(color);
680 void ButtonSetTextColor(
Widget w,
int color)
691 label.SetColor(color);
696 text.SetColor(color);
701 text2.SetColor(color);