Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SimpleMessageComponent.c
Go to the documentation of this file.
2{
3 [Attribute()]
4 protected string m_sImageWidgetName;
5
6 [Attribute()]
7 protected string m_sTitleWidgetName;
8
9 [Attribute()]
10 protected string m_sDescriptionWidgetName;
11
12 [Attribute("Loading")]
13 protected string m_sLoadingName;
14
15 [Attribute()]
16 protected string m_sDefaultPreset;
17
18 [Attribute()]
20
24 protected Widget m_wLoading;
25
26 protected Widget m_wRoot;
27
28 //----------------------------------------------------------------------------------
29 protected override void HandlerAttached(Widget w)
30 {
31 m_wRoot = w;
32
33 if (!m_sImageWidgetName.IsEmpty())
34 m_wImage = ImageWidget.Cast(w.FindAnyWidget(m_sImageWidgetName));
35
36 if (!m_sTitleWidgetName.IsEmpty())
37 m_wTitle = TextWidget.Cast(w.FindAnyWidget(m_sTitleWidgetName));
38
39 if (!m_sDescriptionWidgetName.IsEmpty())
40 m_wDescription = TextWidget.Cast(w.FindAnyWidget(m_sDescriptionWidgetName));
41
42 if (!m_sLoadingName.IsEmpty())
43 m_wLoading = w.FindAnyWidget(m_sLoadingName);
44
46 }
47
48 //----------------------------------------------------------------------------------
53 void SetContentFromPreset(string presetTag)
54 {
55 if (!m_aContentPresets || presetTag.IsEmpty())
56 return;
57
58 SCR_SimpleMessagePreset preset = m_aContentPresets.GetPreset(presetTag);
59
60 if (!preset)
61 return;
62
63 if (!preset.m_UIInfo)
64 return;
65
66 SetContentFromPreset(preset.m_UIInfo);
67 }
68
69 //----------------------------------------------------------------------------------
72 {
73 array<Widget> mainWidgets = {m_wImage, m_wTitle, m_wDescription};
74 bool loading = uiInfo.GetDisplayLoading();
75 foreach (Widget w : mainWidgets)
76 {
77 if (w)
78 w.SetVisible(!loading);
79 }
80
81 if (m_wLoading)
82 m_wLoading.SetVisible(loading);
83
84 if (loading)
85 {
86 if (m_wLoading)
87 {
89 if (loadingComp)
90 {
91 if (!uiInfo.GetName().IsEmpty())
92 loadingComp.SetText(uiInfo.GetName());
93 else if (!uiInfo.GetDescription().IsEmpty())
94 loadingComp.SetText(uiInfo.GetDescription());
95 }
96 }
97 }
98 else
99 {
100 if (m_wImage)
101 {
102 if (uiInfo.HasIcon())
103 {
104 m_wImage.SetColor(uiInfo.GetImageColor());
105 uiInfo.SetIconTo(m_wImage);
106 m_wImage.SetVisible(true);
107 }
108 else
109 {
110 m_wImage.SetVisible(false);
111 }
112 }
113
114 if (m_wTitle)
115 {
116 if (!uiInfo.GetName().IsEmpty())
117 {
118 uiInfo.SetNameTo(m_wTitle);
119 m_wTitle.SetVisible(true);
120 }
121 else
122 {
123 m_wTitle.SetVisible(false);
124 }
125 }
126
127 if (m_wDescription)
128 {
129 if (!uiInfo.GetName().IsEmpty())
130 {
131 uiInfo.SetDescriptionTo(m_wDescription);
132 m_wDescription.SetVisible(true);
133 }
134 else
135 {
136 m_wDescription.SetVisible(false);
137 }
138 }
139 }
140 }
141
142 //----------------------------------------------------------------------------------
144 {
145 return m_wRoot;
146 }
147
148 //----------------------------------------------------------------------------------
149 void SetVisible(bool visible)
150 {
151 if (m_wRoot)
152 {
153 m_wRoot.SetVisible(visible);
154 m_wRoot.Update();
155 }
156 }
157};
158
161{
162 [Attribute(desc: "The ID of the Preset used to set the correct visual information")]
163 string m_sTag;
164
165 [Attribute()]
166 ref SCR_SimpleMessageUIInfo m_UIInfo;
167};
168
169[BaseContainerProps(configRoot: true)]
171{
172 [Attribute()]
173 ref array<ref SCR_SimpleMessagePreset> m_aPresets;
174
175 //----------------------------------------------------------------------------------
176 SCR_SimpleMessagePreset GetPreset(string tag)
177 {
178 foreach (SCR_SimpleMessagePreset preset : m_aPresets)
179 {
180 if (preset.m_sTag == tag)
181 return preset;
182 }
183
184 Print(string.Format("SCR_SimpleMessagePresets: preset not found: %1", tag), LogLevel.ERROR);
185 return null;
186 }
187};
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void SetText(string text)
override void HandlerAttached(Widget w)
void SetContentFromPreset(SCR_SimpleMessageUIInfo uiInfo)
Sets content from preset provided externally.
ref SCR_SimpleMessagePresets m_aContentPresets
void SetContentFromPreset(string presetTag)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute