Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PlayMenu.c
Go to the documentation of this file.
2 {
6 }
7 
8 class SCR_PlayMenuEntry : Managed
9 {
11  ref MissionWorkshopItem m_Item;
13  Widget m_wRoot;
14 
15  void SCR_PlayMenuEntry(MissionWorkshopItem item, EPlayMenuContentType type)
16  {
17  m_Item = item;
19  }
20 }
21 
23 {
24  protected ResourceName m_sConfig = "{6409EA8EA4BFF7E6}Configs/PlayMenu/PlayMenuEntries.conf";
25  protected ref Resource m_Config;
26  protected BaseContainer m_ConfigEntries;
27 
28  const string TYPE_FEATURED = "m_aFeaturedScenarios";
29  const string TYPE_RECOMMENDED = "m_aRecommendedScenarios";
30 
31  protected SCR_PlayMenuComponent m_Featured;
32  protected SCR_PlayMenuComponent m_Recommended;
33  protected SCR_PlayMenuComponent m_Recent;
34 
35  protected ref array<MissionWorkshopItem> m_aScenariosFeatured = {};
36  protected ref array<MissionWorkshopItem> m_aScenariosRecommended = {};
37  protected ref array<MissionWorkshopItem> m_aScenariosRecent = {};
38 
39  protected ref array<ref SCR_PlayMenuEntry> m_aEntriesFeatured = {};
40  protected ref array<ref SCR_PlayMenuEntry> m_aEntriesRecommended = {};
41  protected ref array<ref SCR_PlayMenuEntry> m_aEntriesRecent = {};
42 
43  protected ref MissionWorkshopItem m_ItemTutorial;
44  protected WorkshopApi m_WorkshopAPI;
45  protected SCR_PlayMenuTileComponent m_CurrentTile;
46  protected Widget m_wRoot;
47  protected bool m_bTutorialPlayed;
48  protected bool m_bShowPlayTutorialDialog;
49  protected int m_iPlayTutorialShowCount;
50  protected int m_iPlayTutorialShowMax;
51 
52  const int THRESHOLD_RECENTLY_PLAYED = 3600 * 24 * 30;
53 
54  protected Widget m_wFooter;
55 
56  protected SCR_InputButtonComponent m_Scenarios;
57  protected SCR_InputButtonComponent m_Play;
58  protected SCR_InputButtonComponent m_Continue;
59  protected SCR_InputButtonComponent m_Restart;
60  protected SCR_InputButtonComponent m_Host;
61  protected SCR_InputButtonComponent m_FindServer;
62  protected ref array<SCR_InputButtonComponent> m_aRightFooterButtons = {};
63 
64  protected SCR_PlayMenuTileComponent m_ClickedTile; // Cache last clicked line to trigger the correct dialog after the double click window
65 
66  protected MissionWorkshopItem m_SelectedScenario;
67 
68  protected SCR_MenuActionsComponent m_ActionsComponent;
69 
70  //------------------------------------------------------------------------------------------------
71  override void OnMenuOpen()
72  {
73  super.OnMenuOpen();
75  m_Recent = SCR_PlayMenuComponent.GetComponent("Recent", m_wRoot);
76  m_Recommended = SCR_PlayMenuComponent.GetComponent("Recommended", m_wRoot);
77  m_Featured = SCR_PlayMenuComponent.GetComponent("Featured", m_wRoot);
78  m_WorkshopAPI = GetGame().GetBackendApi().GetWorkshop();
79 
80  m_wFooter = m_wRoot.FindWidget("MenuBase1.SizeBase.VerticalLayout0.SizeFooter.Footer");
81 
84  SCR_DynamicFooterComponent footer = GetFooterComponent();
85  footer.GetOnButtonActivated().Insert(OnInteractionButtonPressed);
86 
87  SCR_InputButtonComponent back = footer.FindButton("Back");
88  m_Scenarios = footer.FindButton("Scenarios");
89  m_Play = footer.FindButton(SCR_ScenarioEntryHelper.BUTTON_PLAY);
90  m_Continue = footer.FindButton(SCR_ScenarioEntryHelper.BUTTON_CONTINUE);
91  m_Restart = footer.FindButton(SCR_ScenarioEntryHelper.BUTTON_RESTART);
92  m_Host = footer.FindButton(SCR_ScenarioEntryHelper.BUTTON_HOST);
93  m_FindServer = footer.FindButton(SCR_ScenarioEntryHelper.BUTTON_FIND_SERVERS);
94 
95  m_aRightFooterButtons = footer.GetButtonsInFooter(SCR_EDynamicFooterButtonAlignment.RIGHT);
96 
98  m_ActionsComponent = SCR_MenuActionsComponent.FindComponent(GetRootWidget());
99  if (m_ActionsComponent)
100  m_ActionsComponent.GetOnAction().Insert(OnActionTriggered);
101 
102  SCR_ServicesStatusHelper.RefreshPing();
103  SCR_ServicesStatusHelper.GetOnCommStatusCheckFinished().Insert(OnCommStatusCheckFinished);
104 
105  // Backend
106  WorkshopApi workshop = GetGame().GetBackendApi().GetWorkshop();
107 
108  // Scan offline items if needed
109  if (workshop.NeedScan())
110  workshop.ScanOfflineItems();
111 
112  // Read the PlayMenu config
113  m_Config = BaseContainerTools.LoadContainer(m_sConfig);
114  if (!m_Config)
115  return;
116 
117  m_ConfigEntries = m_Config.GetResource().ToBaseContainer();
118  if (!m_ConfigEntries)
119  return;
120 
121  // Get tutorial
122  ResourceName tutorial;
123  m_ConfigEntries.Get("m_TutorialScenario", tutorial);
124  m_ItemTutorial = m_WorkshopAPI.GetInGameScenario(tutorial);
125 
126  if (m_ItemTutorial)
127  m_bTutorialPlayed = m_ItemTutorial.GetTimeSinceLastPlay() > -1;
128 
129  // Check how many times "Play tutorial" dialog was shown
130  BaseContainer settings = GetGame().GetGameUserSettings().GetModule("SCR_RecentGames");
131 
132  if (settings)
133  {
134  settings.Get("m_iPlayTutorialShowCount", m_iPlayTutorialShowCount);
135  settings.Get("m_iPlayTutorialShowMax", m_iPlayTutorialShowMax);
136  }
137 
138  m_bShowPlayTutorialDialog = !m_bTutorialPlayed && m_iPlayTutorialShowCount < m_iPlayTutorialShowMax;
139 
140  //PrintFormat("[OnMenuOpen] m_bShowPlayTutorialDialog: %1 | m_bTutorialPlayed: %2 | m_iPlayTutorialShowCount: %3", m_bShowPlayTutorialDialog, m_bTutorialPlayed, m_iPlayTutorialShowCount);
141 
142  // Get scenarios
143  GetScenarios(m_aScenariosFeatured, EPlayMenuContentType.FEATURED);
144  GetScenarios(m_aScenariosRecommended, EPlayMenuContentType.RECOMMENDED);
145  GetScenarios(m_aScenariosRecent, EPlayMenuContentType.RECENT);
146 
147  // Get menu entries
148  CreateMenuEntries(m_aEntriesFeatured, m_aScenariosFeatured, EPlayMenuContentType.FEATURED);
149  CreateMenuEntries(m_aEntriesRecommended, m_aScenariosRecommended, EPlayMenuContentType.RECOMMENDED);
150  CreateMenuEntries(m_aEntriesRecent, m_aScenariosRecent, EPlayMenuContentType.RECENT);
151 
152  SetupSectionTiles(m_Featured, m_aEntriesFeatured);
153  SetupSectionTiles(m_Recommended, m_aEntriesRecommended);
154  SetupSectionTiles(m_Recent, m_aEntriesRecent);
155 
156  // Set starting focused tile
157  if (m_aEntriesRecommended.Count() > 0)
158  m_Recommended.SetFocusedItem(0);
159  }
160 
161  //------------------------------------------------------------------------------------------------
162  override void OnMenuClose()
163  {
164  super.OnMenuClose();
165 
166  SCR_ServicesStatusHelper.GetOnCommStatusCheckFinished().Remove(OnCommStatusCheckFinished);
167  }
168 
169  //------------------------------------------------------------------------------------------------
170  override void OnMenuShow()
171  {
172  super.OnMenuShow();
173 
174  if (m_ActionsComponent)
175  m_ActionsComponent.ActivateActions();
176  }
177 
178  //------------------------------------------------------------------------------------------------
179  override void OnMenuFocusGained()
180  {
181  super.OnMenuFocusGained();
182 
183  if (m_ActionsComponent)
184  m_ActionsComponent.ActivateActions();
185 
186  SCR_ServicesStatusHelper.RefreshPing();
187 
188  // Restore focus to the last accessed tile
189  if (m_CurrentTile)
190  {
191  GetGame().GetWorkspace().SetFocusedWidget(m_CurrentTile.m_wRoot);
192  return;
193  }
194 
195  // Fallback to the 1st item in the *recent items* list
196  if (m_Recent)
197  m_Recent.SetFocusedItem(0);
198  }
199 
200  //------------------------------------------------------------------------------------------------
201  protected void SetupSectionTiles(SCR_PlayMenuComponent section, array<ref SCR_PlayMenuEntry> entries)
202  {
203  ref array<Widget> widgets = section.GetWidgets();
204 
205  // Remove entries that do not fit into the layout
206  if (entries.Count() > widgets.Count())
207  entries.Resize(widgets.Count());
208 
209  // Setup grid tiles
210  foreach (int i, SCR_PlayMenuEntry entry : entries)
211  {
212  Widget w = widgets.Get(i);
213  if (!w)
214  continue;
215 
217  if (!tile)
218  continue;
219 
220  entry.m_Tile = tile;
221  entry.m_wRoot = tile.m_wRoot;
222 
223  tile.GetOnMouseInteractionButtonClicked().Insert(OnInteractionButtonPressed);
224 
225  tile.m_OnFocused.Insert(OnTileFocused);
226  tile.m_OnFocusLost.Insert(OnTileFocusLost);
227 
228  tile.Setup(entry.m_Item, entry.m_eContentType);
229  }
230  }
231 
232  //------------------------------------------------------------------------------------------------
233  void CreateMenuEntries(out array<ref SCR_PlayMenuEntry> entries, array<MissionWorkshopItem> scenarios, EPlayMenuContentType type)
234  {
235  foreach (MissionWorkshopItem scenario : scenarios)
236  {
237  entries.Insert(new SCR_PlayMenuEntry(scenario, type));
238  }
239  }
240 
241  //------------------------------------------------------------------------------------------------
242  void GetScenarios(out array<MissionWorkshopItem> scenarios, EPlayMenuContentType type)
243  {
244  if (type == EPlayMenuContentType.RECENT)
245  {
246  GetRecentScenarios(scenarios);
247  return;
248  }
249 
250  array<ResourceName> aResources = {};
251 
252  if (type == EPlayMenuContentType.FEATURED)
253  m_ConfigEntries.Get(TYPE_FEATURED, aResources);
254  else
255  m_ConfigEntries.Get(TYPE_RECOMMENDED, aResources);
256 
257  foreach (ResourceName sResource : aResources)
258  {
259  MissionWorkshopItem scenario = m_WorkshopAPI.GetInGameScenario(sResource);
260 
261  if (scenario && !IsMissingDependency(scenario))
262  scenarios.Insert(scenario);
263  }
264  }
265 
266  //------------------------------------------------------------------------------------------------
267  void GetRecentScenarios(out array<MissionWorkshopItem> scenarios)
268  {
269  // Get missions from Workshop API
270  m_WorkshopAPI.GetPageScenarios(scenarios, 0, 10000);
271 
272  int count = scenarios.Count();
273  int elapsed;
274  MissionWorkshopItem scenario;
275 
276  // Remove scenarios from disabled addons
277  for (int i = count - 1; i >= 0; i--)
278  {
279  scenario = scenarios[i];
280  elapsed = scenario.GetTimeSinceLastPlay();
281 
282  if (elapsed == -1 || elapsed > THRESHOLD_RECENTLY_PLAYED || IsMissingDependency(scenario))
283  {
284  //PrintFormat("[GetRecentScenarios] removed: %1 | last played: %2 | missing dependency: %3", scenario.Name(), elapsed, IsMissingDependency(scenario));
285  scenarios.Remove(i);
286  continue;
287  }
288  };
289 
290  SCR_Sorting<MissionWorkshopItem, SCR_CompareMissionTimeSinceLastPlay>.HeapSort(scenarios, false);
291  /*
292  // DEBUG: Print sorted recent scenarios
293  count = scenarios.Count();
294  for (int i = 0; i < count; i++)
295  {
296  scenario = scenarios[i];
297  PrintFormat("[GetRecentScenarios] found: %1 | last played: %2", scenario.Name(), scenario.GetTimeSinceLastPlay());
298  }
299  */
300  }
301 
302  //------------------------------------------------------------------------------------------------
303  protected bool IsMissingDependency(MissionWorkshopItem scenario)
304  {
305  WorkshopItem addon = scenario.GetOwner();
306 
307  // There are no dependencies if scenario is not from an addon
308  if (!addon)
309  return false;
310 
311  array<Dependency> dependencies = {};
312  addon.GetActiveRevision().GetDependencies(dependencies);
313 
314  // Check if any dependency is missing
315  foreach (Dependency dependency : dependencies)
316  {
317  if (!dependency.IsOffline())
318  return true;
319  }
320 
321  return false;
322  }
323 
324  //------------------------------------------------------------------------------------------------
325  protected bool IsUnique(MissionWorkshopItem item, array<ref SCR_PlayMenuEntry> entries)
326  {
327  if (!item)
328  return false;
329 
330  foreach (SCR_PlayMenuEntry entry : entries)
331  {
332  if (!entry || !entry.m_Item)
333  continue;
334 
335  if (item == entry.m_Item)
336  return false;
337  }
338 
339  return true;
340  }
341 
343  //------------------------------------------------------------------------------------------------
344  protected void OnActionTriggered(string action, float multiplier)
345  {
347  if (GetGame().GetInputManager().GetLastUsedInputDevice() != EInputDeviceType.MOUSE || !GetTileUnderCursor())
348  return;
349 
350  MissionWorkshopItem scenario = GetSelectedScenario();
351 
352  switch (action)
353  {
354  case SCR_ScenarioEntryHelper.ACTION_DOUBLE_CLICK: OnTileClickInteraction(multiplier); break;
355  case SCR_ScenarioEntryHelper.ACTION_RESTART: Restart(scenario); break;
356  case SCR_ScenarioEntryHelper.ACTION_FIND_SERVERS: Join(scenario); break;
357  case SCR_ScenarioEntryHelper.ACTION_HOST: Host(scenario); break;
358  }
359  }
360 
361  //------------------------------------------------------------------------------------------------
362  protected void OnInteractionButtonPressed(string action)
363  {
364  SwitchOnButton(action, GetSelectedScenario());
365  }
366 
367  //------------------------------------------------------------------------------------------------
368  protected void OnConfirmationDialogButtonPressed(SCR_ScenarioConfirmationDialogUi dialog, string tag)
369  {
370  if (!dialog)
371  return;
372 
373  SwitchOnButton(tag, dialog.GetScenario());
374  }
375 
376  //------------------------------------------------------------------------------------------------
377  protected void SwitchOnButton(string tag, MissionWorkshopItem scenario)
378  {
379  switch (tag)
380  {
381  case SCR_ConfigurableDialogUi.BUTTON_CONFIRM: Play(scenario); break;
382  case SCR_ScenarioEntryHelper.BUTTON_PLAY: Play(scenario); break;
383  case SCR_ScenarioEntryHelper.BUTTON_CONTINUE: Continue(scenario); break;
384  case SCR_ScenarioEntryHelper.BUTTON_RESTART: Restart(scenario); break;
385  case SCR_ScenarioEntryHelper.BUTTON_FIND_SERVERS: Join(scenario); break;
386  case SCR_ScenarioEntryHelper.BUTTON_HOST: Host(scenario); break;
387  case "Scenarios": OnScenarios(); break;
388  case "Back": OnBack(); break;
389  }
390  }
391 
392  // CLICKS
393  //------------------------------------------------------------------------------------------------
394  //------------------------------------------------------------------------------------------------
395  protected void OnTileClickInteraction(float multiplier)
396  {
398 
399  SCR_PlayMenuTileComponent tile = m_ClickedTile;
400  if (!tile || !GetTileUnderCursor())
401  return;
402 
403  MissionWorkshopItem scenario = tile.m_Item;
404  if (!scenario)
405  return;
406 
407  switch (Math.Floor(multiplier))
408  {
409  case 1: OnClickInteraction(scenario); break;
410  case 2: OnDoubleClickInteraction(scenario); break;
411  }
412 
413  m_ClickedTile = null;
414  }
415 
416  //------------------------------------------------------------------------------------------------
417  protected void OnClickInteraction(MissionWorkshopItem scenario)
418  {
420  SCR_ScenarioConfirmationDialogUi scenarioConfirmationDialog = SCR_ScenarioDialogs.CreateScenarioConfirmationDialog(scenario);
421  if (!scenarioConfirmationDialog)
422  {
423  OnPlayInteraction(scenario);
424  return;
425  }
426 
428  scenarioConfirmationDialog.m_OnButtonPressed.Insert(OnConfirmationDialogButtonPressed);
429  }
430 
431  //------------------------------------------------------------------------------------------------
432  protected void OnDoubleClickInteraction(MissionWorkshopItem scenario)
433  {
434  if (!scenario)
435  return;
436 
437  OnPlayInteraction(scenario);
438  }
439 
440  // BUTTONS
441  //------------------------------------------------------------------------------------------------
442  protected void OnTileMouseClick(SCR_TileBaseComponent tile)
443  {
444  m_ClickedTile = SCR_PlayMenuTileComponent.Cast(tile);
445  }
446 
447  // INTERACTIONS
448  //------------------------------------------------------------------------------------------------
449  protected void OnPlayInteraction(MissionWorkshopItem scenario)
450  {
451  if (!scenario)
452  return;
453 
454  SCR_MissionHeader header = SCR_MissionHeader.Cast(MissionHeader.ReadMissionHeader(scenario.Id()));
455 
456  if (!header)
457  return;
458 
459  bool canBeLoaded = header && GetGame().GetSaveManager().HasLatestSave(header);
460  if (canBeLoaded)
461  Continue(scenario);
462  else
463  Play(scenario);
464  }
465 
466  //------------------------------------------------------------------------------------------------
467  protected void OnBack()
468  {
469  Close();
470  }
471 
472  //------------------------------------------------------------------------------------------------
473  protected void OnScenarios()
474  {
475  SCR_MenuLoadingComponent.SaveLastMenu(ChimeraMenuPreset.PlayMenu);
476 
477  GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.ScenarioMenu);
478  }
479 
480  //------------------------------------------------------------------------------------------------
481  protected void Play(MissionWorkshopItem scenario)
482  {
483  if (!scenario)
484  return;
485 
486  m_SelectedScenario = scenario;
487 
488  if (m_bShowPlayTutorialDialog && m_ItemTutorial && m_ItemTutorial != m_CurrentTile.m_Item)
489  {
490  BaseContainer settings = GetGame().GetGameUserSettings().GetModule("SCR_RecentGames");
491 
492  if (settings)
493  {
494  m_iPlayTutorialShowCount++;
495 
496  settings.Set("m_iPlayTutorialShowCount", m_iPlayTutorialShowCount);
497  GetGame().UserSettingsChanged();
498  }
499 
500  // Tutorial confirmation dialog
501  SCR_ConfigurableDialogUi dialog = SCR_CommonDialogs.CreateTutorialDialog();
502  if (dialog)
503  {
504  dialog.m_OnConfirm.Insert(OnPlayTutorial);
505  dialog.m_OnCancel.Insert(PlayCurrentScenario);
506  }
507  }
508  else
509  {
510  PlayCurrentScenario();
511  }
512 
513  SCR_MenuLoadingComponent.SaveLastMenu(ChimeraMenuPreset.PlayMenu);
514  }
515 
516  //------------------------------------------------------------------------------------------------
517  protected void Continue(MissionWorkshopItem scenario)
518  {
519  if (!scenario)
520  return;
521 
522  m_SelectedScenario = scenario;
523 
524  SCR_MissionHeader header = m_CurrentTile.m_Header;
525  if (header && !header.GetSaveFileName().IsEmpty())
526  GetGame().GetSaveManager().SetFileNameToLoad(header);
527  else
528  GetGame().GetSaveManager().ResetFileNameToLoad();
529 
530  PlayCurrentScenario();
531 
532  SCR_MenuLoadingComponent.SaveLastMenu(ChimeraMenuPreset.PlayMenu);
533  }
534 
535  //------------------------------------------------------------------------------------------------
536  protected void Restart(MissionWorkshopItem scenario)
537  {
538  if (!scenario)
539  return;
540 
541  m_SelectedScenario = scenario;
542 
543  SCR_ConfigurableDialogUi dialog = SCR_CommonDialogs.CreateDialog("scenario_restart");
544  dialog.m_OnConfirm.Insert(OnRestartConfirmed);
545  }
546 
547  //------------------------------------------------------------------------------------------------
548  protected void OnRestartConfirmed()
549  {
550  GetGame().GetSaveManager().ResetFileNameToLoad();
551  PlayCurrentScenario();
552 
553  SCR_MenuLoadingComponent.SaveLastMenu(ChimeraMenuPreset.PlayMenu);
554  }
555 
556  //------------------------------------------------------------------------------------------------
557  protected void Host(MissionWorkshopItem scenario)
558  {
559  SCR_EScenarioEntryErrorState state = SCR_ScenarioEntryHelper.GetErrorState(scenario);
560  if (!scenario || !SCR_ScenarioEntryHelper.IsMultiplayer(scenario) || SCR_ScenarioEntryHelper.IsInErrorState(state))
561  return;
562 
563  m_SelectedScenario = scenario;
564 
565  HostCurrentScenario();
566 
567  SCR_MenuLoadingComponent.SaveLastMenu(ChimeraMenuPreset.PlayMenu);
568  }
569 
570  //------------------------------------------------------------------------------------------------
571  protected void Join(MissionWorkshopItem scenario)
572  {
573  SCR_EScenarioEntryErrorState state = SCR_ScenarioEntryHelper.GetErrorState(scenario);
574  if (!scenario || !SCR_ScenarioEntryHelper.IsMultiplayer(scenario) || SCR_ScenarioEntryHelper.IsInErrorState(state))
575  return;
576 
577  m_SelectedScenario = scenario;
578 
579  FindCurrentScenarioServers();
580 
581  SCR_MenuLoadingComponent.SaveLastMenu(ChimeraMenuPreset.PlayMenu);
582  }
583 
584  //------------------------------------------------------------------------------------------------
585  protected void OnTileFocused(SCR_PlayMenuTileComponent tile)
586  {
587  m_CurrentTile = tile;
588 
589  UpdateNavigationButtons();
590 
591  tile.m_OnClicked.Insert(OnTileMouseClick);
592  }
593 
594  //------------------------------------------------------------------------------------------------
595  protected void OnTileFocusLost(SCR_PlayMenuTileComponent tile)
596  {
597  UpdateNavigationButtons(false);
598 
599  tile.m_OnClicked.Remove(OnTileMouseClick);
600  }
601 
602  //------------------------------------------------------------------------------------------------
603  protected void UpdateNavigationButtons(bool show = true)
604  {
605  if (!m_CurrentTile)
606  return;
607 
608  show = show && GetSelectedTile() && GetGame().GetInputManager().GetLastUsedInputDevice() != EInputDeviceType.MOUSE;
609  SCR_ScenarioEntryHelper.UpdateInputButtons(m_CurrentTile.m_Item, m_aRightFooterButtons, show);
610  }
611 
612  //------------------------------------------------------------------------------------------------
613  void TryPlayScenario(MissionWorkshopItem scenario)
614  {
615  if (!scenario)
616  return;
617 
618  SCR_WorkshopUiCommon.TryPlayScenario(scenario);
619  }
620 
621  //------------------------------------------------------------------------------------------------
622  protected void PlayCurrentScenario()
623  {
624  if (m_SelectedScenario)
625  TryPlayScenario(m_SelectedScenario);
626  }
627 
628  //------------------------------------------------------------------------------------------------
629  protected void FindCurrentScenarioServers()
630  {
631  if (m_SelectedScenario)
632  ServerBrowserMenuUI.OpenWithScenarioFilter(m_SelectedScenario);
633  }
634 
635  //------------------------------------------------------------------------------------------------
636  protected void HostCurrentScenario()
637  {
638  if (!m_SelectedScenario)
639  return;
640 
641  ServerHostingUI dialog = SCR_CommonDialogs.CreateServerHostingDialog();
642 
643  if (!dialog)
644  return;
645 
646  dialog.SelectScenario(m_SelectedScenario);
647  }
648 
649  //------------------------------------------------------------------------------------------------
650  protected void OnPlayTutorial()
651  {
652  TryPlayScenario(m_ItemTutorial);
653  }
654 
655  //------------------------------------------------------------------------------------------------
656  protected SCR_PlayMenuTileComponent GetSelectedTile()
657  {
658  // We are not over a line, use currently focused line
659  Widget wfocused = GetGame().GetWorkspace().GetFocusedWidget();
661  if (wfocused)
662  comp = SCR_PlayMenuTileComponent.Cast(wfocused.FindHandler(SCR_PlayMenuTileComponent));
663 
664  EInputDeviceType inputDevice = GetGame().GetInputManager().GetLastUsedInputDevice();
665  bool isCursorOnInnerButton = m_CurrentTile && m_CurrentTile.m_bIsMouseInteraction;
666 
667  if (inputDevice == EInputDeviceType.MOUSE && (GetTileUnderCursor() || isCursorOnInnerButton))
668  return m_CurrentTile;
669  else
670  return comp;
671  }
672 
673  //------------------------------------------------------------------------------------------------
674  protected SCR_PlayMenuTileComponent GetTileUnderCursor()
675  {
676  Widget w = WidgetManager.GetWidgetUnderCursor();
677 
678  if (!w)
679  return null;
680 
681  return SCR_PlayMenuTileComponent.Cast(w.FindHandler(SCR_PlayMenuTileComponent));
682  }
683 
684  //------------------------------------------------------------------------------------------------
685  protected MissionWorkshopItem GetSelectedScenario()
686  {
687  SCR_PlayMenuTileComponent comp = GetSelectedTile();
688 
689  if (!comp)
690  return null;
691 
692  return comp.m_Item;
693  }
694 
695  //------------------------------------------------------------------------------------------------
696  protected void OnCommStatusCheckFinished(SCR_ECommStatus status, float responseTime, float lastSuccessTime, float lastFailTime)
697  {
698  UpdateNavigationButtons();
699  }
700 }
SCR_ECommStatus
SCR_ECommStatus
This class may become obsolete on BackendAPI update.
Definition: SCR_ServicesStatusHelper.c:2
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
RECOMMENDED
@ RECOMMENDED
Definition: SCR_PlayMenu.c:4
SCR_PlayMenuComponent
Definition: SCR_PlayMenuComponent.c:1
m_aRightFooterButtons
protected ref array< SCR_InputButtonComponent > m_aRightFooterButtons
Definition: SCR_ScenarioDialogs.c:37
SCR_TileBaseComponent
Definition: SCR_TileBaseComponent.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
MissionHeader
Definition: MissionHeader.c:32
SCR_CommonDialogs
Definition: CommonDialogs.c:5
THRESHOLD_RECENTLY_PLAYED
const int THRESHOLD_RECENTLY_PLAYED
Definition: SCR_GMMenu.c:37
SCR_PlayMenuTileComponent
Definition: SCR_PlayMenuTileComponent.c:1
EPlayMenuContentType
EPlayMenuContentType
Definition: SCR_PlayMenu.c:1
m_Host
protected SCR_InputButtonComponent m_Host
Definition: SCR_ScenarioDialogs.c:35
m_Item
ref MissionWorkshopItem m_Item
Definition: SCR_PlayMenu.c:11
m_sConfig
protected ResourceName m_sConfig
Definition: SCR_GMMenu.c:30
SCR_EScenarioEntryErrorState
SCR_EScenarioEntryErrorState
Definition: SCR_ScenarioEntryHelper.c:419
GetRootWidget
Widget GetRootWidget()
Definition: SCR_UITaskManagerComponent.c:160
m_Tile
SCR_PlayMenuTileComponent m_Tile
Definition: SCR_PlayMenu.c:12
m_wRoot
Widget m_wRoot
Definition: SCR_PlayMenu.c:13
FEATURED
@ FEATURED
Definition: SCR_PlayMenu.c:3
MenuRootBase
Definition: MenuRootBase.c:6
RECENT
@ RECENT
Definition: SCR_PlayMenu.c:5
m_eContentType
enum EPlayMenuContentType m_eContentType
SCR_ScenarioConfirmationDialogUi
void SCR_ScenarioConfirmationDialogUi(MissionWorkshopItem scenario, ScriptInvokerBool onFavoritesResponse=null)
Definition: SCR_ScenarioDialogs.c:50
SCR_PlayMenu
Definition: SCR_PlayMenu.c:22
m_CurrentTile
protected SCR_GMMenuTileComponent m_CurrentTile
Definition: SCR_GMMenu.c:33
SCR_ServicesStatusHelper
Definition: SCR_ServicesStatusHelper.c:15
SCR_ScenarioDialogs
Definition: SCR_ScenarioDialogs.c:9
SCR_PlayMenuEntry
void SCR_PlayMenuEntry(MissionWorkshopItem item, EPlayMenuContentType type)
Definition: SCR_PlayMenu.c:15
GetInputManager
protected InputManager GetInputManager()
Definition: SCR_BaseManualCameraComponent.c:65
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition: ChimeraMenuBase.c:3
SCR_ConfigurableDialogUi
Definition: SCR_ConfigurableDialogUI.c:13
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
SCR_MenuActionsComponent
Definition: SCR_MenuActionsComponent.c:9
SCR_WorkshopUiCommon
Definition: SCR_WorkshopUiCommon.c:5
m_WorkshopAPI
protected WorkshopApi m_WorkshopAPI
Definition: SCR_GMMenu.c:32
ServerBrowserMenuUI
Definition: ServerBrowserMenuUI.c:10
SCR_MissionHeader
Definition: SCR_MissionHeader.c:1
SCR_InputButtonComponent
Definition: SCR_InputButtonComponent.c:1