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