Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
ingamemenuxbox.c
Go to the documentation of this file.
1 class InGameMenuXbox extends UIScriptedMenu
2 {
3  // Widgets texts id
4  protected string m_MuteButtonTextID;
5  protected string m_UnmuteButtonTextID;
6  protected string m_BackButtonTextID;
7  protected string m_SelectButtonTextID;
8  protected string m_OpenGameCardButtonTextID;
9  protected string m_CurrentMuteButtonText;
10 
11  protected bool m_SelectAvailable;
12  protected bool m_MuteAvailable;
13  protected bool m_BackAvailable;
14  protected bool m_GamercardAvailable;
15 
16  protected bool m_PlayerAlive;
17 
18  protected ref PlayerListScriptedWidget m_ServerInfoPanel;
19 
20  protected Widget m_OnlineMenu;
21 
22  protected ButtonWidget m_ContinueButton;
23  protected ButtonWidget m_ExitButton;
24  protected ButtonWidget m_RestartDeadButton;
25  protected ButtonWidget m_RestartButton;
26  protected ButtonWidget m_OptionsButton;
27  protected ButtonWidget m_ControlsButton;
28  protected ButtonWidget m_OnlineButton;
29  protected ButtonWidget m_TutorialsButton;
30 
31  protected TextWidget m_Version;
32 
33  const int BUTTON_XBOX_CONTROLS = 201;
34 
35  void InGameMenuXbox()
36  {
37  GetGame().GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
38  GetGame().GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
39  }
40 
41  void ~InGameMenuXbox()
42  {
43  ClientData.SyncEvent_OnPlayerListUpdate.Remove(SyncEvent_OnRecievedPlayerList);
44  OnlineServices.m_PermissionsAsyncInvoker.Remove(OnPermissionsUpdate);
45 
46  Mission mission = GetGame().GetMission();
47  if (mission)
48  {
49  IngameHud hud = IngameHud.Cast(mission.GetHud());
50  if (hud)
51  {
52  hud.ShowHudUI(true);
53  hud.ShowQuickbarUI(true);
54  }
55 
56  mission.Continue();
57  }
58 
59  PPERequesterBank.GetRequester(PPERequester_MenuEffects).Stop();
60  }
61 
62  protected void OnInputPresetChanged()
63  {
64  #ifdef PLATFORM_CONSOLE
66  #endif
67  }
68 
69  protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
70  {
72  }
73 
74  override Widget Init()
75  {
76  layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/day_z_ingamemenu_xbox.layout");
77 
78  m_OnlineMenu = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/ingamemenu_xbox/online_info_menu.layout", layoutRoot);
79  m_OnlineMenu.Show(false);
80 
81  m_ContinueButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("continuebtn"));
82  m_RestartDeadButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("restartbtn_dead"));
83  m_ExitButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("exitbtn"));
84  m_RestartButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("restartbtn"));
85  m_OptionsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("optionsbtn"));
86  m_ControlsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("controlsbtn"));
87  m_OnlineButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("onlinebtn"));
88  m_TutorialsButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("tutorialsbtn"));
89  m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget("version"));
90 
91  m_SelectAvailable = true;
92  m_MuteAvailable = false;
93  m_GamercardAvailable = false;
94  m_BackAvailable = true;
95 
96  Man player = GetGame().GetPlayer();
97  if (player)
98  {
99  int life_state = player.GetPlayerState();
100 
101  if (life_state == EPlayerStates.ALIVE)
102  {
103  m_PlayerAlive = true;
104  }
105  }
106 
107  UpdateMenuFocus();
108 
109  string version;
110  GetGame().GetVersion(version);
111  #ifdef PLATFORM_CONSOLE
112  version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
113  #else
114  version = "#main_menu_version" + " " + version;
115  #endif
116  m_Version.SetText(version);
117 
118  if (GetGame().IsMultiplayer())
119  {
120  m_OnlineButton.Show(true);
121 
122  TextWidget w_text = TextWidget.Cast(m_OnlineMenu.FindAnyWidget("OnlineTextWidget"));
123  w_text.SetText(g_Game.GetHostName());
124 
125  m_ServerInfoPanel = new PlayerListScriptedWidget(m_OnlineMenu.FindAnyWidget("ServerInfoPanel"));
126 
127  OnlineServices.m_PermissionsAsyncInvoker.Insert(OnPermissionsUpdate);
128  ClientData.SyncEvent_OnPlayerListUpdate.Insert(SyncEvent_OnRecievedPlayerList);
129 
130  m_ServerInfoPanel.Reload(ClientData.m_PlayerList);
131  m_ServerInfoPanel.ReloadLocal(OnlineServices.GetMuteList());
132 
133  string uid = m_ServerInfoPanel.FindPlayerByWidget(GetFocus());
134  if (uid != "")
135  {
136  if (IsLocalPlayer(uid) || m_ServerInfoPanel.IsEmpty())
137  {
138  m_MuteAvailable = false;
139  m_GamercardAvailable = false;
140  }
141  else
142  {
143  m_MuteAvailable = !GetGame().GetWorld().IsDisabledReceivingVoN();
144  #ifndef PLATFORM_PS4
145  m_GamercardAvailable = true;
146  #endif
147  SetMuteButtonText(OnlineServices.IsPlayerMuted(uid));
148  }
149 
150  if (m_ServerInfoPanel.IsGloballyMuted(uid))
151  {
152  m_MuteAvailable = false;
153  }
154  }
155  }
156  else
157  {
158  layoutRoot.FindAnyWidget("onlinebtn").Show(false);
159  layoutRoot.FindAnyWidget("invitebtn").Show(false);
160  }
161 
162  //RESPAWN & RESTART
163  ButtonWidget restart_btn = ButtonWidget.Cast(layoutRoot.FindAnyWidgetById(IDC_INT_RETRY));
164  if (GetGame().IsMultiplayer())
165  {
166  restart_btn.SetText("#main_menu_respawn");
167  }
168  else
169  {
170  restart_btn.SetText("#main_menu_restart");
171  }
172 
173  if (GetGame().IsMultiplayer() && !(GetGame().CanRespawnPlayer() || (player && player.IsUnconscious())))
174  {
175  restart_btn.Enable(false);
176  restart_btn.Show(false);
177  }
178  //
179 
180  #ifdef BULDOZER
181  delete restart_btn;
182  #endif
183 
184  Mission mission = GetGame().GetMission();
185  if (mission)
186  {
187  IngameHud hud = IngameHud.Cast(mission.GetHud());
188  if (hud)
189  {
190  hud.ShowHudUI(false);
191  hud.ShowQuickbarUI(false);
192  }
193 
194  mission.Pause();
195  }
196 
197  PPERequester_MenuEffects requester;
198  Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
199  requester.SetVignetteIntensity(0.6);
200 
202  LoadTextStrings();
204 
205  OnInputDeviceChanged(GetGame().GetInput().GetCurrentInputDevice());
206 
207  return layoutRoot;
208  }
209 
210  override bool OnClick(Widget w, int x, int y, int button)
211  {
212  super.OnClick(w, x, y, button);
213 
214  switch (w.GetUserID())
215  {
216  case IDC_MAIN_CONTINUE:
217  {
218  GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetMission().Continue);
219  return true;
220  }
221  case IDC_MAIN_OPTIONS:
222  {
223  EnterScriptedMenu(MENU_OPTIONS);
224  return true;
225  }
226  case BUTTON_XBOX_CONTROLS:
227  {
228  EnterScriptedMenu(MENU_XBOX_CONTROLS);
229  return true;
230  }
231  case IDC_MAIN_QUIT:
232  {
233  GetGame().GetUIManager().ShowDialog("#main_menu_exit", "#main_menu_exit_desc", IDC_INT_EXIT, DBT_YESNO, DBB_YES, DMT_QUESTION, NULL);
234  return true;
235  }
236  case IDC_INT_RETRY:
237  {
238  if (!GetGame().IsMultiplayer())
239  {
240  GetGame().GetUIManager().ShowDialog("#main_menu_restart", "Are you sure you want to restart?", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
241  }
242  else
243  {
244  GetGame().GetUIManager().ShowDialog("#main_menu_respawn", "#main_menu_respawn_question", IDC_INT_RETRY, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
245  }
246  return true;
247  }
248  case IDC_MAIN_ONLINE:
249  {
250  m_OnlineMenu.Show(true);
251  m_SelectAvailable = false;
252 
254  m_ServerInfoPanel.FocusFirst();
255  return true;
256  }
257  case 117:
258  {
259  EnterScriptedMenu(MENU_TUTORIAL);
260  return true;
261  }
262  case IDC_MULTI_INVITE:
263  {
264  OnlineServices.ShowInviteScreen();
265  return true;
266  }
267  }
268 
269  if (w == layoutRoot.FindAnyWidget("backbtn"))
270  {
271  CloseOnline();
272  }
273  else if (w == m_RestartDeadButton)
274  {
275  if (GetGame().GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
276  {
277  GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
278  }
279  else
280  {
281  GameRetry(true);
282  }
283  return true;
284  }
285 
286  return false;
287  }
288 
289  override bool OnModalResult(Widget w, int x, int y, int code, int result)
290  {
291  super.OnModalResult(w, x, y, code, result);
292 
293  if (code == IDC_INT_EXIT && result == DBB_YES)
294  {
295  if (GetGame().IsMultiplayer())
296  {
297  GetGame().LogoutRequestTime();
298  GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetMission().CreateLogoutMenu, this);
299  }
300  else
301  {
302  // skip logout screen in singleplayer
303  GetGame().GetMission().AbortMission();
304  }
305  g_Game.CancelLoginTimeCountdown();
306 
307  return true;
308 
309  }
310  else if (code == IDC_INT_EXIT && result == DBB_NO)
311  {
312  g_Game.CancelLoginTimeCountdown();
313  }
314  else if (code == IDC_INT_RETRY)
315  {
316  if (result == DBB_YES)
317  {
318  if (GetGame().GetMission().GetRespawnModeClient() == GameConstants.RESPAWN_MODE_CUSTOM)
319  {
320  GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_RESPAWN_DIALOGUE,this);
321  }
322  else
323  {
324  GameRetry(true);
325  return true;
326  }
327  }
328  else
329  {
330  UpdateMenuFocus();
331  }
332  }
333 
334  return false;
335  }
336 
337  void GameRetry(bool random)
338  {
339  if (GetGame().IsMultiplayer())
340  {
341  //GetGame().GetUIManager().CloseAll();
342  GetGame().GetMenuDefaultCharacterData(false).SetRandomCharacterForced(random);
343  GetGame().RespawnPlayer();
344 
345  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
346  if (player)
347  {
348  player.SimulateDeath(true);
349  GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(player.ShowDeadScreen, true, 0);
350  }
351 
352  MissionGameplay missionGP = MissionGameplay.Cast(GetGame().GetMission());
353  missionGP.DestroyAllMenus();
354  missionGP.SetPlayerRespawning(true);
355  missionGP.Continue();
356 
357  Close();
358  }
359  else
360  GetGame().RestartMission();
361  }
362 
363  void MenuRequestRespawn(UIScriptedMenu menu, bool random)
364  {
365  if (RespawnDialogue.Cast(menu))
366  GameRetry(random);
367  }
368 
369  bool IsLocalPlayer(string uid)
370  {
371  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
372  string local_uid;
373  if (GetGame().GetUserManager())
374  local_uid = GetGame().GetUserManager().GetSelectedUser().GetUid();
375  return (uid == local_uid);
376  }
377 
378  SyncPlayerList CreateFakePlayerList(int player_count)
379  {
380  SyncPlayerList player_list = new SyncPlayerList;
381  player_list.m_PlayerList = new array<ref SyncPlayer>;
382  for (int i = 0; i < player_count; i++)
383  {
384  SyncPlayer sync_player = new SyncPlayer;
385  sync_player.m_UID = "uid" + i;
386  sync_player.m_PlayerName = "Player " + i;
387  player_list.m_PlayerList.Insert(sync_player);
388  }
389  return player_list;
390  }
391 
392  override void Update(float timeslice)
393  {
394  UpdateGUI();
395 
396  if (GetGame().IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible())
397  {
398  PlayerListEntryScriptedWidget selected;
399  if (m_ServerInfoPanel)
400  selected = m_ServerInfoPanel.GetSelectedPlayer();
401  if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
402  {
403  if (selected)
404  m_ServerInfoPanel.ToggleMute(selected.GetUID());
405  Refresh();
406  }
407 
408  #ifndef PLATFORM_PS4
409  if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
410  {
411  if (selected)
412  OnlineServices.ShowUserProfile(selected.GetUID());
413  }
414  #endif
415  }
416  }
417 
418  bool ShouldRestartBeVisible(Man player)
419  {
420  return player && player.IsUnconscious() && !CfgGameplayHandler.GetDisableRespawnInUnconsciousness();
421  }
422 
423 
424  void UpdateGUI()
425  {
426  Man player = GetGame().GetPlayer();
427  if (player)
428  {
429  int life_state = player.GetPlayerState();
430  m_PlayerAlive = life_state == EPlayerStates.ALIVE;
431  }
432 
433  if (m_PlayerAlive)
434  {
435  m_RestartButton.Show(ShouldRestartBeVisible(player));
436  }
437  else
438  {
439  m_RestartButton.Show(false);
440  }
441 
442  m_ContinueButton.Show(m_PlayerAlive);
443  m_RestartDeadButton.Show(!m_PlayerAlive);
444  }
445 
446  bool IsOnlineOpen()
447  {
448  return m_OnlineMenu.IsVisible();
449  }
450 
451  void CloseOnline()
452  {
453  m_OnlineMenu.Show(false);
454  m_SelectAvailable = true;
455  m_MuteAvailable = false;
456  m_GamercardAvailable = false;
458 
459  SetFocus(m_OnlineButton);
460  }
461 
462  void SelectServer()
463  {
464  if (m_ServerInfoPanel)
465  {
466  m_ServerInfoPanel.FocusFirst();
467 
468  Refresh();
469  }
470  }
471 
472  override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
473  {
474  return false;
475  }
476 
477  void SyncEvent_OnRecievedPlayerList(SyncPlayerList player_list)
478  {
479  m_ServerInfoPanel.Reload(player_list);
480 
481  Refresh();
482  }
483 
484  void OnPermissionsUpdate(BiosPrivacyUidResultArray result_list)
485  {
486  m_ServerInfoPanel.Reload(result_list);
487 
488  Refresh();
489  }
490 
491  override void OnShow()
492  {
493  super.OnShow();
494  Man player = GetGame().GetPlayer();
495  if (player)
496  {
497  int life_state = player.GetPlayerState();
498 
499  if (life_state == EPlayerStates.ALIVE)
500  {
501  m_PlayerAlive = true;
502  }
503  }
504 
505  if (m_PlayerAlive)
506  {
507  if (player)
508  m_RestartButton.Show(player.IsUnconscious());
509  }
510  else
511  {
512  m_RestartButton.Show(false);
513  }
514  m_ContinueButton.Show(m_PlayerAlive);
515  m_RestartDeadButton.Show(!m_PlayerAlive);
516 
517  UpdateMenuFocus();
518 
519  #ifdef PLATFORM_CONSOLE
520  bool mk = GetGame().GetInput().IsEnabledMouseAndKeyboard();
521  bool mk_server = GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
522  TextWidget warning = TextWidget.Cast(layoutRoot.FindAnyWidget("MouseAndKeyboardWarning"));
523  if (mk)
524  {
525  if (mk_server)
526  {
527  warning.SetText("#str_mouse_and_keyboard_server_warning");
528  }
529  else
530  {
531  warning.SetText("#str_controller_server_warning");
532  }
533  }
534 
535  warning.Show(mk);
536  #endif
538  }
539 
540  override bool OnMouseEnter(Widget w, int x, int y)
541  {
542  if (IsFocusable(w))
543  {
544  ColorHighlight(w);
545  return true;
546  }
547  return false;
548  }
549 
550  override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
551  {
552  if (IsFocusable(w))
553  {
554  ColorNormal(w);
555  return true;
556  }
557  return false;
558  }
559 
560  override bool OnFocus(Widget w, int x, int y)
561  {
562  if (IsFocusable(w))
563  {
564  ColorHighlight(w);
565  return true;
566  }
567  return false;
568  }
569 
570  override bool OnFocusLost(Widget w, int x, int y)
571  {
572  if (IsFocusable(w))
573  {
574  ColorNormal(w);
575  return true;
576  }
577  return false;
578  }
579 
580  bool IsFocusable(Widget w)
581  {
582  if (w)
583  {
584  if (w == m_ContinueButton || w == m_ExitButton || w == m_RestartButton || w == m_OptionsButton || w == m_ControlsButton || w == m_OnlineButton || w == m_TutorialsButton);
585  return true;
586  }
587  return false;
588  }
589 
590  override void Refresh()
591  {
592  string version;
593  GetGame().GetVersion(version);
594  #ifdef PLATFORM_CONSOLE
595  version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
596  #else
597  version = "#main_menu_version" + " " + version;
598  #endif
599  m_Version.SetText(version);
600 
601  m_MuteAvailable = false;
602  m_GamercardAvailable = false;
603 
604  if (GetGame().IsMultiplayer() && layoutRoot.FindAnyWidget("OnlineInfo").IsVisible() && m_ServerInfoPanel)
605  {
606  PlayerListEntryScriptedWidget selected = m_ServerInfoPanel.GetSelectedPlayer();
607  if (selected && !selected.IsLocalPlayer())
608  {
609  m_MuteAvailable = !GetGame().GetWorld().IsDisabledReceivingVoN() && !selected.IsGloballyMuted();
610  #ifndef PLATFORM_PS4
611  m_GamercardAvailable = true;
612  #endif
613  SetMuteButtonText(selected.IsMuted());
614  }
615  }
616 
618  }
619 
620  void ColorDisable(Widget w)
621  {
622  #ifdef PLATFORM_WINDOWS
623  SetFocus(null);
624  #endif
625 
626  ButtonWidget button = ButtonWidget.Cast(w);
627  if (button && button != m_ContinueButton)
628  {
629  button.SetTextColor(ARGB(255, 255, 255, 255));
630  }
631  ButtonSetColor(w, ARGB(0, 0, 0, 0));
632  ButtonSetTextColor(w, ARGB(60, 0, 0, 0));
633  }
634 
635  void ColorHighlight(Widget w)
636  {
637  if (!w)
638  return;
639 
640  int color_pnl = ARGB(255, 0, 0, 0);
641  int color_lbl = ARGB(255, 255, 0, 0);
642 
643  #ifdef PLATFORM_CONSOLE
644  color_pnl = ARGB(255, 200, 0, 0);
645  color_lbl = ARGB(255, 255, 255, 255);
646  #endif
647 
648  ButtonSetColor(w, color_pnl);
649  ButtonSetTextColor(w, color_lbl);
650  }
651 
652  void ColorNormal(Widget w)
653  {
654  if (!w)
655  return;
656 
657  int color_pnl = ARGB(0, 0, 0, 0);
658  int color_lbl = ARGB(255, 255, 255, 255);
659 
660  ButtonSetColor(w, color_pnl);
661  ButtonSetTextColor(w, color_lbl);
662  }
663 
664  void ButtonSetText(Widget w, string text)
665  {
666  if (!w)
667  return;
668 
669  TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
670 
671  if (label)
672  {
673  label.SetText(text);
674  }
675 
676  }
677 
678  void ButtonSetColor(Widget w, int color)
679  {
680  if (!w)
681  return;
682 
683  Widget panel = w.FindWidget(w.GetName() + "_panel");
684 
685  if (panel)
686  {
687  panel.SetColor(color);
688  }
689  }
690 
691  void ButtonSetTextColor(Widget w, int color)
692  {
693  if (!w)
694  return;
695 
696  TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
697  TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
698  TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
699 
700  if (label)
701  {
702  label.SetColor(color);
703  }
704 
705  if (text)
706  {
707  text.SetColor(color);
708  }
709 
710  if (text2)
711  {
712  text2.SetColor(color);
713  }
714  }
715 
717  protected void SetMuteButtonText(bool isMuted)
718  {
719  if (isMuted)
720  {
721  m_CurrentMuteButtonText = m_UnmuteButtonTextID;
722  }
723  else
724  {
725  m_CurrentMuteButtonText = m_MuteButtonTextID;
726  }
727  }
728 
730  protected void LoadTextStrings()
731  {
732  #ifdef PLATFORM_PS4
733  m_MuteButtonTextID = "#ps4_ingame_menu_mute";
734  m_UnmuteButtonTextID = "#ps4_ingame_menu_unmute";
735  m_BackButtonTextID = "#ps4_ingame_menu_back";
736  m_SelectButtonTextID = "#ps4_ingame_menu_select";
737  m_OpenGameCardButtonTextID = "#ps4_ingame_menu_opencard";
738  #else
739  m_MuteButtonTextID = "#xbox_ingame_menu_mute";
740  m_UnmuteButtonTextID = "#xbox_ingame_menu_unmute";
741  m_BackButtonTextID = "#STR_rootFrame_toolbar_bg_ConsoleToolbar_Back_BackText0";
742  m_SelectButtonTextID = "#layout_xbox_ingame_menu_select";
743  m_OpenGameCardButtonTextID = "#layout_xbox_ingame_menu_gamecard";
744  #endif
745  }
746 
748  protected void LoadFooterButtonTexts()
749  {
750  TextWidget uiGamecardText = TextWidget.Cast(layoutRoot.FindAnyWidget("GamercardText"));
751  TextWidget uiBackText = TextWidget.Cast(layoutRoot.FindAnyWidget("BackText"));
752  TextWidget uiSelectText = TextWidget.Cast(layoutRoot.FindAnyWidget("SelectText"));
753 
754  if (uiGamecardText)
755  {
756  uiGamecardText.SetText(m_OpenGameCardButtonTextID);
757  }
758  if (uiBackText)
759  {
760  uiBackText.SetText(m_BackButtonTextID);
761  }
762  if (uiSelectText)
763  {
764  uiSelectText.SetText(m_SelectButtonTextID);
765  }
766  }
767 
768  void UpdateMenuFocus()
769  {
770  Man player = GetGame().GetPlayer();
771  if (m_PlayerAlive)
772  {
773  if (ShouldRestartBeVisible(player))
774  SetFocus(m_RestartButton);
775  else
776  SetFocus(m_ContinueButton);
777  }
778  else
779  {
780  SetFocus(m_RestartDeadButton);
781  }
782  }
783 
784  protected void UpdateControlsElements()
785  {
786  bool toolbarShow = false;
787  #ifdef PLATFORM_CONSOLE
788  toolbarShow = !GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
789  #endif
790 
791  if (toolbarShow)
792  {
793  RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
794  string text = "";
795  if (m_SelectAvailable)
796  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", m_SelectButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
797  if (m_MuteAvailable)
798  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", m_CurrentMuteButtonText, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
799  if (m_BackAvailable)
800  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", m_BackButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
801  if (m_GamercardAvailable)
802  text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", m_OpenGameCardButtonTextID, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
803 
804  toolbar_text.SetText(text);
805  }
806 
807  RichTextWidget toolbar_b2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon0"));
808  toolbar_b2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER));
809 
810  bool onlineOpen = IsOnlineOpen();
811  layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
812  layoutRoot.FindAnyWidget("play_panel_root").Show(!onlineOpen);
813  layoutRoot.FindAnyWidget("play_panel_root2").Show(onlineOpen && !toolbarShow);
814  layoutRoot.FindAnyWidget("dayz_logo").Show(!onlineOpen);
815  }
816 }
GetGame
proto native CGame GetGame()
UIScriptedMenu
Definition: dayzgame.c:63
Continue
void Continue()
Timer continue when it was paused.
Definition: tools.c:247
mission
Mission mission
Definition: displaystatus.c:28
InputUtils
Definition: inpututils.c:1
Mission
Mission class.
Definition: gameplay.c:670
IDC_MAIN_OPTIONS
const int IDC_MAIN_OPTIONS
Definition: constants.c:134
UpdateControlsElements
protected void UpdateControlsElements()
Definition: itemdropwarningmenu.c:92
Close
void Close()
GetFocus
proto native Widget GetFocus()
y
Icon y
IDC_MAIN_CONTINUE
const int IDC_MAIN_CONTINUE
Definition: constants.c:137
ClientData
Definition: clientdata.c:1
IDC_INT_RETRY
const int IDC_INT_RETRY
ingame menu
Definition: constants.c:148
m_BackButtonTextID
class JsonControlMappingInfo m_BackButtonTextID
Refresh
void Refresh()
Definition: sizetochild.c:108
ColorDisable
void ColorDisable(Widget w)
Definition: serverbrowsertab.c:720
OnInputDeviceChanged
protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition: inventory.c:167
CALL_CATEGORY_GUI
const int CALL_CATEGORY_GUI
Definition: tools.c:9
EInputDeviceType
EInputDeviceType
Definition: input.c:2
OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition: uihintpanel.c:276
RichTextWidget
Definition: gameplay.c:315
IDC_MAIN_QUIT
const int IDC_MAIN_QUIT
Definition: constants.c:136
PlayerBase
Definition: playerbaseclient.c:1
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
SelectServer
void SelectServer(ServerBrowserEntry server)
Definition: serverbrowsertab.c:469
TextWidget
Definition: enwidgets.c:219
ColorNormal
void ColorNormal(Widget w)
Definition: serverbrowsertab.c:668
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
ColorHighlight
void ColorHighlight(Widget w)
Definition: serverbrowsertab.c:619
LoadFooterButtonTexts
protected void LoadFooterButtonTexts()
Initial texts load for the footer buttons.
Definition: controlsxbox.c:404
SyncPlayerList
Definition: syncplayerlist.c:1
EPlayerStates
EPlayerStates
Definition: eplayerstates.c:1
OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition: serverbrowsertab.c:235
MENU_XBOX_CONTROLS
const int MENU_XBOX_CONTROLS
Definition: constants.c:187
MENU_OPTIONS
const int MENU_OPTIONS
Definition: constants.c:173
CfgGameplayHandler
Definition: cfggameplayhandler.c:1
LoadTextStrings
protected void LoadTextStrings()
Set correct bottom button texts based on platform (ps4 vs xbox texts)
Definition: controlsxbox.c:414
array< ref SyncPlayer >
Update
proto native volatile void Update()
Definition: playersoundmanager.c:125
MENU_RESPAWN_DIALOGUE
const int MENU_RESPAWN_DIALOGUE
Definition: constants.c:199
SetFocus
proto native void SetFocus(Widget w)
IDC_MULTI_INVITE
const int IDC_MULTI_INVITE
Definition: constants.c:142
x
Icon x
GetPlayer
protected void GetPlayer()
Definition: crosshairselector.c:127
GameConstants
Definition: constants.c:612
SyncPlayer
Definition: syncplayer.c:1
OnInputPresetChanged
protected void OnInputPresetChanged()
Definition: inventory.c:160
OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition: serverbrowsertab.c:217
OnShow
override void OnShow()
Definition: controlsxbox.c:349
Widget
Definition: enwidgets.c:189
IDC_INT_EXIT
const int IDC_INT_EXIT
Definition: constants.c:150
GetUApi
proto native UAInputAPI GetUApi()
IDC_MAIN_ONLINE
const int IDC_MAIN_ONLINE
Definition: constants.c:140
GetInput
ActionInput GetInput()
Definition: actionbase.c:1066
OnClick
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition: dayzgame.c:146
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition: uihintpanel.c:267
OnlineServices
Definition: onlineservices.c:1
ARGB
int ARGB(int a, int r, int g, int b)
Definition: proto.c:322
IsFocusable
bool IsFocusable(Widget w)
Definition: serverbrowsertab.c:284
MENU_TUTORIAL
const int MENU_TUTORIAL
Definition: constants.c:194