DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
InGameMenu.c
См. документацию.
1class InGameMenu extends UIScriptedMenu
2{
4
19
21 protected ref TextWidget m_ServerIP;
22 protected ref TextWidget m_ServerPort;
23 protected ref TextWidget m_ServerName;
24
25 protected ref UiHintPanel m_HintPanel;
26
28 {
29 HudShow(true);
30
31 Mission mission = g_Game.GetMission();
32 if (mission)
33 mission.Continue();
34 }
35
36 override Widget Init()
37 {
38 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/day_z_ingamemenu.layout");
39
40 m_ContinueButton = layoutRoot.FindAnyWidget("continuebtn");
41 m_SeparatorPanel = layoutRoot.FindAnyWidget("separator_red");
42 m_ExitButton = layoutRoot.FindAnyWidget("exitbtn");
43 m_RestartButton = layoutRoot.FindAnyWidget("restartbtn");
44 m_RespawnButton = layoutRoot.FindAnyWidget("respawn_button");
45 m_RestartDeadRandomButton = layoutRoot.FindAnyWidget("respawn_button_random");
46 m_RestartDeadCustomButton = layoutRoot.FindAnyWidget("respawn_button_custom");
47 m_OptionsButton = layoutRoot.FindAnyWidget("optionsbtn");
48 m_ModdedWarning = TextWidget.Cast(layoutRoot.FindAnyWidget("ModdedWarning"));
49 m_HintPanel = new UiHintPanel(layoutRoot.FindAnyWidget("hint_frame"));
50 m_ServerInfoPanel = layoutRoot.FindAnyWidget("server_info");
51 m_ServerIP = TextWidget.Cast(layoutRoot.FindAnyWidget("server_ip"));
52 m_ServerPort = TextWidget.Cast(layoutRoot.FindAnyWidget("server_port"));
53 m_ServerName = TextWidget.Cast(layoutRoot.FindAnyWidget("server_name"));
54 m_FavoriteImage = layoutRoot.FindAnyWidget("favorite_image");
55 m_UnfavoriteImage = layoutRoot.FindAnyWidget("unfavorite_image");
56 m_CopyInfoButton = layoutRoot.FindAnyWidget("copy_button");
57 m_FeedbackButton = layoutRoot.FindAnyWidget("feedbackbtn");
58
59 if (GetGame().IsMultiplayer())
60 {
61 ButtonSetText(m_RestartButton, "#main_menu_respawn");
62 }
63 else
64 {
65 ButtonSetText(m_RestartButton, "#main_menu_restart");
66 }
67
68 HudShow(false);
70 SetServerInfoVisibility(SetServerInfo() && g_Game.GetProfileOption(EDayZProfilesOptions.SERVERINFO_DISPLAY));
71 m_ModdedWarning.Show(g_Game.ReportModded());
72
73 Mission mission = g_Game.GetMission();
74 if (mission)
75 mission.Pause();
76
77 return layoutRoot;
78 }
79
80 protected void SetGameVersion()
81 {
82 TextWidget version_widget = TextWidget.Cast(layoutRoot.FindAnyWidget("version"));
83 string version;
84 GetGame().GetVersion(version);
85 version_widget.SetText("#main_menu_version" + " " + version);
86
87 #ifdef PREVIEW_BUILD
88 version_widget.SetText("THIS IS PREVIEW");
89 #endif
90 }
91
92 protected bool SetServerInfo()
93 {
94 if (GetGame().IsMultiplayer())
95 {
96 MenuData menu_data = g_Game.GetMenuData();
98
99 if (info)
100 {
101 m_ServerPort.SetText(info.m_HostPort.ToString());
102 m_ServerIP.SetText(info.m_HostIp);
103 m_ServerName.SetText(info.m_Name);
104 m_UnfavoriteImage.Show(info.m_Favorite);
105 m_FavoriteImage.Show(!info.m_Favorite);
106 m_ServerInfoText = "" + info.GetIpPort();
107
108 return true;
109 }
110 //temporary, incomplete solution, OnlineServices.GetCurrentServerInfo() should be working!
111 else if (menu_data && menu_data.GetLastPlayedCharacter() != GameConstants.DEFAULT_CHARACTER_MENU_ID)
112 {
113 int char_id = menu_data.GetLastPlayedCharacter();
114 int port;
115 string address,name;
116
117 menu_data.GetLastServerAddress(char_id,address);
118 port = menu_data.GetLastServerPort(char_id);
119 menu_data.GetLastServerName(char_id,name);
120 m_ServerPort.SetText(port.ToString());
121 m_ServerIP.SetText(address);
122 m_ServerName.SetText(name);
123 m_ServerInfoText = "" + address + ":" + port;
124
125 return true;
126 }
127 else
128 {
129 g_Game.RefreshCurrentServerInfo();
130 }
131 }
132 return false;
133 }
134
135 protected void HudShow(bool show)
136 {
138 if (mission)
139 {
140 IngameHud hud = IngameHud.Cast(mission.GetHud());
141 if (hud)
142 {
143 hud.ShowHudUI(g_Game.GetProfileOption(EDayZProfilesOptions.HUD) && show);
144 hud.ShowQuickbarUI(g_Game.GetProfileOption(EDayZProfilesOptions.QUICKBAR) && show);
145 }
146 }
147 }
148
149 override bool OnMouseEnter(Widget w, int x, int y)
150 {
152 return true;
153 }
154
155 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
156 {
157 ColorNormal(w);
158 return true;
159 }
160
161 override bool OnClick(Widget w, int x, int y, int button)
162 {
163 super.OnClick(w, x, y, button);
164
165 if (w == m_ContinueButton)
166 {
168 return true;
169 }
170 else if (w == m_RestartButton)
171 {
172 #ifdef DEVELOPER
173 if (GetGame().IsMultiplayer() || (GetGame().GetPlayer() && GetGame().GetPlayer().IsUnconscious()))
175 else
176 {
177 PluginDeveloper plugin = PluginDeveloper.GetInstance();
178 if (plugin)
179 plugin.ToggleMissionLoader();
180 }
181 #else
183 #endif
184 return true;
185 }
186 else if (w == m_RespawnButton)
187 {
189 return true;
190 }
191 else if (w == m_OptionsButton)
192 {
194 return true;
195 }
196 else if (w == m_ExitButton)
197 {
198 OnClick_Exit();
199 return true;
200 }
201 else if (w == m_CopyInfoButton)
202 {
204 }
205 else if (w == m_FeedbackButton)
206 {
207 OpenFeedback();
208 }
209
210 return false;
211 }
212
213 protected void OnClick_Continue()
214 {
216 }
217
218 protected void OnClick_Restart()
219 {
220 if (!GetGame().IsMultiplayer())
221 {
223 }
224 else
225 {
227 }
228 }
229
230 protected void OnClick_Respawn()
231 {
232 Man player = GetGame().GetPlayer();
233
234 if (player && player.IsUnconscious() && !player.IsDamageDestroyed())
235 {
236 GetGame().GetUIManager().ShowDialog("#main_menu_respawn", "#main_menu_respawn_question", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
237 }
238 else
239 {
240 if (GetGame().GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
241 {
242 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
243 }
244 else
245 {
246 GameRespawn(true);
247 }
248 }
249 }
250
251 protected void OnClick_Options()
252 {
253 EnterScriptedMenu(MENU_OPTIONS);
254 }
255
256 protected void OnClick_Exit()
257 {
259 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetMission().CreateLogoutMenu, this);
260 }
261
262 override bool OnModalResult(Widget w, int x, int y, int code, int result)
263 {
264 super.OnModalResult(w, x, y, code, result);
265 if (code == IDC_INT_EXIT && result == DBB_YES)
266 {
267 if (GetGame().IsMultiplayer())
268 {
270 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetMission().CreateLogoutMenu, this);
271 }
272 else
273 {
274 // skip logout screen in singleplayer
276 }
277 g_Game.CancelLoginTimeCountdown();
278 return true;
279 }
280 else if (code == IDC_INT_EXIT && result == DBB_NO)
281 {
282 g_Game.CancelLoginTimeCountdown();
283 }
284 else if (code == IDC_INT_RETRY && result == DBB_YES && GetGame().IsMultiplayer())
285 {
286 if (GetGame().GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
287 {
288 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
289 }
290 else
291 {
292 GameRespawn(true);
293 }
294 return true;
295 }
296
297 return false;
298 }
299
300 override void Update(float timeslice)
301 {
302 super.Update(timeslice);
303
304 UpdateGUI();
305 }
306
307 protected void UpdateGUI()
308 {
309 #ifdef BULDOZER
310 m_RestartButton.Show(false);
311 m_RespawnButton.Show(false);
312 #else
313 Man player = GetGame().GetPlayer();
314 bool playerAlive = player && player.GetPlayerState() == EPlayerStates.ALIVE;
315
316 if (GetGame().IsMultiplayer())
317 {
318 m_RestartButton.Show(playerAlive && player.IsUnconscious() && !CfgGameplayHandler.GetDisableRespawnInUnconsciousness());
319 m_RespawnButton.Show(!playerAlive);
320 }
321 else
322 {
323 m_RestartButton.Show(true);
324 m_RespawnButton.Show(false);
325 m_SeparatorPanel.Show(playerAlive);
326 }
327
328 m_ContinueButton.Show(playerAlive);
329 #endif
330 }
331
332 void MenuRequestRespawn(UIScriptedMenu menu, bool random)
333 {
334 if (RespawnDialogue.Cast(menu))
335 GameRespawn(random);
336 }
337
338 protected void GameRespawn(bool random)
339 {
342
343 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
344 if (player)
345 {
346 player.SimulateDeath(true);
347 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(player.ShowDeadScreen, true, 0);
348 }
349
350 MissionGameplay missionGP = MissionGameplay.Cast(GetGame().GetMission());
351 missionGP.DestroyAllMenus();
352 missionGP.SetPlayerRespawning(true);
353 missionGP.Continue();
354
355 Close();
356 }
357
358 protected void ColorHighlight(Widget w)
359 {
360 if (!w)
361 return;
362
363 ButtonSetColor(w, ARGB(255, 0, 0, 0));
364 ButtonSetTextColor(w, ARGB(255, 255, 0, 0));
365 }
366
367 protected void ColorNormal(Widget w)
368 {
369 if (!w)
370 return;
371
372 ButtonSetColor(w, ARGB(0, 0, 0, 0));
373 ButtonSetTextColor(w, ARGB(255, 255, 255, 255));
374 }
375
376 protected void ColorDisable(Widget w)
377 {
378 if (!w)
379 return;
380
381 ButtonSetColor(w, ARGB(0, 0, 0, 0));
383 }
384
385 protected void ButtonSetText(Widget w, string text)
386 {
387 if (!w)
388 return;
389
390 TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
391 if (label)
392 label.SetText(text);
393
394 }
395
396 protected void ButtonSetColor(Widget w, int color)
397 {
398 Widget panel = w.FindWidget(w.GetName() + "_panel");
399 if (panel)
400 panel.SetColor(color);
401 }
402
403 protected void ButtonSetTextColor(Widget w, int color)
404 {
405 TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
406 if (label)
407 label.SetColor(color);
408 }
409
411 {
412 m_ServerInfoPanel.Show(show);
413 }
414
415 protected void OpenFeedback()
416 {
417 GetGame().OpenURL("https://feedback.bistudio.com/project/view/2/");
418 }
419
422}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:3868
Mission mission
Определения DisplayStatus.c:28
EDayZProfilesOptions
Определения EDayZProfilesOptions.c:2
EPlayerStates
Определения EPlayerStates.c:2
Icon x
Icon y
void Close()
PlayerBase GetPlayer()
Определения ModifierBase.c:51
void UiHintPanel(Widget parent_widget)
Определения UiHintPanel.c:324
proto native UIManager GetUIManager()
proto native void CopyToClipboard(string text)
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native void LogoutRequestTime()
Logout methods.
proto native DayZPlayer GetPlayer()
proto native WorkspaceWidget GetWorkspace()
proto native void RespawnPlayer()
proto void GetVersion(out string version)
proto native void OpenURL(string url)
proto native Mission GetMission()
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Определения Game.c:1493
static bool GetDisableRespawnInUnconsciousness()
Определения CfgGameplayHandler.c:178
static int COLOR_DISABLED_TEXT
Определения ColorManager.c:11
Определения ColorManager.c:2
Определения constants.c:659
string GetIpPort()
Определения BiosLobbyService.c:195
string m_Name
Определения BiosLobbyService.c:147
bool m_Favorite
Определения BiosLobbyService.c:193
int m_HostPort
Определения BiosLobbyService.c:150
string m_HostIp
Определения BiosLobbyService.c:149
GetServersResultRow the output structure of the GetServers operation that represents one game server.
Определения BiosLobbyService.c:144
proto native int GetLastPlayedCharacter()
proto native int GetLastServerPort(int index)
proto void GetLastServerAddress(int index, out string address)
proto void GetLastServerName(int index, out string address)
Определения gameplay.c:918
void SetRandomCharacterForced(bool state)
Определения gameplay.c:1115
void AbortMission()
Определения gameplay.c:776
Mission class.
Определения gameplay.c:687
static void GetCurrentServerInfo(string ip, int port)
Определения OnlineServices.c:139
Определения OnlineServices.c:2
Определения PlayerBaseClient.c:2
proto void Call(func fn, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
Определения EnWidgets.c:220
proto native void ShowDialog(string caption, string text, int id, int butts, int def, int type, UIScriptedMenu handler)
Shows message dialog.
void MenuRequestRespawn(UIScriptedMenu menu, bool random)
Определения InGameMenu.c:332
override bool OnMouseEnter(Widget w, int x, int y)
Определения InGameMenu.c:149
Widget m_ExitButton
Определения InGameMenu.c:7
ref TextWidget m_ServerIP
Определения InGameMenu.c:21
void ToggleFavoriteServer()
DEPRECATED.
void ColorDisable(Widget w)
Определения InGameMenu.c:376
void OnClick_Restart()
Определения InGameMenu.c:218
bool SetServerInfo()
Определения InGameMenu.c:92
void SetServerInfoVisibility(bool show)
Определения InGameMenu.c:410
override void Update(float timeslice)
Определения InGameMenu.c:300
Widget m_RespawnButton
Определения InGameMenu.c:9
Widget m_ContinueButton
Определения InGameMenu.c:5
void ColorHighlight(Widget w)
Определения ControlsXboxNew.c:446
Widget m_FavoriteImage
Определения InGameMenu.c:15
Widget m_SeparatorPanel
Определения InGameMenu.c:6
void OnClick_Exit()
Определения InGameMenu.c:256
Widget m_RestartButton
Определения InGameMenu.c:8
void ButtonSetText(Widget w, string text)
Определения ControlsXboxNew.c:475
ref TextWidget m_ServerPort
Определения InGameMenu.c:22
Widget m_RestartDeadCustomButton
Определения InGameMenu.c:11
void SetGameVersion()
Определения InGameMenu.c:80
ref TextWidget m_ModdedWarning
Определения InGameMenu.c:20
Widget m_OptionsButton
Определения InGameMenu.c:12
ref TextWidget m_ServerName
Определения InGameMenu.c:23
void ~InGameMenu()
Определения InGameMenu.c:27
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения InGameMenu.c:155
void GameRespawn(bool random)
Определения InGameMenu.c:338
Widget m_ServerInfoPanel
Определения InGameMenu.c:13
void UpdateGUI()
Определения InGameMenu.c:307
Widget m_FeedbackButton
Определения InGameMenu.c:18
void OnClick_Continue()
Определения InGameMenu.c:213
ref UiHintPanelLoading m_HintPanel
Определения DayZGame.c:65
string m_ServerInfoText
Определения InGameMenu.c:3
Widget m_UnfavoriteImage
Определения InGameMenu.c:16
Widget m_FavoriteButton
Определения InGameMenu.c:14
void RespawnDialogue()
void ButtonSetTextColor(Widget w, int color)
Определения ControlsXboxNew.c:502
override Widget Init()
Определения InGameMenu.c:36
void OpenFeedback()
Определения InGameMenu.c:415
override bool OnClick(Widget w, int x, int y, int button)
Определения InGameMenu.c:161
void ButtonSetColor(Widget w, int color)
Определения ControlsXboxNew.c:489
void HudShow(bool show)
Определения InGameMenu.c:135
override bool OnModalResult(Widget w, int x, int y, int code, int result)
Определения InGameMenu.c:262
void OnClick_Respawn()
Определения InGameMenu.c:230
void ColorNormal(Widget w)
Определения ControlsXboxNew.c:463
Widget m_RestartDeadRandomButton
Определения InGameMenu.c:10
Widget m_CopyInfoButton
Определения InGameMenu.c:17
void OnClick_Options()
Определения InGameMenu.c:251
Определения DayZGame.c:64
Определения EnWidgets.c:190
proto native CGame GetGame()
const int DEFAULT_CHARACTER_MENU_ID
Определения constants.c:982
const int RESPAWN_MODE_CUSTOM
Определения constants.c:1045
const int MENU_RESPAWN_DIALOGUE
Определения constants.c:209
const int MENU_OPTIONS
Определения constants.c:183
void Continue()
Timer continue when it was paused.
Определения tools.c:247
const int CALL_CATEGORY_GUI
Определения tools.c:9
const int IDC_INT_EXIT
Определения constants.c:160
const int IDC_INT_RETRY
ingame menu
Определения constants.c:158
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.
int ARGB(int a, int r, int g, int b)
Определения proto.c:322