4 private TextWidget m_LogoutTimeText;
5 private TextWidget m_DescriptionText;
6 private ButtonWidget m_bLogoutNow;
7 private ButtonWidget m_bCancel;
8 #ifdef PLATFORM_CONSOLE
9 private ButtonWidget m_bCancelConsole;
13 private ref FullTimeData m_FullTime;
18 g_Game.SetKeyboardHandle(
this);
20 m_FullTime =
new FullTimeData();
25 g_Game.SetKeyboardHandle(null);
31 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
32 if (player && player.GetEmoteManager())
34 player.GetEmoteManager().SetClientLoggingOut(
false);
37 #ifdef PLATFORM_CONSOLE
45 override Widget
Init()
47 layoutRoot =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/day_z_logout_dialog.layout");
49 m_LogoutTimeText = TextWidget.Cast(layoutRoot.FindAnyWidget(
"txtLogoutTime"));
50 m_DescriptionText = TextWidget.Cast(layoutRoot.FindAnyWidget(
"txtDescription"));
51 m_bLogoutNow = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"bLogoutNow"));
52 m_bCancel = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"bCancel"));
54 #ifdef PLATFORM_CONSOLE
55 m_bCancelConsole = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"bCancelConsole"));
56 m_bCancel.Show(
false);
57 m_bLogoutNow.Show(
false);
60 m_bLogoutNow.Show(
true);
61 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(
false);
67 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
68 if (player.GetEmoteManager() && !player.IsRestrained() && !player.IsUnconscious())
70 player.GetEmoteManager().SetClientLoggingOut(
true);
73 #ifdef PLATFORM_CONSOLE
88 layoutRoot.Show(
true);
94 layoutRoot.Show(
false);
97 override bool OnClick(Widget w,
int x,
int y,
int button)
99 super.OnClick(w,
x,
y, button);
101 if (w == m_bLogoutNow)
103 g_Game.GetMission().AbortMission();
107 #ifdef PLATFORM_CONSOLE
108 else if (w == m_bCancelConsole)
110 else if (w == m_bCancel)
121 override void Update(
float timeslice)
123 if (
GetUApi().GetInputByID(UAUIBack).LocalPress())
132 m_LogoutTimeText.SetText(
" ");
138 string text =
"#layout_logout_dialog_until_logout_";
140 TimeConversions.ConvertSecondsToFullTime(time, m_FullTime);
142 if (m_FullTime.m_Days > 0)
144 else if (m_FullTime.m_Hours > 0)
146 else if (m_FullTime.m_Minutes > 0)
151 text = Widget.TranslateString(text);
152 text =
string.Format(text, m_FullTime.m_Seconds, m_FullTime.m_Minutes, m_FullTime.m_Hours, m_FullTime.m_Days);
153 m_LogoutTimeText.SetText(text);
171 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
172 if (player.IsRestrained() || player.IsUnconscious())
175 m_DescriptionText.SetText(
"#layout_logout_dialog_note_killed");
180 m_DescriptionText.SetText(
"#layout_logout_dialog_note");
187 g_Game.GetMission().Continue();
193 g_Game.GetMission().AbortMission();
198 g_Game.GetMission().Continue();
202 g_Game.LogoutRequestCancel();
205 #ifdef PLATFORM_CONSOLE
213 bool toolbarShow =
false;
214 toolbarShow = !
g_Game.GetInput().IsEnabledMouseAndKeyboard() ||
g_Game.GetInput().GetCurrentInputDevice() ==
EInputDeviceType.CONTROLLER;
215 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(toolbarShow);
216 m_bCancelConsole.Show(!toolbarShow);
220 RichTextWidget toolbar_b = RichTextWidget.Cast(layoutRoot.FindAnyWidget(
"BackIcon"));
221 toolbar_b.SetText(InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIBack",
"", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
void SetTime(float time)
DEPRECATED.