DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
LogoutMenu.c
См. документацию.
1
2class LogoutMenu extends UIScriptedMenu
3{
4 private TextWidget m_LogoutTimeText;
6 private ButtonWidget m_bLogoutNow;
7 private ButtonWidget m_bCancel;
8 #ifdef PLATFORM_CONSOLE
9 private ButtonWidget m_bCancelConsole;
10 #endif
11 private int m_iTime;
12
13 private ref FullTimeData m_FullTime;
14
16 {
17 m_iTime = 0;
18 g_Game.SetKeyboardHandle(this);
19
21 }
22
24 {
25 g_Game.SetKeyboardHandle(null);
26 if (GetGame().GetMission())
27 Cancel(); //cancels request on irregular close (player death, suicide, some mass-menu closure...)
28
29 m_FullTime = null;
30
31 #ifdef PLATFORM_CONSOLE
32 if (GetGame().GetMission())
33 {
35 }
36 #endif
37 }
38
39 override Widget Init()
40 {
41 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/day_z_logout_dialog.layout");
42
43 m_LogoutTimeText = TextWidget.Cast(layoutRoot.FindAnyWidget("txtLogoutTime"));
44 m_DescriptionText = TextWidget.Cast(layoutRoot.FindAnyWidget("txtDescription"));
45 m_bLogoutNow = ButtonWidget.Cast(layoutRoot.FindAnyWidget("bLogoutNow"));
46 m_bCancel = ButtonWidget.Cast(layoutRoot.FindAnyWidget("bCancel"));
47
48 #ifdef PLATFORM_CONSOLE
49 m_bCancelConsole = ButtonWidget.Cast(layoutRoot.FindAnyWidget("bCancelConsole"));
50 m_bCancel.Show(false);
51 m_bLogoutNow.Show(false);
52 #else
53 m_bCancel.Show(true);
54 m_bLogoutNow.Show(true);
55 layoutRoot.FindAnyWidget("toolbar_bg").Show(false);
56 #endif
57
58 UpdateInfo();
59
60 // player should sit down if possible
61 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
62 if (player.GetEmoteManager() && !player.IsRestrained() && !player.IsUnconscious())
63 {
64 player.GetEmoteManager().CreateEmoteCBFromMenu(EmoteConstants.ID_EMOTE_SITA);
65 player.GetEmoteManager().GetEmoteLauncher().SetForced(EmoteLauncher.FORCE_DIFFERENT);
66 }
67
68 #ifdef PLATFORM_CONSOLE
69 if (GetGame().GetMission())
70 {
72 }
73
74 OnInputDeviceChanged(GetGame().GetInput().GetCurrentInputDevice());
75 #endif
76
77 return layoutRoot;
78 }
79
80 void Show()
81 {
82 if (layoutRoot)
83 layoutRoot.Show(true);
84 }
85
86 void Hide()
87 {
88 if (layoutRoot)
89 layoutRoot.Show(false);
90 }
91
92 override bool OnClick(Widget w, int x, int y, int button)
93 {
94 super.OnClick(w, x, y, button);
95
96 if (w == m_bLogoutNow)
97 {
99
100 return true;
101 }
102 #ifdef PLATFORM_CONSOLE
103 else if (w == m_bCancelConsole)
104 #else
105 else if (w == m_bCancel)
106 #endif
107 {
108 Hide();
109 Cancel();
110 return true;
111 }
112
113 return false;
114 }
115
116 override void Update(float timeslice)
117 {
118 if (GetUApi().GetInputByID(UAUIBack).LocalPress())
119 {
120 Hide();
121 Cancel();
122 }
123 }
124
126 {
127 m_LogoutTimeText.SetText(" ");
128 }
129
130 void SetTime(int time)
131 {
132 m_iTime = time;
133 string text = "#layout_logout_dialog_until_logout_";
134
135 TimeConversions.ConvertSecondsToFullTime(time, m_FullTime);
136
137 if (m_FullTime.m_Days > 0)
138 text += "dhms";
139 else if (m_FullTime.m_Hours > 0)
140 text += "hms";
141 else if (m_FullTime.m_Minutes > 0)
142 text += "ms";
143 else
144 text += "s";
145
146 text = Widget.TranslateString(text);
147 text = string.Format(text, m_FullTime.m_Seconds, m_FullTime.m_Minutes, m_FullTime.m_Hours, m_FullTime.m_Days);
148 m_LogoutTimeText.SetText(text);
149 }
150
152 {
153
154 if (m_iTime > 0)
155 {
156 SetTime(--m_iTime);
157 }
158 else
159 {
160 Exit();
161 }
162 }
163
165 {
166 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
167 if (player.IsRestrained() || player.IsUnconscious())
168 {
169 // display killInfo
170 m_DescriptionText.SetText("#layout_logout_dialog_note_killed");
171 }
172 else
173 {
174 // hide killInfo
175 m_DescriptionText.SetText("#layout_logout_dialog_note");
176 }
177 }
178
179 void Exit()
180 {
181 // exit menu and logout screen
183
184 // stop updating of logout screen
186
187 // go back to main menu
189 }
190
191 void Cancel()
192 {
195
196 // request logout cancel from server
198 }
199
200 #ifdef PLATFORM_CONSOLE
201 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
202 {
204 }
205
206 protected void UpdateControlsElementVisibility()
207 {
208 bool toolbarShow = false;
210 layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
211 m_bCancelConsole.Show(!toolbarShow);
212
213 if (toolbarShow)
214 {
215 RichTextWidget toolbar_b = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon"));
216 toolbar_b.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
217 }
218 }
219 #endif
220}
DayZGame g_Game
Определения DayZGame.c:3868
Icon x
Icon y
PlayerBase GetPlayer()
Определения ModifierBase.c:51
proto native UAInputAPI GetUApi()
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native void LogoutRequestCancel()
proto native WorkspaceWidget GetWorkspace()
proto native Input GetInput()
proto native Mission GetMission()
Определения constants.c:359
static const int FORCE_DIFFERENT
Определения EmoteManager.c:77
Определения EmoteManager.c:75
struct that keeps Time relevant information for future formatting
Определения TimeConversions.c:5
proto native EInputDeviceType GetCurrentInputDevice()
proto native bool IsEnabledMouseAndKeyboard()
void Continue()
Определения gameplay.c:774
ScriptInvoker GetOnInputDeviceChanged()
Определения gameplay.c:851
void AbortMission()
Определения gameplay.c:776
Определения PlayerBaseClient.c:2
proto void Remove(func fn)
remove specific call from queue
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
Определения EnWidgets.c:220
void UpdateControlsElementVisibility()
Определения ControlsXboxNew.c:540
override void Update(float timeslice)
Определения LogoutMenu.c:116
void LogoutMenu()
Определения LogoutMenu.c:15
TextWidget m_LogoutTimeText
Определения InviteMenu.c:3
void SetTime(int time)
Определения LogoutMenu.c:130
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Определения ControlsXboxNew.c:71
void UpdateTime()
Определения LogoutMenu.c:151
void SetLogoutTime()
Определения LogoutMenu.c:125
void Cancel()
Определения InviteMenu.c:131
MultilineTextWidget m_DescriptionText
Определения InviteMenu.c:4
ref FullTimeData m_FullTime
Определения InviteMenu.c:9
ButtonWidget m_bCancelConsole
Определения InviteMenu.c:6
void Hide()
Определения LogoutMenu.c:86
ButtonWidget m_bLogoutNow
Определения LogoutMenu.c:6
override Widget Init()
Определения LogoutMenu.c:39
override bool OnClick(Widget w, int x, int y, int button)
Определения LogoutMenu.c:92
ButtonWidget m_bCancel
Определения InviteMenu.c:5
void Show()
Определения LogoutMenu.c:80
int m_iTime
Определения InviteMenu.c:7
void Exit()
Определения LogoutMenu.c:179
void ~LogoutMenu()
Определения LogoutMenu.c:23
void UpdateInfo()
Определения LogoutMenu.c:164
Определения DayZGame.c:64
Определения EnWidgets.c:190
proto native CGame GetGame()
const int ID_EMOTE_SITA
Определения constants.c:373
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.
EInputDeviceType
Определения input.c:3