Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CampaignMenuUI.c
Go to the documentation of this file.
2{
3 protected const ResourceName TILES_LAYOUT = "{056BE72745839C20}UI/layouts/Menus/ContentBrowser/CampaignMenu/CampaignTile_Vertical.layout";
4 protected const ResourceName CONFIG = "{0B1DDB81597DFF04}Configs/MainMenu/CampaignMenuEntries.conf";
5
6 //------------------------------------------------------------------------------------------------
7 protected override void OnMenuOpen()
8 {
9 super.OnMenuOpen();
10
11 SCR_InputButtonComponent buttonBack = m_DynamicFooter.FindButton(UIConstants.BUTTON_BACK);
12 if (buttonBack)
13 buttonBack.m_OnActivated.Insert(Close);
14
15 bool disableContent = GetGame().GetGameInstallStatus() != 1.0;
16 PrepareTiles(disableContent);
17
18 if (System.GetPlatform() == EPlatform.PS5 || System.GetPlatform() == EPlatform.PS4 || System.GetPlatform() == EPlatform.PS5_PRO)
19 {
20 // Hide tabs for PS
22 m_SuperMenuComponent.GetTabView().RemoveTab(EScenarioSubMenuMode.MODE_SAVES);
23
24 // Hide news menu button (top right corner) on PS
25 Widget newsButton = GetRootWidget().FindAnyWidget("NewsButton");
26 if (newsButton)
27 {
28 newsButton.SetVisible(false);
29 newsButton.SetEnabled(false);
30 }
31 }
32 }
33
34 //------------------------------------------------------------------------------------------------
35 protected void PrepareTiles(bool isContentDisabled = false)
36 {
37 Resource resource = BaseContainerTools.LoadContainer(CONFIG);
38 if (!resource)
39 return;
40
41 BaseContainer container = resource.GetResource().ToBaseContainer();
42 SCR_CampaignMenuConfiguration menuConf = SCR_CampaignMenuConfiguration.Cast(BaseContainerTools.CreateInstanceFromContainer(container));
43 if (!menuConf)
44 return;
45
46 array<ResourceName> missions = menuConf.m_aCampaignMenuScenarios;
47
48 Widget scenarioWidgetParent = GetRootWidget().FindAnyWidget("ScenariosHorizontalLayout");
49
50 foreach (int i, ResourceName mission : missions)
51 {
52 Widget w = GetGame().GetWorkspace().CreateWidgets(TILES_LAYOUT, scenarioWidgetParent);
53 if (!w)
54 continue;
55
57 if (!tile)
58 continue;
59
60 if (i == 0)
61 AlignableSlot.SetPadding(w, 0, 0, 0, 0);
62
64
65 tile.ShowMission(item);
66 if (tile.UpdateCampaignButtons())
67 {
68 Widget focusWidget = w.GetChildren();
69 if (focusWidget)
70 GetGame().GetWorkspace().SetFocusedWidget(focusWidget);
71 }
72
73 if (isContentDisabled)
74 tile.DisableTile();
75 }
76 }
77}
ArmaReforgerScripted GetGame()
Definition game.c:1398
Widget GetRootWidget()
proto native void Close()
SCR_DynamicFooterComponent m_DynamicFooter
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
override void OnMenuOpen()
const ResourceName CONFIG
const ResourceName TILES_LAYOUT
void PrepareTiles(bool isContentDisabled=false)
override void ShowMission(notnull MissionWorkshopItem item, bool showRecommended=false)
static MissionWorkshopItem GetInGameScenario(ResourceName resource)
SCR_SuperMenuComponent m_SuperMenuComponent
EPlatform
Definition EPlatform.c:13