3 const int ID_RESPAWN_CUSTOM = 101;
4 const int ID_RESPAWN_RANDOM = 102;
7 protected Widget m_DetailsRoot;
11 protected Widget m_CustomRespawn;
14 protected Widget m_CurrentlyHighlighted;
16 void RespawnDialogue();
17 void ~RespawnDialogue();
21 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/day_z_respawn_dialogue.layout");
22 m_DetailsRoot = layoutRoot.FindAnyWidget(
"menu_details_tooltip");
23 m_DetailsLabel =
TextWidget.Cast(m_DetailsRoot.FindAnyWidget(
"menu_details_label"));
24 m_DetailsText =
RichTextWidget.Cast(m_DetailsRoot.FindAnyWidget(
"menu_details_tooltip_content"));
26 m_CustomRespawn = layoutRoot.FindAnyWidget(
"respawn_button_custom");
32 override void Update(
float timeslice)
34 super.Update(timeslice);
36 if (
GetUApi().GetInputByID(UAUIBack).LocalPress() ||
GetUApi().GetInputByID(UAUIMenu).LocalPress())
42 super.OnClick(w,
x,
y, button);
44 switch (w.GetUserID())
50 case ID_RESPAWN_CUSTOM:
51 return RequestRespawn(
false);
53 case ID_RESPAWN_RANDOM:
54 return RequestRespawn(
true);
62 string tooltip_header =
"";
63 string tooltip_text =
"";
65 switch (w.GetUserID())
67 case ID_RESPAWN_RANDOM:
68 tooltip_header =
"#main_menu_respawn_random";
69 tooltip_text =
"#main_menu_respawn_random_tooltip";
72 case ID_RESPAWN_CUSTOM:
73 tooltip_header =
"#main_menu_respawn_custom";
74 tooltip_text =
"#main_menu_respawn_custom_tooltip";
78 SetTooltipTexts(w, tooltip_header, tooltip_text);
97 string tooltip_header =
"";
98 string tooltip_text =
"";
102 switch (w.GetUserID())
104 case ID_RESPAWN_RANDOM:
105 tooltip_header =
"#main_menu_respawn_random";
106 tooltip_text =
"#main_menu_respawn_random_tooltip";
109 case ID_RESPAWN_CUSTOM:
110 tooltip_header =
"#main_menu_respawn_custom";
111 tooltip_text =
"#main_menu_respawn_custom_tooltip";
115 SetTooltipTexts(w, tooltip_header, tooltip_text);
119 SetTooltipTexts(w, tooltip_header, tooltip_text);
138 if (w.GetUserID() ==
IDC_CANCEL || w.GetUserID() == ID_RESPAWN_CUSTOM || w.GetUserID() == ID_RESPAWN_RANDOM);
150 if (m_CurrentlyHighlighted != w)
152 if (m_CurrentlyHighlighted)
155 m_CurrentlyHighlighted = w;
158 ButtonSetColor(w,
ARGB(255, 0, 0, 0));
159 ButtonSetTextColor(w,
ARGB(255, 255, 0, 0));
167 ButtonSetColor(w,
ARGB(0, 0, 0, 0));
168 ButtonSetTextColor(w,
ARGB(255, 255, 255, 255));
171 protected void ButtonSetColor(
Widget w,
int color)
173 Widget panel = w.FindWidget(w.GetName() +
"_panel");
175 panel.SetColor(color);
178 protected void ButtonSetTextColor(
Widget w,
int color)
182 label.SetColor(color);
185 void SetTooltipTexts(
Widget w,
string header =
"",
string desc =
"")
187 bool show = header !=
"" && desc !=
"";
188 m_DetailsRoot.Show(show);
189 m_DetailsLabel.SetText(header);
190 m_DetailsText.SetText(desc);
192 m_DetailsText.Update();
193 m_DetailsLabel.Update();
194 m_DetailsRoot.Update();
197 bool RequestRespawn(
bool random)
199 IngameHud.Cast(
GetGame().GetMission().GetHud()).InitBadgesAndNotifiers();
200 Man player =
GetGame().GetPlayer();
201 if (player && (player.GetPlayerState() ==
EPlayerStates.ALIVE && !player.IsUnconscious()))
204 #ifdef PLATFORM_CONSOLE
205 InGameMenuXbox menu_ingame = InGameMenuXbox.Cast(
GetGame().GetUIManager().FindMenu(
MENU_INGAME));
207 InGameMenu menu_ingame = InGameMenu.Cast(
GetGame().GetUIManager().FindMenu(
MENU_INGAME));
213 menu_ingame.MenuRequestRespawn(
this, random);