Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MenuNavigationHeaderComponent.c
Go to the documentation of this file.
3{
4 [Attribute("0")]
5 bool m_bIsSelected;
6
7 [Attribute("")]
8 string m_sTitle;
9
10 [Attribute("-1", UIWidgets.SearchComboBox, "", "", ParamEnumArray.FromEnum(ChimeraMenuPreset))]
11 ChimeraMenuPreset m_eMenuPreset;
12}
13
14class SCR_MenuNavigationHeaderComponent: SCR_ScriptedWidgetComponent
15{
16 protected static const ResourceName ENTRY_LAYOUT = "{04A28F3B36FE0F9A}UI/layouts/Menus/ContentBrowser/ScenariosMenu/HeaderNavigationEntry.layout";
17
19
20 [Attribute()]
21 protected ref array<ref SCR_MenuNavigationItem> m_aItems;
22
23 protected int m_iSelectedId;
24
25 //------------------------------------------------------------------------------------------------
26 override void HandlerAttached(Widget w)
27 {
28 super.HandlerAttached(w);
29
30 m_Widgets.Init(w);
31
32 // create widget
33 Widget itemWidget;
35 SCR_ButtonTextComponent NavButtonComp;
36 foreach(int id, SCR_MenuNavigationItem item: m_aItems)
37 {
38 itemWidget = GetGame().GetWorkspace().CreateWidgets(ENTRY_LAYOUT, m_Widgets.m_wHorizontalItems);
39 NavItemComp = SCR_MenuNavigationItemComponent.Cast(itemWidget.FindHandler(SCR_MenuNavigationItemComponent));
40 NavItemComp.Init(item.m_eMenuPreset, item.m_sTitle, item.m_bIsSelected);
41
42 if (!item.m_bIsSelected)
43 {
44 NavButtonComp = SCR_ButtonTextComponent.Cast(itemWidget.FindHandler(SCR_ButtonTextComponent));
45 NavButtonComp.m_OnClicked.Insert(OnClickedEntry);
46 }
47 else
49 }
50
51 // if its the first entry
52 if (m_iSelectedId == 0)
53 DisableNavButton(m_Widgets.m_NavButtonLeftComponent);
54 else
55 m_Widgets.m_NavButtonLeftComponent.m_OnActivated.Insert(OnPrevMenu);
56
57 // if its the last entry
58 if (m_iSelectedId == m_aItems.Count() - 1)
59 DisableNavButton(m_Widgets.m_NavButtonRightComponent);
60 else
61 m_Widgets.m_NavButtonRightComponent.m_OnActivated.Insert(OnNextMenu);
62 }
63
64 //------------------------------------------------------------------------------------------------
66 {
67 Widget root = comp.GetRootWidget();
69 OnOpenMenu(NavItemComp.GetMenuPreset());
70 }
71
72 //------------------------------------------------------------------------------------------------
73 protected void OnNextMenu()
74 {
76 OnOpenMenu(item.m_eMenuPreset);
77 }
78
79 //------------------------------------------------------------------------------------------------
80 protected void OnPrevMenu()
81 {
83 OnOpenMenu(item.m_eMenuPreset);
84 }
85
86 //------------------------------------------------------------------------------------------------
87 protected void OnOpenMenu(ChimeraMenuPreset menuToOpen)
88 {
89 GetGame().GetMenuManager().CloseMenu(GetGame().GetMenuManager().GetTopMenu());
90 GetGame().GetMenuManager().OpenMenu(menuToOpen);
91 }
92
93 //------------------------------------------------------------------------------------------------
94 protected void DisableNavButton(notnull SCR_InputButtonComponent comp)
95 {
96 Widget root = comp.GetRootWidget();
97
98 comp.SetEnabled(false);
99 root.SetEnabled(false);
100 root.SetOpacity(UIConstants.DISABLED_WIDGET_OPACITY);
101 }
102}
AddonBuildInfoTool id
ChimeraMenuPreset
Menu presets.
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
void OnClickedEntry(SCR_ButtonTextComponent comp)
class SCR_MenuNavigationItem ENTRY_LAYOUT
ref array< ref SCR_MenuNavigationItem > m_aItems
void DisableNavButton(notnull SCR_InputButtonComponent comp)
void OnOpenMenu(ChimeraMenuPreset menuToOpen)
ref SCR_HeaderNavigationWidgets m_Widgets
void Init(ChimeraMenuPreset menuId, string title, bool isSelected=false)
SCR_FieldOfViewSettings Attribute