Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
CommonDialogs.c
Go to the documentation of this file.
1 
6 {
7  static const ResourceName DIALOGS_CONFIG = "{814FCA3CB7851F6B}Configs/Dialogs/CommonDialogs.conf";
8 
9  //---------------------------------------------------------------------------------------------
10  static SCR_ConfigurableDialogUi CreateDialog(string presetName)
11  {
12  return SCR_ConfigurableDialogUi.CreateFromPreset(DIALOGS_CONFIG, presetName);
13  }
14 
15  //---------------------------------------------------------------------------------------------
16  static SCR_ConfigurableDialogUi CreateRequestErrorDialog()
17  {
18  return SCR_ConfigurableDialogUi.CreateFromPreset(DIALOGS_CONFIG, "request_error");
19  }
20 
21  //---------------------------------------------------------------------------------------------
22  static SCR_ConfigurableDialogUi CreateTimeoutOkDialog()
23  {
24  return SCR_ConfigurableDialogUi.CreateFromPreset(DIALOGS_CONFIG, "timeout_ok");
25  }
26 
27  //---------------------------------------------------------------------------------------------
28  static SCR_ConfigurableDialogUi CreateTimeoutTryAgainCancelDialog()
29  {
30  return SCR_ConfigurableDialogUi.CreateFromPreset(DIALOGS_CONFIG, "timeout_try_again_cancel");
31  }
32 
33  //---------------------------------------------------------------------------------------------
34  static SCR_ServicesStatusDialogUI CreateServicesStatusDialog()
35  {
37  return SCR_ServicesStatusDialogUI.Cast(SCR_ConfigurableDialogUi.CreateFromPreset(DIALOGS_CONFIG, "services_status", dialog));
38  }
39 
40  //---------------------------------------------------------------------------------------------
41  static SCR_ConfigurableDialogUi CreateTutorialDialog()
42  {
43  return SCR_ConfigurableDialogUi.CreateFromPreset(DIALOGS_CONFIG, "tutorial");
44  }
45 
46  //---------------------------------------------------------------------------------------------
47  static ServerHostingUI CreateServerHostingDialog()
48  {
49  ServerHostingUI dialog = new ServerHostingUI();
50  return ServerHostingUI.Cast(SCR_ConfigurableDialogUi.CreateFromPreset(DIALOGS_CONFIG, "server_hosting", dialog));
51  }
52 
53  //---------------------------------------------------------------------------------------------
54  static AddonsToolsUI CreateModPresetsDialog()
55  {
56  AddonsToolsUI dialog = new AddonsToolsUI();
57  return AddonsToolsUI.Cast(SCR_ConfigurableDialogUi.CreateFromPreset(DIALOGS_CONFIG, "mod_presets", dialog));
58  }
59 
60  //---------------------------------------------------------------------------------------------
61  static SCR_DownloadManager_Dialog CreateDownloadManagerDialog()
62  {
64  return SCR_DownloadManager_Dialog.Cast(SCR_ConfigurableDialogUi.CreateFromPreset(DIALOGS_CONFIG, "download_manager", dialog));
65  }
66 }
67 
68 //---------------------------------------------------------------------------------------------
70 {
71  //---------------------------------------------------------------------------------------------
73  {
74  SCR_ConfigurableDialogUi.CreateFromPreset(SCR_CommonDialogs.DIALOGS_CONFIG, "exit_game", this);
75  }
76 
77  //---------------------------------------------------------------------------------------------
78  override void OnConfirm()
79  {
80  GetGame().RequestClose();
81  }
82 }
83 
84 //---------------------------------------------------------------------------------------------
86 {
87  //---------------------------------------------------------------------------------------------
89  {
90  SCR_ConfigurableDialogUi.CreateFromPreset(SCR_CommonDialogs.DIALOGS_CONFIG, "exit_game_while_downloading", this);
91  }
92 
93  //---------------------------------------------------------------------------------------------
94  override void OnConfirm()
95  {
96  // Try to terminate all current downloads
97  SCR_DownloadManager mgr = SCR_DownloadManager.GetInstance();
98  if (mgr)
99  mgr.EndAllDownloads();
100 
101  // Exit the game
102  GetGame().RequestClose();
103  }
104 }
105 
106 //------------------------------------------------------------------------------------------------
109 class SCR_StartScenarioWhileDownloadingDialog : SCR_ConfigurableDialogUi
110 {
111  protected ref MissionWorkshopItem m_Scenario;
112 
113  //---------------------------------------------------------------------------------------------
114  static void CreateDialog(MissionWorkshopItem scenario)
115  {
116  SCR_StartScenarioWhileDownloadingDialog dialog = new SCR_StartScenarioWhileDownloadingDialog();
117  dialog.SetScenario(scenario);
118 
119  SCR_ConfigurableDialogUi.CreateFromPreset(SCR_CommonDialogs.DIALOGS_CONFIG, "start_scenario_while_downloading", dialog);
120  }
121 
122  //---------------------------------------------------------------------------------------------
123  override void OnConfirm()
124  {
125  SCR_DownloadManager mgr = SCR_DownloadManager.GetInstance();
126  if (mgr)
127  mgr.EndAllDownloads();
128 
129  if (m_Scenario)
130  m_Scenario.Play();
131 
132  super.OnConfirm();
133  }
134 
135  //---------------------------------------------------------------------------------------------
136  void SetScenario(MissionWorkshopItem scenario)
137  {
138  m_Scenario = scenario;
139  }
140 }
141 
142 //------------------------------------------------------------------------------------------------
144 {
145  protected ref MissionWorkshopItem m_Scenario;
146  protected ref SCR_DSConfig m_DSConfig;
147 
148  //---------------------------------------------------------------------------------------------
149  static void CreateDialog(MissionWorkshopItem scenario, SCR_DSConfig config)
150  {
152  dialog.SetScenario(scenario);
153  dialog.SetConfig(config);
154 
155  SCR_ConfigurableDialogUi.CreateFromPreset(SCR_CommonDialogs.DIALOGS_CONFIG, "start_scenario_while_downloading", dialog);
156  }
157 
158  //---------------------------------------------------------------------------------------------
159  override void OnConfirm()
160  {
161  SCR_DownloadManager mgr = SCR_DownloadManager.GetInstance();
162  if (mgr)
163  mgr.EndAllDownloads();
164 
165  if (m_Scenario && m_DSConfig)
166  m_Scenario.Host(m_DSConfig);
167 
168  super.OnConfirm();
169  }
170 
171  //---------------------------------------------------------------------------------------------
172  void SetScenario(MissionWorkshopItem scenario)
173  {
174  m_Scenario = scenario;
175  }
176 
177  //---------------------------------------------------------------------------------------------
178  void SetConfig(SCR_DSConfig config)
179  {
180  m_DSConfig = config;
181  }
182 }
183 
184 //------------------------------------------------------------------------------------------------
187 {
188  protected float m_fSizeBytes;
189  protected string m_sPresetMessage;
190 
191  //------------------------------------------------------------------------------------------------
192  static SCR_NotEnoughStorageDialog Create(float sizeBytes)
193  {
195 
196  SCR_ConfigurableDialogUi.CreateFromPreset(
197  SCR_CommonDialogs.DIALOGS_CONFIG,
198  "error_not_enough_storage",
199  dlg);
200 
201  return dlg;
202  }
203 
204  //------------------------------------------------------------------------------------------------
206  void AddToSize(float sizeBytes)
207  {
208  m_fSizeBytes += sizeBytes;
209 
210  string sizeStr = SCR_ByteFormat.GetReadableSize(m_fSizeBytes);
211  string messageStr = WidgetManager.Translate(m_sPresetMessage, sizeStr);
212 
213  SetMessage(messageStr);
214  }
215 
216  //------------------------------------------------------------------------------------------------
218  {
219  // Set the message with formatted size
220  string sizeStr = SCR_ByteFormat.GetReadableSize(m_fSizeBytes);
221 
222  m_sPresetMessage = preset.m_sMessage;
223  string messageStr = WidgetManager.Translate(m_sPresetMessage, sizeStr);
224  SetMessage(messageStr);
225  }
226 
227  //------------------------------------------------------------------------------------------------
228  void SCR_NotEnoughStorageDialog(float sizeBytes)
229  {
230  m_fSizeBytes = sizeBytes;
231  }
232 }
AddToSize
void AddToSize(float sizeBytes)
Increase size displayed in dialog.
Definition: CommonDialogs.c:206
SetMessage
bool SetMessage(string message)
Definition: SCR_BrowserHoverTooltipComponent.c:255
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_CommonDialogs
Definition: CommonDialogs.c:5
SCR_ExitGameDialog
class SCR_CommonDialogs SCR_ExitGameDialog()
Definition: CommonDialogs.c:72
OnConfirm
override void OnConfirm()
Definition: CommonDialogs.c:78
SCR_ExitGameWhileDownloadingDialog
Definition: CommonDialogs.c:85
SCR_ByteFormat
Definition: SCR_ByteFormat.c:5
SCR_DSConfig
Definition: SCR_DSConfig.c:5
m_DSConfig
protected ref SCR_DSConfig m_DSConfig
Definition: ServerHostingUI.c:25
SCR_ConfigurableDialogUiPreset
Configuration for a dialog.
Definition: SCR_ConfigurableDialogUI.c:809
m_sPresetMessage
protected string m_sPresetMessage
Definition: CommonDialogs.c:189
m_fSizeBytes
SCR_HostScenarioWhileDownloadingDialog m_fSizeBytes
There is not enough storage on your hard drive. The space required is at least %1.
SCR_ServicesStatusDialogUI
Definition: SCR_ServicesStatusDialogUI.c:8
SCR_DownloadManager_Dialog
void SCR_DownloadManager_Dialog()
Definition: SCR_DownloadManager_Dialog.c:491
SCR_ConfigurableDialogUi
Definition: SCR_ConfigurableDialogUI.c:13
SCR_NotEnoughStorageDialog
void SCR_NotEnoughStorageDialog(float sizeBytes)
Definition: CommonDialogs.c:228
SCR_DownloadManager
Definition: SCR_DownloadManager.c:20
SetScenario
void SetScenario(MissionWorkshopItem scenario)
Definition: CommonDialogs.c:136
SCR_HostScenarioWhileDownloadingDialog
Definition: CommonDialogs.c:143
m_Scenario
SCR_ExitGameWhileDownloadingDialog m_Scenario
OnMenuOpen
override void OnMenuOpen(SCR_ConfigurableDialogUiPreset preset)
Definition: CommonDialogs.c:217