5 protected Widget m_SettingsRoot;
6 protected Widget m_DetailsRoot;
7 protected Widget m_DetailsBodyDefault;
8 protected Widget m_DetailsBodyConnectivity;
13 protected OptionsMenu
m_Menu;
15 #ifdef PLATFORM_CONSOLE
17 protected ref OptionSelectorMultistate m_FlipModeSelector;
21 protected ref OptionSelectorMultistate m_OverallQualitySelector;
24 protected ref OptionSelectorMultistate m_DisplayModeSelector;
25 protected ref OptionSelectorMultistate m_ResolutionSelector;
26 protected ref OptionSelectorSlider m_BrightnessSelector;
27 protected ref OptionSelectorMultistate m_VSyncSelector;
31 protected ref OptionSelectorMultistate m_ObjectDetailSelector;
32 protected ref OptionSelectorMultistate m_TerrainDetailSelector;
33 protected ref OptionSelectorMultistate m_TextureDetailSelector;
34 protected ref OptionSelectorMultistate m_ShadowDetailSelector;
37 protected ref OptionSelectorMultistate m_TextureFilteringSelector;
38 protected ref OptionSelectorMultistate m_TerrainSurfaceDetailSelector;
39 protected ref OptionSelectorMultistate m_PPAASelector;
40 protected ref OptionSelectorMultistate m_HWAASelector;
41 protected ref OptionSelectorMultistate m_ATOCSelector;
42 protected ref OptionSelectorMultistate m_AOSelector;
43 protected ref OptionSelectorMultistate m_PPQualitySelector;
44 protected ref OptionSelectorMultistate m_SSRQualitySelector;
47 #ifdef PLATFORM_CONSOLE
49 protected ref ListOptionsAccess m_FlipModeOption;
53 protected ref ListOptionsAccess m_OverallQualityOption;
56 protected ref ListOptionsAccess m_DisplayModeOption;
57 protected ref ListOptionsAccess m_ResolutionOption;
58 protected ref NumericOptionsAccess m_BrightnessOption;
59 protected ref ListOptionsAccess m_VSyncOption;
63 protected ref ListOptionsAccess m_ObjectDetailOption;
64 protected ref ListOptionsAccess m_TerrainDetailOption;
65 protected ref ListOptionsAccess m_TextureDetailOption;
66 protected ref ListOptionsAccess m_ShadowDetailOption;
69 protected ref ListOptionsAccess m_TextureFilteringOption;
70 protected ref ListOptionsAccess m_TerrainSurfaceDetailOption;
71 protected ref ListOptionsAccess m_PPAAOption;
72 protected ref ListOptionsAccess m_HWAAOption;
73 protected ref ListOptionsAccess m_ATOCOption;
74 protected ref ListOptionsAccess m_AOOption;
75 protected ref ListOptionsAccess m_PPQualityOption;
76 protected ref ListOptionsAccess m_SSRQualityOption;
83 m_Root =
GetGame().GetWorkspace().CreateWidgets( GetLayoutName(), parent );
85 m_DetailsRoot = details_root;
86 m_DetailsBodyDefault = m_DetailsRoot.FindAnyWidget(
"settings_details_body");
87 m_DetailsBodyConnectivity = m_DetailsRoot.FindAnyWidget(
"settings_details_body_connectivity");
88 m_DetailsLabel =
TextWidget.Cast( m_DetailsRoot.FindAnyWidget(
"details_label" ) );
89 m_DetailsText =
RichTextWidget.Cast( m_DetailsRoot.FindAnyWidget(
"details_content" ) );
91 SetOptions( options );
94 #ifdef PLATFORM_CONSOLE
99 m_Root.FindAnyWidget(
"overall_quality_setting_option" ).SetUserID(
OptionAccessType.AT_QUALITY_PREFERENCE );
100 m_Root.FindAnyWidget(
"display_mode_setting_option" ).SetUserID(
OptionAccessType.AT_OPTIONS_DISPLAY_MODE );
102 m_Root.FindAnyWidget(
"brightness_setting_option" ).SetUserID(
OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER );
114 m_Root.FindAnyWidget(
"terrain_surface_detail_setting_option" ).SetUserID(
OptionAccessType.AT_OPTIONS_TERRAIN_SHADER );
129 m_Root.FindAnyWidget(
"video_settings_scroll" ).GetScreenSize(
x,
y );
130 m_Root.FindAnyWidget(
"video_settings_root" ).GetScreenSize(
x, y2 );
132 m_Root.FindAnyWidget(
"video_settings_scroll" ).SetAlpha( f );
134 m_Root.SetHandler(
this );
137 void ~OptionsMenuVideo()
144 #ifdef PLATFORM_CONSOLE
146 array<string> opt1 = {
"#STR_ENABLED",
"#STR_DISABLED",
"#STR_SELECTIVE" };
147 m_FlipModeSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"vsync_setting_option" ), m_FlipModeOption.GetIndex(),
this,
false, opt1 );
150 array<string> opt1 = {
"#options_controls_disabled",
"#options_controls_enabled" };
151 array<string> opt2 = {
"#options_video_fullscreen",
"#options_video_windowed" };
152 array<string> opt3 = {
"#options_video_low",
"#options_video_medium",
"#options_video_high" };
153 array<string> opt4 = {
"#options_video_poor",
"#options_video_low",
"#options_video_medium",
"#options_video_high",
"#options_video_extreme" };
154 array<string> opt41 = {
"#options_video_low",
"#options_video_medium",
"#options_video_high",
"#options_video_extreme" };
155 array<string> opt5 = {
"#options_video_poor",
"#options_video_low",
"#options_video_medium",
"#options_video_high",
"#options_video_extreme",
"#options_video_custom" };
156 array<string> opt6 = {
"#options_controls_disabled",
"#options_video_low",
"#options_video_medium",
"#options_video_high",
"#options_video_extreme" };
157 array<string> opt7 = {
"#options_controls_disabled",
"#options_video_low",
"#options_video_medium",
"#options_video_high" };
159 array<string> opt9 = {
"#options_controls_disabled",
"#options_video_low",
"#options_video_high" };
161 for (
int i = 0; i < m_ResolutionOption.GetItemsCount(); i++ )
164 m_ResolutionOption.GetItemText( i, opt_text );
165 opt8.Insert( opt_text );
169 m_OverallQualitySelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"overall_quality_setting_option" ), m_OverallQualityOption.GetIndex(),
this,
false, opt5 );
172 m_DisplayModeSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"display_mode_setting_option" ), m_DisplayModeOption.GetIndex(),
this,
false, opt2 );
173 m_ResolutionSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"resolution_setting_option" ), m_ResolutionOption.GetIndex(),
this,
false, opt8 );
174 m_BrightnessSelector =
new OptionSelectorSlider(
m_Root.FindAnyWidget(
"brightness_setting_option" ), m_BrightnessOption.ReadValue(),
this,
false, m_BrightnessOption.GetMin(), m_BrightnessOption.GetMax() );
175 m_VSyncSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"vsync_setting_option" ), m_VSyncOption.GetIndex(),
this,
false, opt1 );
179 m_ObjectDetailSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"object_detail_setting_option" ), m_ObjectDetailOption.GetIndex(),
this,
false, opt4 );
180 m_TerrainDetailSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"terrain_detail_setting_option" ), m_TerrainDetailOption.GetIndex(),
this,
false, opt4 );
181 m_TextureDetailSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"texture_detail_setting_option" ), m_TextureDetailOption.GetIndex(),
this,
false, opt4 );
182 m_ShadowDetailSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"shadow_detail_setting_option" ), m_ShadowDetailOption.GetIndex(),
this,
false, opt4 );
185 m_TextureFilteringSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"texture_filtering_setting_option" ), m_TextureFilteringOption.GetIndex(),
this,
false, opt3 );
186 m_TerrainSurfaceDetailSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"terrain_surface_detail_setting_option" ), m_TerrainSurfaceDetailOption.GetIndex(),
this,
false, opt41 );
188 m_PPAASelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"ppaa_setting_option" ), m_PPAAOption.GetIndex(),
this,
false, opt6 );
189 m_HWAASelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"hwaa_setting_option" ), m_HWAAOption.GetIndex(),
this,
false, opt7 );
190 m_ATOCSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"atoc_setting_option" ), m_ATOCOption.GetIndex(),
this,
false, opt1 );
191 m_AOSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"ao_setting_option" ), m_AOOption.GetIndex(),
this,
false, opt6 );
192 m_PPQualitySelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"pp_setting_option" ), m_PPQualityOption.GetIndex(),
this,
false, opt3 );
193 m_SSRQualitySelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"ssr_setting_option" ), m_SSRQualityOption.GetIndex(),
this,
false, opt9 );
196 #ifdef PLATFORM_CONSOLE
198 m_FlipModeSelector.m_OptionChanged.Insert( OnFlipModeChanged );
202 m_OverallQualitySelector.m_OptionChanged.Insert( OnOverallQualityChanged );
205 m_DisplayModeSelector.m_OptionChanged.Insert( OnDisplayModeChanged );
206 m_ResolutionSelector.m_OptionChanged.Insert( OnResolutionChanged );
207 m_BrightnessSelector.m_OptionChanged.Insert( OnBrightnessChanged );
208 m_VSyncSelector.m_OptionChanged.Insert( OnVSyncChanged );
212 m_ObjectDetailSelector.m_OptionChanged.Insert( OnObjectDetailChanged );
213 m_TerrainDetailSelector.m_OptionChanged.Insert( OnTerrainDetailChanged );
214 m_TextureDetailSelector.m_OptionChanged.Insert( OnTextureDetailChanged );
215 m_ShadowDetailSelector.m_OptionChanged.Insert( OnShadowDetailChanged );
218 m_TextureFilteringSelector.m_OptionChanged.Insert( OnTextureFilteringChanged );
219 m_TerrainSurfaceDetailSelector.m_OptionChanged.Insert( OnTerrainSurfaceDetailChanged );
220 m_PPAASelector.m_OptionChanged.Insert( OnPPAAChanged );
221 m_HWAASelector.m_OptionChanged.Insert( OnHWAAChanged );
222 m_ATOCSelector.m_OptionChanged.Insert( OnATOCChanged );
223 m_AOSelector.m_OptionChanged.Insert( OnAOChanged );
224 m_PPQualitySelector.m_OptionChanged.Insert( OnPPQualityChanged );
225 m_SSRQualitySelector.m_OptionChanged.Insert( OnSSRQualityChanged );
229 string GetLayoutName()
232 return "gui/layouts/new_ui/options/ps/video_tab.layout";
234 #ifdef PLATFORM_WINDOWS
235 return "gui/layouts/new_ui/options/pc/video_tab.layout";
243 if (m_FlipModeSelector)
245 SetFocus( m_FlipModeSelector.GetParent() );
267 #ifndef PLATFORM_CONSOLE
268 m_DisplayModeSelector.SetValue( m_DisplayModeOption.GetIndex(),
false );
269 m_ResolutionSelector.SetValue( m_ResolutionOption.GetIndex(),
false );
270 m_BrightnessSelector.SetValue( m_BrightnessOption.ReadValue(),
false );
271 m_VSyncSelector.SetValue( m_VSyncOption.GetIndex(),
false );
273 m_OverallQualitySelector.SetValue( m_OverallQualityOption.GetIndex(),
false );
277 #ifndef PLATFORM_CONSOLE
278 m_OverallQualitySelector.SetValue( m_OverallQualityOption.GetIndex(),
false );
284 #ifdef PLATFORM_CONSOLE
286 m_FlipModeSelector.SetValue( m_FlipModeOption.GetDefaultIndex(),
false );
289 m_DisplayModeSelector.SetValue( m_DisplayModeOption.GetDefaultIndex(),
false );
290 m_ResolutionSelector.SetValue( m_ResolutionOption.GetDefaultIndex(),
false );
291 m_BrightnessSelector.SetValue( m_BrightnessOption.GetDefault(),
false );
292 m_VSyncSelector.SetValue( m_VSyncOption.GetDefaultIndex(),
false );
293 int idx = m_OverallQualityOption.GetDefaultIndex();
294 m_OverallQualitySelector.SetValue( m_OverallQualityOption.GetDefaultIndex(),
true );
305 #ifdef PLATFORM_CONSOLE
307 m_FlipModeOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_FLIPMODE ) );
311 m_OverallQualityOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_QUALITY_PREFERENCE ) );
314 m_DisplayModeOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_DISPLAY_MODE ) );
315 m_ResolutionOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_RESOLUTION ) );
316 m_BrightnessOption = NumericOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER ) );
317 m_VSyncOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_VSYNC_VALUE ) );
321 m_ObjectDetailOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_OBJECTS_DETAIL ) );
322 m_TerrainDetailOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_TERRAIN ) );
323 m_TextureDetailOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_TEXTURE_DETAIL ) );
324 m_ShadowDetailOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_SHADOW_DETAIL ) );
327 m_TextureFilteringOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_ANISO_DETAIL ) );
328 m_TerrainSurfaceDetailOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_TERRAIN_SHADER ) );
330 m_PPAAOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_FXAA_VALUE ) );
331 m_HWAAOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_FSAA_DETAIL ) );
332 m_ATOCOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_ATOC_DETAIL ) );
333 m_AOOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_AMBIENT_OCCLUSION ) );
334 m_PPQualityOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_POSTPROCESS_EFFECTS ) );
335 m_SSRQualityOption = ListOptionsAccess.Cast( m_Options.GetOptionByType(
OptionAccessType.AT_WATER_DETAIL ) );
339 void ToggleDependentOptions(
int mode,
bool state)
343 void InitDependentOptionsVisibility()
349 #ifdef PLATFORM_CONSOLE
351 m_FlipModeSelector.SetValue( m_FlipModeOption.GetIndex(),
false );
355 m_ObjectDetailSelector.SetValue( m_ObjectDetailOption.GetIndex(),
false );
356 m_TerrainDetailSelector.SetValue( m_TerrainDetailOption.GetIndex(),
false );
357 m_TextureDetailSelector.SetValue( m_TextureDetailOption.GetIndex(),
false );
358 m_ShadowDetailSelector.SetValue( m_ShadowDetailOption.GetIndex(),
false );
361 m_TextureFilteringSelector.SetValue( m_TextureFilteringOption.GetIndex(),
false );
362 m_TerrainSurfaceDetailSelector.SetValue( m_TerrainSurfaceDetailOption.GetIndex(),
false );
363 m_PPAASelector.SetValue( m_PPAAOption.GetIndex(),
false );
364 m_HWAASelector.SetValue( m_HWAAOption.GetIndex(),
false );
365 if ( m_HWAAOption.GetIndex() == 0 )
367 m_ATOCSelector.Disable();
371 m_ATOCSelector.Enable();
373 m_ATOCSelector.SetValue( m_ATOCOption.GetIndex(),
false );
374 m_AOSelector.SetValue( m_AOOption.GetIndex(),
false );
375 m_PPQualitySelector.SetValue( m_PPQualityOption.GetIndex(),
false );
376 m_SSRQualitySelector.SetValue( m_SSRQualityOption.GetIndex(),
false );
382 if ( w && w.IsInherited( ScrollWidget ) )
387 m_Menu.ColorHighlight( w );
394 if ( w && w.IsInherited( ScrollWidget ) )
403 void OnOptionChanged()
405 #ifndef PLATFORM_CONSOLE
406 if ( m_OverallQualityOption.GetIndex() != 5 )
408 m_OverallQualitySelector.SetValue( 5 );
413 #ifdef PLATFORM_CONSOLE
415 void OnFlipModeChanged(
int value )
417 m_FlipModeOption.SetIndex( value );
423 void OnOverallQualityChanged(
int value )
425 m_OverallQualityOption.SetIndex( value );
426 m_OverallQualityOption.Test();
433 m_OverallQualityOption.SetIndex( value );
438 void OnDisplayModeChanged(
int value )
440 m_DisplayModeOption.SetIndex( value );
444 void OnResolutionChanged(
int value )
446 m_ResolutionOption.SetIndex( value );
450 void OnBrightnessChanged(
float value )
452 m_BrightnessOption.WriteValue( value );
456 void OnVSyncChanged(
float value )
458 m_VSyncOption.SetIndex( value );
462 void OnColorDepthChanged(
int value )
468 void OnObjectDetailChanged(
int value )
470 m_ObjectDetailOption.SetIndex( value );
475 void OnTerrainDetailChanged(
int value )
477 m_TerrainDetailOption.SetIndex( value );
482 void OnTextureDetailChanged(
int value )
484 m_TextureDetailOption.SetIndex( value );
489 void OnShadowDetailChanged(
int value )
491 m_ShadowDetailOption.SetIndex( value );
496 void OnTextureFilteringChanged(
int value )
498 m_TextureFilteringOption.SetIndex( value );
503 void OnTerrainSurfaceDetailChanged(
int value )
505 m_TerrainSurfaceDetailOption.SetIndex( value );
510 void OnPPAAChanged(
int value )
512 m_PPAAOption.SetIndex( value );
517 void OnHWAAChanged(
int value )
519 m_HWAAOption.SetIndex( value );
522 m_ATOCSelector.Disable();
526 m_ATOCSelector.Enable();
532 void OnATOCChanged(
int value )
534 m_ATOCOption.SetIndex( value );
539 void OnAOChanged(
int value )
541 m_AOOption.SetIndex( value );
546 void OnPPQualityChanged(
int value )
548 m_PPQualityOption.SetIndex( value );
553 void OnSSRQualityChanged(
int value )
555 m_SSRQualityOption.SetIndex( value );
563 OptionsMenu menu = OptionsMenu.Cast(
GetGame().GetUIManager().GetMenu() );
565 menu.OnFocus( w,
x,
y );
568 if (TextMapUpdateWidget(w.GetUserID()))
573 if ( w.IsInherited( SliderWidget ) )
578 m_DetailsRoot.Show(
false );
579 return ( w !=
null );
582 bool TextMapUpdateWidget(
int key)
584 bool connectivityInfoShown = key ==
OptionIDsScript.OPTION_CONNECTIVITY_INFO;
586 Param tmp = m_TextMap.Get(key);
588 m_DetailsBodyDefault.Show(!connectivityInfoShown);
589 m_DetailsBodyConnectivity.Show(connectivityInfoShown);
591 if (
Class.CastTo(p,tmp))
593 m_DetailsRoot.Show(
true);
594 m_DetailsText.Show(
true);
595 m_DetailsLabel.SetText(p.param1);
596 m_DetailsText.SetText(p.param2);
598 m_DetailsText.Update();
599 m_DetailsLabel.Update();
600 m_DetailsRoot.Update();
601 m_DetailsBodyConnectivity.Update();
611 #ifdef PLATFORM_CONSOLE