Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ServerHostingSettingsSubMenu.c
Go to the documentation of this file.
1 
5 {
6  protected SCR_InputButtonComponent m_NavHost;
7  protected SCR_InputButtonComponent m_NavSave;
8 
9  protected bool m_bIsListeningForCommStatus;
10 
11  protected SCR_ConfigListComponent m_ConfigList;
12 
13  protected ref ScriptInvokerVoid m_OnHost;
14  protected ref ScriptInvokerVoid m_OnSave;
15 
16  //------------------------------------------------------------------------------------------------
17  override void HandlerDeattached(Widget w)
18  {
19  super.HandlerDeattached(w);
20 
21  SCR_ServicesStatusHelper.GetOnCommStatusCheckFinished().Remove(OnCommStatusCheckFinished);
22  m_bIsListeningForCommStatus = false;
23  }
24 
25  //------------------------------------------------------------------------------------------------
26  override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index)
27  {
28  super.OnTabCreate(menuRoot, buttonsLayout, index);
29 
31 
32  m_NavHost = CreateNavigationButton("MenuSelectHold", "#AR-ServerHosting_HostLocally", true);
33  if (m_NavHost)
34  m_NavHost.m_OnActivated.Insert(OnHost);
35 
36  UpdateHostButton();
37 
38  // Tempory disabled saving
40  {
41  m_NavSave = CreateNavigationButton("MenuSave", "#AR-PauseMenu_Save", true);
42  if (m_NavSave)
43  m_NavSave.m_OnActivated.Insert(OnSave);
44  }
45 
46  // Hide
47  ShowNavigationButtons(m_bShown);
48  }
49 
50  //------------------------------------------------------------------------------------------------
51  override void OnTabShow()
52  {
53  super.OnTabShow();
54 
55  SCR_ServicesStatusHelper.RefreshPing();
56 
57  if (!m_bIsListeningForCommStatus)
58  SCR_ServicesStatusHelper.GetOnCommStatusCheckFinished().Insert(OnCommStatusCheckFinished);
59 
60  m_bIsListeningForCommStatus = true;
61  UpdateHostButton();
62  }
63 
64  //------------------------------------------------------------------------------------------------
65  override void OnTabHide()
66  {
67  super.OnTabHide();
68 
69  SCR_ServicesStatusHelper.GetOnCommStatusCheckFinished().Remove(OnCommStatusCheckFinished);
70  m_bIsListeningForCommStatus = false;
71  }
72 
73  //------------------------------------------------------------------------------------------------
74  protected void UpdateHostButton()
75  {
76  if (!m_NavHost)
77  return;
78 
79  SCR_InputButtonComponent.SetConnectionButtonEnabled(m_NavHost, SCR_ServicesStatusHelper.SERVICE_BI_BACKEND_MULTIPLAYER);
80  }
81 
82  //------------------------------------------------------------------------------------------------
83  protected void OnCommStatusCheckFinished(SCR_ECommStatus status, float responseTime, float lastSuccessTime, float lastFailTime)
84  {
85  UpdateHostButton();
86  }
87 
88  //------------------------------------------------------------------------------------------------
89  protected void OnHost()
90  {
91  if (m_OnHost)
92  m_OnHost.Invoke();
93  }
94 
95  //------------------------------------------------------------------------------------------------
96  protected void OnSave()
97  {
98  if (m_OnSave)
99  m_OnSave.Invoke();
100  }
101 
102  //-------------------------------------------------------------------------------------------
103  // API
104  //-------------------------------------------------------------------------------------------
105  SCR_ConfigListComponent GetConfigList()
106  {
107  return m_ConfigList;
108  }
109 
110  //-------------------------------------------------------------------------------------------
111  ScriptInvokerVoid GetOnHost()
112  {
113  if (!m_OnHost)
114  m_OnHost = new ScriptInvokerVoid();
115 
116  return m_OnHost;
117  }
118 
119  //-------------------------------------------------------------------------------------------
120  ScriptInvokerVoid GetOnSave()
121  {
122  if (!m_OnSave)
123  m_OnSave = new ScriptInvokerVoid();
124 
125  return m_OnSave;
126  }
127 }
m_bShown
protected bool m_bShown
Definition: SCR_InfoDisplay.c:61
SCR_ECommStatus
SCR_ECommStatus
This class may become obsolete on BackendAPI update.
Definition: SCR_ServicesStatusHelper.c:2
SCR_ConfigListComponent
Definition: SCR_ConfigListComponent.c:5
m_ConfigList
protected ref SCR_ServerConfigListComponent m_ConfigList
Definition: ServerHostingUI.c:29
SCR_ServerHostingSettingsSubMenu
Definition: SCR_ServerHostingSettingsSubMenu.c:4
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SubMenuBase
Definition: SCR_SubMenuBase.c:6
IsPlatformGameConsole
bool IsPlatformGameConsole()
Definition: game.c:1393
GetRootWidget
Widget GetRootWidget()
Definition: SCR_UITaskManagerComponent.c:160
SCR_ServicesStatusHelper
Definition: SCR_ServicesStatusHelper.c:15
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
ScriptInvokerVoid
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
Definition: SCR_ScriptInvokerHelper.c:9
SCR_InputButtonComponent
Definition: SCR_InputButtonComponent.c:1