Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_GameOverScreenInput.c
Go to the documentation of this file.
2 {
3  protected InputManager m_InputManager = GetGame().GetInputManager();;
4  protected Widget m_BackButton;
5  protected Widget m_ChatButton;
6  protected SCR_GameOverScreenUIComponent m_GameOverScreenUIComponent;
7  protected SCR_ChatPanel m_ChatPanel;
8 
9  override void OnMenuOpen()
10  {
11  Widget widgetRoot = GetRootWidget();
12 
13  //~ Find Back button
14  m_BackButton = widgetRoot.FindAnyWidget("Back");
15  SCR_InputButtonComponent comp = SCR_InputButtonComponent.GetInputButtonComponent("Back", widgetRoot);
16  if (comp)
17  comp.m_OnActivated.Insert(ReturnToMainMenu);
18 
19  //~ Find Chat button
20  m_ChatButton = widgetRoot.FindAnyWidget("ChatButton");
21  comp = SCR_InputButtonComponent.GetInputButtonComponent("ChatButton", widgetRoot);
22  if (comp)
23  comp.m_OnActivated.Insert(OnChatToggle);
24 
25  //~ Find chat
26  Widget wChatPanel = GetRootWidget().FindAnyWidget("ChatPanel");
27  if (wChatPanel)
28  m_ChatPanel = SCR_ChatPanel.Cast(wChatPanel.FindHandler(SCR_ChatPanel));
29 
30  //~ Find GameOverScreen UI
31  m_GameOverScreenUIComponent = SCR_GameOverScreenUIComponent.Cast(widgetRoot.FindHandler(SCR_GameOverScreenUIComponent));
32 
33  // Hide unnecessary HUD elements. This should hide chat as well.
34  SCR_HUDManagerComponent hudManager = GetGame().GetHUDManager();
35  if (hudManager)
36  hudManager.SetVisibleLayers(hudManager.GetVisibleLayers() & ~(EHudLayers.HIGH | EHudLayers.ALWAYS_TOP));
37 
38  GetGame().GetInputManager().AddActionListener("ShowScoreboard", EActionTrigger.DOWN, ShowPlayerList);
39  }
40 
41  override void OnMenuClose()
42  {
43  super.OnMenuClose();
44 
45  // Show back the previously hidden HUD elements.
46  PlayerController pc = GetGame().GetPlayerController();
47  if (pc)
48  {
49  SCR_HUDManagerComponent hudManager = GetGame().GetHUDManager();
50  if (hudManager)
51  hudManager.SetVisibleLayers(hudManager.GetVisibleLayers() | EHudLayers.HIGH | EHudLayers.ALWAYS_TOP);
52  }
53  GetGame().GetInputManager().RemoveActionListener("ShowScoreboard", EActionTrigger.DOWN, ShowPlayerList);
54  }
55 
56  override void OnMenuUpdate(float tDelta)
57  {
58  super.OnMenuUpdate(tDelta);
59 
60  if (m_ChatPanel)
61  m_ChatPanel.OnUpdateChat(tDelta);
62  }
63 
64  protected void OnChatToggle()
65  {
66  if (!m_ChatPanel || m_ChatPanel.IsOpen() || (m_ChatButton && (!m_ChatButton.IsVisible() || m_ChatButton.GetOpacity() != 1)))
67  return;
68 
69  SCR_ChatPanelManager.GetInstance().ToggleChatPanel(m_ChatPanel);
70  }
71 
72  protected void BackToMainMenuPopupComfirm()
73  {
74  Close();
75  GameStateTransitions.RequestGameplayEndTransition();
76  }
77 
78  protected void OnBackToMainMenu()
79  {
80  SCR_ConfigurableDialogUi dlg = SCR_CommonDialogs.CreateDialog("scenario_exit");
81  if (!dlg)
82  return;
83 
84  dlg.m_OnConfirm.Insert(BackToMainMenuPopupComfirm);
85  }
86 
87  void ReturnToMainMenu()
88  {
89  if (m_BackButton && (!m_BackButton.IsVisible() || m_BackButton.GetOpacity() != 1))
90  return;
91 
92  OnBackToMainMenu();
93  }
94 
95  //------------------------------------------------------------------------------------------------
96  void ShowPlayerList()
97  {
98  GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.PlayerListMenu, 0, true, false);
99  }
100 };
ChimeraMenuBase
Constant variables used in various menus.
Definition: ChimeraMenuBase.c:70
SCR_HUDManagerComponent
Definition: SCR_HUDManagerComponent.c:23
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_CommonDialogs
Definition: CommonDialogs.c:5
SCR_ChatPanelManager
Definition: SCR_ChatPanelManager.c:12
GetRootWidget
Widget GetRootWidget()
Definition: SCR_UITaskManagerComponent.c:160
EHudLayers
EHudLayers
Definition: SCR_HUDManagerComponent.c:5
GameStateTransitions
Definition: GameStateTransitions.c:12
SCR_ChatPanel
Definition: SCR_ChatPanel.c:6
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition: ChimeraMenuBase.c:3
SCR_ConfigurableDialogUi
Definition: SCR_ConfigurableDialogUI.c:13
SCR_GameOverScreenUIComponent
Definition: SCR_GameOverScreenUIComponent.c:1
SCR_InputButtonComponent
Definition: SCR_InputButtonComponent.c:1
GameOverScreenInput
Definition: SCR_GameOverScreenInput.c:1