Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MenuTileComponent.c
Go to the documentation of this file.
2{
3 [Attribute("")]
4 protected string m_sTitle;
5
6 [Attribute("")]
7 protected string m_sDescription;
8
9 [Attribute("0.2")]
10 protected float m_fAnimationTime;
11
12 [Attribute("{C58FCC06AF13075B}UI/Textures/MissionLoadingScreens/placeholder_1.edds", UIWidgets.ResourceNamePicker, "","edds")]
14
15 [Attribute("{C58FCC06AF13075B}UI/Textures/MissionLoadingScreens/placeholder_1.edds", UIWidgets.ResourceNamePicker, "","edds")]
17
18 [Attribute("", UIWidgets.ResourceNamePicker, "", "")]
20
21 [Attribute()]
22 protected string m_sIconImage;
23
24 [Attribute("-1", UIWidgets.SearchComboBox, "", "", ParamEnumArray.FromEnum(ChimeraMenuPreset))]
26
27 [Attribute("Title")]
29
30 [Attribute("Description")]
32
33 [Attribute("ImageDefault")]
34 protected string m_sDefaultWidgetName;
35
36 [Attribute("ImageSelected")]
37 protected string m_sSelectedWidgetName;
38
39 [Attribute("Icon")]
40 protected string m_sIconImageName;
41
42 [Attribute("true")]
44
45 protected Widget m_wRoot;
51 protected float m_fAnimationRate = 10000;
52
56
57 //------------------------------------------------------------------------------------------------
58 override void HandlerAttached(Widget w)
59 {
60 m_wRoot = w;
61 m_wImageDefault = ImageWidget.Cast(w.FindAnyWidget(m_sDefaultWidgetName));
62 m_wImageSelected = ImageWidget.Cast(w.FindAnyWidget(m_sSelectedWidgetName));
63 m_wIcon = ImageWidget.Cast(w.FindAnyWidget(m_sIconImageName));
64 m_wTitle = TextWidget.Cast(w.FindAnyWidget(m_sTitleName));
65 m_wDescription = TextWidget.Cast(w.FindAnyWidget(m_sDescriptionName));
66
69 if (!m_sIconImage.IsEmpty())
71
73 m_wImageSelected.SetOpacity(0);
74
76 {
77 if (!m_sDescription.IsEmpty())
78 {
80 m_wDescription.SetOpacity(0);
81 }
82 else
83 m_wDescription.SetVisible(false);
84 }
85
86 if (m_wTitle)
87 m_wTitle.SetText(m_sTitle);
88
89 GetGame().GetCallqueue().CallLater(SetAnimationRate, SCR_WLibComponentBase.START_ANIMATION_PERIOD);
90 }
91
92 //------------------------------------------------------------------------------------------------
93 protected void SetOrHideImage(ImageWidget widget, string texture, string image)
94 {
95 if (!widget)
96 return;
97
98 bool success = SCR_WLibComponentBase.SetTexture(widget, texture, image);
99 widget.GetParent().SetVisible(success); // Hide parent widget, because it's a scale widget
100 }
101
102 //------------------------------------------------------------------------------------------------
103 private void SetAnimationRate()
104 {
105 if (m_fAnimationTime <= 0)
106 m_fAnimationRate = 1000;
107 else
109 }
110
111 //------------------------------------------------------------------------------------------------
112 override bool OnFocus(Widget w, int x, int y)
113 {
114 AnimateWidget.Opacity(m_wDescription, 1, m_fAnimationRate);
115 AnimateWidget.Opacity(m_wImageSelected, 1, m_fAnimationRate);
116 m_OnFocused.Invoke(this);
117 return false;
118 }
119
120 //------------------------------------------------------------------------------------------------
121 override bool OnFocusLost(Widget w, int x, int y)
122 {
123 AnimateWidget.Opacity(m_wDescription, 0, m_fAnimationRate);
124 AnimateWidget.Opacity(m_wImageSelected, 0, m_fAnimationRate);
125 m_OnFocusLost.Invoke(this);
126 return false;
127 }
128
129 //------------------------------------------------------------------------------------------------
130 override bool OnClick(Widget w, int x, int y, int button)
131 {
132 if (button == MouseState.RIGHT)
133 return true;
134
135 m_OnClicked.Invoke(this);
136 return false;
137 }
138
139 //------------------------------------------------------------------------------------------------
140 bool IgnoreTutorialWarning()
141 {
143 }
144
145 //------------------------------------------------------------------------------------------------
147 Widget GetRootWidget()
148 {
149 return m_wRoot;
150 }
151}
ChimeraMenuPreset
Menu presets.
ArmaReforgerScripted GetGame()
Definition game.c:1398
void OnClick()
On click callback.
Widget GetRootWidget()
void SetOrHideImage(ImageWidget widget, string texture, string image)
ref ScriptInvoker m_OnClicked
ref ScriptInvoker m_OnFocusLost
LocalizedString m_sDescriptionName
ChimeraMenuPreset m_eMenuPreset
override void HandlerAttached(Widget w)
ref ScriptInvoker m_OnFocused
Base class for all final Reforger interactive elements.
static bool SetTexture(ImageWidget widget, ResourceName texture, string image="")
static const float START_ANIMATION_PERIOD
SCR_FieldOfViewSettings Attribute
MouseState
Definition MouseState.c:13
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134