5 protected Widget m_SettingsRoot;
6 protected Widget m_DetailsRoot;
7 protected Widget m_DetailsBodyDefault;
8 protected Widget m_DetailsBodyConnectivity;
12 protected ref NumericOptionsAccess m_MasterOption;
13 protected ref NumericOptionsAccess m_EffectsOption;
14 protected ref NumericOptionsAccess m_VOIPOption;
15 protected ref NumericOptionsAccess m_VOIPThresholdOption;
16 protected ref NumericOptionsAccess m_MusicOption;
17 protected ref ListOptionsAccess m_InputModeOption;
19 protected ref OptionSelectorSlider m_MasterSelector;
20 protected ref OptionSelectorSlider m_EffectsSelector;
21 protected ref OptionSelectorSlider m_VOIPSelector;
22 protected ref OptionSelectorLevelMarker m_VOIPThresholdSelector;
23 protected ref OptionSelectorSlider m_MusicSelector;
24 protected ref OptionSelectorMultistate m_InputModeSelector;
26 protected ref
Timer m_AudioLevelTimer;
28 protected OptionsMenu
m_Menu;
29 protected MissionGameplay m_MissionGameplay;
34 private bool m_WasMicCapturing;
38 m_Root =
GetGame().GetWorkspace().CreateWidgets(GetLayoutName(), parent);
39 m_DetailsRoot = details_root;
40 m_DetailsBodyDefault = m_DetailsRoot.FindAnyWidget(
"settings_details_body");
41 m_DetailsBodyConnectivity = m_DetailsRoot.FindAnyWidget(
"settings_details_body_connectivity");
42 m_DetailsLabel =
TextWidget.Cast( m_DetailsRoot.FindAnyWidget(
"details_label"));
43 m_DetailsText =
RichTextWidget.Cast( m_DetailsRoot.FindAnyWidget(
"details_content"));
47 m_MasterOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_MASTER_VOLUME));
48 m_EffectsOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_EFFECTS_SLIDER));
49 m_MusicOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_MUSIC_SLIDER));
50 m_VOIPOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_VON_SLIDER));
51 m_VOIPThresholdOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_VON_THRESHOLD_SLIDER));
52 m_InputModeOption = ListOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_VON_INPUT_MODE));
54 m_MissionGameplay = MissionGameplay.Cast(
GetGame().GetMission());
56 m_AudioLevelTimer =
new Timer();
57 m_AudioLevelTimer.Run(0.1,
this,
"UpdateAudioLevel", NULL,
true);
63 m_Root.FindAnyWidget(
"voip_threshold_setting_option" ).SetUserID(
OptionAccessType.AT_OPTIONS_VON_THRESHOLD_SLIDER);
64 m_Root.FindAnyWidget(
"voip_selection_setting_option" ).SetUserID(
OptionAccessType.AT_OPTIONS_VON_INPUT_MODE);
68 array<string> inputModeValues = {
"#STR_Controls_PushToTalk",
"#STR_USRACT_UAVOICEOVERNETTOGGLE" };
70 m_MasterSelector =
new OptionSelectorSlider(
m_Root.FindAnyWidget(
"master_setting_option" ), m_MasterOption.ReadValue(),
this,
false, m_MasterOption.GetMin(), m_MasterOption.GetMax());
71 m_EffectsSelector =
new OptionSelectorSlider(
m_Root.FindAnyWidget(
"effects_setting_option" ), m_EffectsOption.ReadValue(),
this,
false, m_EffectsOption.GetMin(), m_EffectsOption.GetMax());
72 m_VOIPSelector =
new OptionSelectorSlider(
m_Root.FindAnyWidget(
"voip_output_setting_option" ), m_VOIPOption.ReadValue(),
this,
false, m_VOIPOption.GetMin(), m_VOIPOption.GetMax());
73 m_VOIPThresholdSelector =
new OptionSelectorLevelMarker(
m_Root.FindAnyWidget(
"voip_threshold_setting_option" ), m_VOIPThresholdOption.ReadValue(),
this,
false, m_VOIPThresholdOption.GetMin(), m_VOIPThresholdOption.GetMax());
74 m_MusicSelector =
new OptionSelectorSlider(
m_Root.FindAnyWidget(
"music_setting_option" ), m_MusicOption.ReadValue(),
this,
false, m_MusicOption.GetMin(), m_MusicOption.GetMax());
75 m_InputModeSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"voip_selection_setting_option" ), m_InputModeOption.GetIndex(),
this,
false, inputModeValues);
77 m_MasterSelector.m_OptionChanged.Insert(UpdateMaster);
78 m_EffectsSelector.m_OptionChanged.Insert(UpdateEffects);
79 m_VOIPSelector.m_OptionChanged.Insert(UpdateVOIP);
80 m_VOIPThresholdSelector.m_OptionChanged.Insert(UpdateVOIPThreshold);
81 m_MusicSelector.m_OptionChanged.Insert(
UpdateMusic);
82 m_InputModeSelector.m_OptionChanged.Insert(UpdateInputMode);
84 if (m_MissionGameplay)
87 m_VOIPThresholdOption.GetEvents().Event_OnRevert.Insert(m_VonManager.OnVOIPThresholdChanged);
88 m_VonManager.m_OnVonStateEvent.Insert(OnVonStateEvent);
89 m_VonManager.m_OnPartyChatChangedEvent.Insert(OnPartyChatChangedEvent);
90 m_VOIPThresholdSelector.m_OptionChanged.Insert(m_VonManager.OnVOIPThresholdChanged);
94 m_Root.FindAnyWidget(
"sound_settings_scroll").GetScreenSize(
x,
y);
95 m_Root.FindAnyWidget(
"sound_settings_root").GetScreenSize(
x, y2);
97 m_Root.FindAnyWidget(
"sound_settings_scroll").SetAlpha(f);
102 m_WasMicCapturing = game.IsMicCapturing();
105 if (!game.IsInPartyChat())
107 game.EnableMicCapture(
true);
111 void ~OptionsMenuSounds()
113 m_VonManager.m_OnVonStateEvent.Remove(OnVonStateEvent);
114 m_VonManager.m_OnPartyChatChangedEvent.Remove(OnPartyChatChangedEvent);
116 if (m_MissionGameplay)
119 GetGame().EnableMicCapture(m_WasMicCapturing);
122 m_AudioLevelTimer.Stop();
125 string GetLayoutName()
127 #ifdef PLATFORM_CONSOLE
128 return "gui/layouts/new_ui/options/xbox/sound_tab.layout";
130 #ifdef PLATFORM_WINDOWS
131 return "gui/layouts/new_ui/options/pc/sound_tab.layout";
138 #ifdef PLATFORM_CONSOLE
139 SetFocus(m_MasterSelector.GetParent());
145 if ( w && w.IsInherited(ScrollWidget))
157 if ( w && w.IsInherited(ScrollWidget))
168 OptionsMenu menu = OptionsMenu.Cast(
GetGame().GetUIManager().GetMenu());
171 menu.OnFocus(w,
x,
y);
175 if (TextMapUpdateWidget(w.GetUserID()))
180 if (w.IsInherited(SliderWidget))
185 m_DetailsRoot.Show(
false);
189 bool TextMapUpdateWidget(
int key)
191 bool connectivityInfoShown = key ==
OptionIDsScript.OPTION_CONNECTIVITY_INFO;
193 Param tmp = m_TextMap.Get(key);
195 m_DetailsBodyDefault.Show(!connectivityInfoShown);
196 m_DetailsBodyConnectivity.Show(connectivityInfoShown);
198 if (
Class.CastTo(p,tmp))
200 m_DetailsRoot.Show(
true);
201 m_DetailsText.Show(
true);
202 m_DetailsLabel.SetText(p.param1);
203 m_DetailsText.SetText(p.param2);
205 m_DetailsText.Update();
206 m_DetailsLabel.Update();
207 m_DetailsRoot.Update();
208 m_DetailsBodyConnectivity.Update();
214 void OnVonStateEvent()
218 if (!
GetGame().IsInPartyChat())
221 GetGame().EnableMicCapture(
true);
224 UpdateWasMicCapturing();
227 void OnPartyChatChangedEvent()
230 if (!game.IsInPartyChat())
232 game.EnableMicCapture(
true);
235 UpdateWasMicCapturing();
239 void UpdateWasMicCapturing()
244 m_WasMicCapturing =
false;
250 m_WasMicCapturing = m_MissionGameplay.IsVoNActive();
268 m_MasterSelector.SetValue(m_MasterOption.ReadValue(),
true);
272 m_EffectsSelector.SetValue(m_EffectsOption.ReadValue(),
true);
276 m_VOIPSelector.SetValue(m_VOIPOption.ReadValue(),
true);
278 if (m_VOIPThresholdOption)
280 m_VOIPThresholdSelector.SetValue(m_VOIPThresholdOption.ReadValue(),
true);
284 m_MusicSelector.SetValue(m_MusicOption.ReadValue(),
true);
286 if (m_InputModeOption)
288 m_InputModeSelector.SetValue(m_InputModeOption.GetIndex(),
false);
296 m_MasterSelector.SetValue(m_MasterOption.GetDefault(),
true);
300 m_EffectsSelector.SetValue(m_EffectsOption.GetDefault(),
true);
304 m_VOIPSelector.SetValue(m_VOIPOption.GetDefault(),
true);
306 if (m_VOIPThresholdOption)
308 m_VOIPThresholdSelector.SetValue(m_VOIPThresholdOption.GetDefault(),
true);
312 m_MusicSelector.SetValue(m_MusicOption.GetDefault(),
true);
314 if (m_InputModeOption)
316 m_InputModeOption.SetIndex(m_InputModeOption.GetDefaultIndex());
317 m_InputModeSelector.SetValue( m_InputModeOption.GetIndex(),
false );
330 m_MasterOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_MASTER_VOLUME));
331 m_EffectsOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_EFFECTS_SLIDER));
332 m_MusicOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_MUSIC_SLIDER));
333 m_VOIPOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_VON_SLIDER));
334 m_InputModeOption = ListOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_VON_INPUT_MODE));
335 m_VOIPThresholdOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_VON_THRESHOLD_SLIDER));
340 void ToggleDependentOptions(
int mode,
bool state)
344 void InitDependentOptionsVisibility()
348 void UpdateMaster(
float value)
350 m_MasterOption.WriteValue(value);
354 void UpdateEffects(
float value)
356 m_EffectsOption.WriteValue(value);
360 void UpdateVOIP(
float value)
362 m_VOIPOption.WriteValue(value);
366 void UpdateVOIPThreshold(
float value)
368 m_VOIPThresholdOption.WriteValue(value);
374 m_MusicOption.WriteValue(value);
378 void UpdateInputMode(
int newIndex)
380 m_InputModeOption.SetIndex(newIndex);
384 void UpdateAudioLevel()