Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ToolbarContextBrowserBuildingUIComponent.c
Go to the documentation of this file.
1
3{
4 [Attribute("BrowserButton")]
6
7 [Attribute()]
9
10 //------------------------------------------------------------------------------------------------
11 protected void OpenAssetBrowserButton(Widget widget, float value, EActionTrigger actionTrigger)
12 {
13 PlayerController playerController = GetGame().GetPlayerController();
14 if (!playerController)
15 return;
16
17 ChimeraCharacter char = ChimeraCharacter.Cast(playerController.GetControlledEntity());
18 if (!char)
19 return;
20
21 FactionAffiliationComponent factionComp = FactionAffiliationComponent.Cast(char.FindComponent(FactionAffiliationComponent));
22 if (!factionComp)
23 return;
24
25 SCR_CampaignFaction faction = SCR_CampaignFaction.Cast(factionComp.GetAffiliatedFaction());
26 if (!faction)
27 return;
28
29 // Get all display config data from attribute
30 bool saveBrowserState;
31 array<EEditableEntityLabel> alwaysActiveLabels = {}, whitelistLabels = {};
32 m_ContentBrowserDisplayConfig.GetAlwaysActiveLabels(alwaysActiveLabels);
33 m_ContentBrowserDisplayConfig.GetWhiteListeLabels(whitelistLabels);
34 array<EEditableEntityLabelGroup> whitelistLabelGroups = {};
35 m_ContentBrowserDisplayConfig.GetWhiteListeLabelGroups(whitelistLabelGroups);
36
37 LocalizedString browserHeader = m_ContentBrowserDisplayConfig.GetHeader();
38 saveBrowserState = m_ContentBrowserDisplayConfig.GetSaveContentBrowserState();
39
40 // Add player's current faction as always active label
41 EEditableEntityLabel factionLabel = faction.GetFactionLabel();
42 alwaysActiveLabels.Insert(factionLabel);
43
44 SCR_EditorContentBrowserDisplayConfig displayConfig = new SCR_EditorContentBrowserDisplayConfig(whitelistLabelGroups, whitelistLabels, alwaysActiveLabels, saveBrowserState, browserHeader);
45
47 if (contentBrowserManager)
48 contentBrowserManager.OpenBrowserLabelConfigInstance(displayConfig);
49 }
50
51 //------------------------------------------------------------------------------------------------
52 override void HandlerAttached(Widget w)
53 {
54 Widget buttonWidget = w.FindAnyWidget(m_sOpenContentBrowserButtonName);
55 if (buttonWidget)
56 ButtonActionComponent.GetOnAction(buttonWidget).Insert(OpenAssetBrowserButton);
57 }
58}
EEditableEntityLabel
ArmaReforgerScripted GetGame()
Definition game.c:1398
Component to execute action when the button or its shortcut is pressed.
static bool OpenBrowserLabelConfigInstance(SCR_EditorContentBrowserDisplayConfig contentBrowserConfig=null)
Load a proper config file for player faction and open an asset browser.
ref SCR_EditorContentBrowserDisplayConfig m_ContentBrowserDisplayConfig
void OpenAssetBrowserButton(Widget widget, float value, EActionTrigger actionTrigger)
SCR_FieldOfViewSettings Attribute
EActionTrigger