Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
optionsmenuvideo.c
Go to the documentation of this file.
1 class OptionsMenuVideo extends ScriptedWidgetEventHandler
2 {
3  protected Widget m_Root;
4 
5  protected Widget m_SettingsRoot;
6  protected Widget m_DetailsRoot;
7  protected Widget m_DetailsBodyDefault;
8  protected Widget m_DetailsBodyConnectivity;
9  protected TextWidget m_DetailsLabel;
10  protected RichTextWidget m_DetailsText;
11 
12  protected GameOptions m_Options;
13  protected OptionsMenu m_Menu;
14 
15  #ifdef PLATFORM_CONSOLE
16  #ifdef PLATFORM_PS4
17  protected ref OptionSelectorMultistate m_FlipModeSelector;
18  #endif
19  #else
20  //Overall
21  protected ref OptionSelectorMultistate m_OverallQualitySelector;
22 
23  //Screen
24  protected ref OptionSelectorMultistate m_DisplayModeSelector;
25  protected ref OptionSelectorMultistate m_ResolutionSelector;
26  protected ref OptionSelectorSlider m_BrightnessSelector;
27  protected ref OptionSelectorMultistate m_VSyncSelector;
28  //protected ref OptionSelectorMultistate m_ColorDepthSelector;
29 
30  //Scene
31  protected ref OptionSelectorMultistate m_ObjectDetailSelector;
32  protected ref OptionSelectorMultistate m_TerrainDetailSelector;
33  protected ref OptionSelectorMultistate m_TextureDetailSelector;
34  protected ref OptionSelectorMultistate m_ShadowDetailSelector;
35 
36  //Rendering
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;
45  #endif
46 
47  #ifdef PLATFORM_CONSOLE
48  #ifdef PLATFORM_PS4
49  protected ref ListOptionsAccess m_FlipModeOption;
50  #endif
51  #else
52  //Overall
53  protected ref ListOptionsAccess m_OverallQualityOption;
54 
55  //Screen
56  protected ref ListOptionsAccess m_DisplayModeOption;
57  protected ref ListOptionsAccess m_ResolutionOption;
58  protected ref NumericOptionsAccess m_BrightnessOption;
59  protected ref ListOptionsAccess m_VSyncOption;
60  //protected ref ListOptionsAccess m_ColorDepthOption;
61 
62  //Scene
63  protected ref ListOptionsAccess m_ObjectDetailOption;
64  protected ref ListOptionsAccess m_TerrainDetailOption;
65  protected ref ListOptionsAccess m_TextureDetailOption;
66  protected ref ListOptionsAccess m_ShadowDetailOption;
67 
68  //Rendering
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;
77  #endif
78 
79  protected ref map<int, ref Param2<string, string>> m_TextMap;
80 
81  void OptionsMenuVideo( Widget parent, Widget details_root, GameOptions options, OptionsMenu menu )
82  {
83  m_Root = GetGame().GetWorkspace().CreateWidgets( GetLayoutName(), parent );
84 
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" ) );
90 
91  SetOptions( options );
92  m_Menu = menu;
93 
94  #ifdef PLATFORM_CONSOLE
95  #ifdef PLATFORM_PS4
96  m_Root.FindAnyWidget( "vsync_setting_option" ).SetUserID( OptionAccessType.AT_OPTIONS_FLIPMODE );
97  #endif
98  #else
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 );
101  m_Root.FindAnyWidget( "resolution_setting_option" ).SetUserID( OptionAccessType.AT_OPTIONS_RESOLUTION );
102  m_Root.FindAnyWidget( "brightness_setting_option" ).SetUserID( OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER );
103  m_Root.FindAnyWidget( "vsync_setting_option" ).SetUserID( OptionAccessType.AT_VSYNC_VALUE );
104  //m_Root.FindAnyWidget( "color_depth_setting_option" ).SetUserID( OptionAccessType.AT_HDR_DETAIL );
105 
106  //Scene
107  m_Root.FindAnyWidget( "object_detail_setting_option" ).SetUserID( OptionAccessType.AT_OBJECTS_DETAIL );
108  m_Root.FindAnyWidget( "terrain_detail_setting_option" ).SetUserID( OptionAccessType.AT_OPTIONS_TERRAIN );
109  m_Root.FindAnyWidget( "texture_detail_setting_option" ).SetUserID( OptionAccessType.AT_TEXTURE_DETAIL );
110  m_Root.FindAnyWidget( "shadow_detail_setting_option" ).SetUserID( OptionAccessType.AT_SHADOW_DETAIL );
111 
112  //Rendering
113  m_Root.FindAnyWidget( "texture_filtering_setting_option" ).SetUserID( OptionAccessType.AT_ANISO_DETAIL );
114  m_Root.FindAnyWidget( "terrain_surface_detail_setting_option" ).SetUserID( OptionAccessType.AT_OPTIONS_TERRAIN_SHADER );
115  m_Root.FindAnyWidget( "ppaa_setting_option" ).SetUserID( OptionAccessType.AT_OPTIONS_FXAA_VALUE );
116  m_Root.FindAnyWidget( "hwaa_setting_option" ).SetUserID( OptionAccessType.AT_FSAA_DETAIL );
117  m_Root.FindAnyWidget( "atoc_setting_option" ).SetUserID( OptionAccessType.AT_ATOC_DETAIL );
118  m_Root.FindAnyWidget( "ao_setting_option" ).SetUserID( OptionAccessType.AT_AMBIENT_OCCLUSION );
119  m_Root.FindAnyWidget( "pp_setting_option" ).SetUserID( OptionAccessType.AT_POSTPROCESS_EFFECTS );
120  m_Root.FindAnyWidget( "ssr_setting_option" ).SetUserID( OptionAccessType.AT_WATER_DETAIL );
121  #endif
122 
123  FillTextMap();
124  InitSelectors();
125  RefreshCustom();
126  GetGame().BeginOptionsVideo();
127 
128  float x, y, y2;
129  m_Root.FindAnyWidget( "video_settings_scroll" ).GetScreenSize( x, y );
130  m_Root.FindAnyWidget( "video_settings_root" ).GetScreenSize( x, y2 );
131  int f = ( y2 > y );
132  m_Root.FindAnyWidget( "video_settings_scroll" ).SetAlpha( f );
133 
134  m_Root.SetHandler( this );
135  }
136 
137  void ~OptionsMenuVideo()
138  {
139  GetGame().EndOptionsVideo();
140  }
141 
142  void InitSelectors()
143  {
144  #ifdef PLATFORM_CONSOLE
145  #ifdef PLATFORM_PS4
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 );
148  #endif
149  #else
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" };
158  array<string> opt8 = new array<string>;
159  array<string> opt9 = { "#options_controls_disabled", "#options_video_low", "#options_video_high" };
160 
161  for ( int i = 0; i < m_ResolutionOption.GetItemsCount(); i++ )
162  {
163  string opt_text;
164  m_ResolutionOption.GetItemText( i, opt_text );
165  opt8.Insert( opt_text );
166  }
167 
168  //Overall
169  m_OverallQualitySelector = new OptionSelectorMultistate( m_Root.FindAnyWidget( "overall_quality_setting_option" ), m_OverallQualityOption.GetIndex(), this, false, opt5 );
170 
171  //Screen
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 );
176  //m_ColorDepthSelector = new OptionSelectorMultistate( m_Root.FindAnyWidget( "color_depth_setting_option" ), m_ColorDepthOption.GetIndex(), this, false, opt3 );
177 
178  //Scene
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 );
183 
184  //Rendering
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 );
187 
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 );
194  #endif
195 
196  #ifdef PLATFORM_CONSOLE
197  #ifdef PLATFORM_PS4
198  m_FlipModeSelector.m_OptionChanged.Insert( OnFlipModeChanged );
199  #endif
200  #else
201  //Overall
202  m_OverallQualitySelector.m_OptionChanged.Insert( OnOverallQualityChanged );
203 
204  //Screen
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 );
209  //m_ColorDepthSelector.m_OptionChanged.Insert( OnColorDepthChanged );
210 
211  //Scene
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 );
216 
217  //Rendering
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 );
226  #endif
227  }
228 
229  string GetLayoutName()
230  {
231  #ifdef PLATFORM_PS4
232  return "gui/layouts/new_ui/options/ps/video_tab.layout";
233  #else
234  #ifdef PLATFORM_WINDOWS
235  return "gui/layouts/new_ui/options/pc/video_tab.layout";
236  #endif
237  #endif
238  }
239 
240  void Focus()
241  {
242  #ifdef PLATFORM_PS4
243  if (m_FlipModeSelector)
244  {
245  SetFocus( m_FlipModeSelector.GetParent() );
246  }
247  #endif
248  }
249 
250  void ReloadOptions()
251  {
252  m_Menu.ReloadOptions();
253  }
254 
255  bool IsChanged()
256  {
257  return false;
258  }
259 
260  void Apply()
261  {
262 
263  }
264 
265  void Revert()
266  {
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 );
272  //m_ColorDepthSelector.SetValue( m_ColorDepthOption.GetIndex(), false );
273  m_OverallQualitySelector.SetValue( m_OverallQualityOption.GetIndex(), false );
274  #endif
275 
276  RefreshCustom();
277  #ifndef PLATFORM_CONSOLE
278  m_OverallQualitySelector.SetValue( m_OverallQualityOption.GetIndex(), false );
279  #endif
280  }
281 
282  void SetToDefaults()
283  {
284  #ifdef PLATFORM_CONSOLE
285  #ifdef PLATFORM_PS4
286  m_FlipModeSelector.SetValue( m_FlipModeOption.GetDefaultIndex(), false );
287  #endif
288  #else
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 );
295  #endif
296 
297  RefreshCustom();
298  //DefaultValuesToCustom();
299  }
300 
301  void SetOptions( GameOptions options )
302  {
303  m_Options = options;
304 
305  #ifdef PLATFORM_CONSOLE
306  #ifdef PLATFORM_PS4
307  m_FlipModeOption = ListOptionsAccess.Cast( m_Options.GetOptionByType( OptionAccessType.AT_OPTIONS_FLIPMODE ) );
308  #endif
309  #else
310  //Overall
311  m_OverallQualityOption = ListOptionsAccess.Cast( m_Options.GetOptionByType( OptionAccessType.AT_QUALITY_PREFERENCE ) );
312 
313  //Screen
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 ) );
318  //m_ColorDepthOption = ListOptionsAccess.Cast( m_Options.GetOptionByType( OptionAccessType.AT_HDR_DETAIL ) );
319 
320  //Scene
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 ) );
325 
326  //Rendering
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 ) );
329 
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 ) );
336  #endif
337  }
338 
339  void ToggleDependentOptions(int mode, bool state)
340  {
341  }
342 
343  void InitDependentOptionsVisibility()
344  {
345  }
346 
347  void RefreshCustom()
348  {
349  #ifdef PLATFORM_CONSOLE
350  #ifdef PLATFORM_PS4
351  m_FlipModeSelector.SetValue( m_FlipModeOption.GetIndex(), false );
352  #endif
353  #else
354  //Scene
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 );
359 
360  //Rendering
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 )
366  {
367  m_ATOCSelector.Disable();
368  }
369  else
370  {
371  m_ATOCSelector.Enable();
372  }
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 );
377  #endif
378  }
379 
380  override bool OnMouseEnter( Widget w, int x, int y )
381  {
382  if ( w && w.IsInherited( ScrollWidget ) )
383  {
384  return false;
385  }
386 
387  m_Menu.ColorHighlight( w );
388 
389  return true;
390  }
391 
392  override bool OnMouseLeave( Widget w, Widget enterW, int x, int y )
393  {
394  if ( w && w.IsInherited( ScrollWidget ) )
395  {
396  return false;
397  }
398 
399  m_Menu.ColorNormal( w );
400  return true;
401  }
402 
403  void OnOptionChanged()
404  {
405  #ifndef PLATFORM_CONSOLE
406  if ( m_OverallQualityOption.GetIndex() != 5 )
407  {
408  m_OverallQualitySelector.SetValue( 5 );
409  }
410  #endif
411  }
412 
413  #ifdef PLATFORM_CONSOLE
414  #ifdef PLATFORM_PS4
415  void OnFlipModeChanged( int value )
416  {
417  m_FlipModeOption.SetIndex( value );
418  OnOptionChanged();
419  m_Menu.OnChanged();
420  }
421  #endif
422  #else
423  void OnOverallQualityChanged( int value )
424  {
425  m_OverallQualityOption.SetIndex( value );
426  m_OverallQualityOption.Test(); //here's the bastard!
427  m_Options.Test();
428  //SetOptions(m_Options);
429 
430  ReloadOptions();
431 
432  //InitSelectors();
433  m_OverallQualityOption.SetIndex( value );
434  RefreshCustom();
435  m_Menu.OnChanged();
436  }
437 
438  void OnDisplayModeChanged( int value )
439  {
440  m_DisplayModeOption.SetIndex( value );
441  m_Menu.OnChanged();
442  }
443 
444  void OnResolutionChanged( int value )
445  {
446  m_ResolutionOption.SetIndex( value );
447  m_Menu.OnChanged();
448  }
449 
450  void OnBrightnessChanged( float value )
451  {
452  m_BrightnessOption.WriteValue( value );
453  m_Menu.OnChanged();
454  }
455 
456  void OnVSyncChanged( float value )
457  {
458  m_VSyncOption.SetIndex( value );
459  m_Menu.OnChanged();
460  }
461 
462  void OnColorDepthChanged( int value )
463  {
464  //m_ColorDepthOption.SetIndex( value );
465  m_Menu.OnChanged();
466  }
467 
468  void OnObjectDetailChanged( int value )
469  {
470  m_ObjectDetailOption.SetIndex( value );
471  OnOptionChanged();
472  m_Menu.OnChanged();
473  }
474 
475  void OnTerrainDetailChanged( int value )
476  {
477  m_TerrainDetailOption.SetIndex( value );
478  OnOptionChanged();
479  m_Menu.OnChanged();
480  }
481 
482  void OnTextureDetailChanged( int value )
483  {
484  m_TextureDetailOption.SetIndex( value );
485  OnOptionChanged();
486  m_Menu.OnChanged();
487  }
488 
489  void OnShadowDetailChanged( int value )
490  {
491  m_ShadowDetailOption.SetIndex( value );
492  OnOptionChanged();
493  m_Menu.OnChanged();
494  }
495 
496  void OnTextureFilteringChanged( int value )
497  {
498  m_TextureFilteringOption.SetIndex( value );
499  OnOptionChanged();
500  m_Menu.OnChanged();
501  }
502 
503  void OnTerrainSurfaceDetailChanged( int value )
504  {
505  m_TerrainSurfaceDetailOption.SetIndex( value );
506  OnOptionChanged();
507  m_Menu.OnChanged();
508  }
509 
510  void OnPPAAChanged( int value )
511  {
512  m_PPAAOption.SetIndex( value );
513  OnOptionChanged();
514  m_Menu.OnChanged();
515  }
516 
517  void OnHWAAChanged( int value )
518  {
519  m_HWAAOption.SetIndex( value );
520  if ( value == 0 )
521  {
522  m_ATOCSelector.Disable();
523  }
524  else
525  {
526  m_ATOCSelector.Enable();
527  }
528  OnOptionChanged();
529  m_Menu.OnChanged();
530  }
531 
532  void OnATOCChanged( int value )
533  {
534  m_ATOCOption.SetIndex( value );
535  OnOptionChanged();
536  m_Menu.OnChanged();
537  }
538 
539  void OnAOChanged( int value )
540  {
541  m_AOOption.SetIndex( value );
542  OnOptionChanged();
543  m_Menu.OnChanged();
544  }
545 
546  void OnPPQualityChanged( int value )
547  {
548  m_PPQualityOption.SetIndex( value );
549  OnOptionChanged();
550  m_Menu.OnChanged();
551  }
552 
553  void OnSSRQualityChanged( int value )
554  {
555  m_SSRQualityOption.SetIndex( value );
556  OnOptionChanged();
557  m_Menu.OnChanged();
558  }
559  #endif
560 
561  override bool OnFocus( Widget w, int x, int y )
562  {
563  OptionsMenu menu = OptionsMenu.Cast( GetGame().GetUIManager().GetMenu() );
564  if ( menu )
565  menu.OnFocus( w, x, y );
566  if ( w )
567  {
568  if (TextMapUpdateWidget(w.GetUserID()))
569  {
570  return true;
571  }
572 
573  if ( w.IsInherited( SliderWidget ) )
574  {
575  return true;
576  }
577  }
578  m_DetailsRoot.Show( false );
579  return ( w != null );
580  }
581 
582  bool TextMapUpdateWidget(int key)
583  {
584  bool connectivityInfoShown = key == OptionIDsScript.OPTION_CONNECTIVITY_INFO;
586  Param tmp = m_TextMap.Get(key);
587 
588  m_DetailsBodyDefault.Show(!connectivityInfoShown);
589  m_DetailsBodyConnectivity.Show(connectivityInfoShown);
590 
591  if (Class.CastTo(p,tmp))
592  {
593  m_DetailsRoot.Show(true);
594  m_DetailsText.Show(true);
595  m_DetailsLabel.SetText(p.param1);
596  m_DetailsText.SetText(p.param2);
597 
598  m_DetailsText.Update();
599  m_DetailsLabel.Update();
600  m_DetailsRoot.Update();
601  m_DetailsBodyConnectivity.Update(); //...
602  return true;
603  }
604  return false;
605  }
606 
607  void FillTextMap()
608  {
609  m_TextMap = new map<int, ref Param2<string, string>>;
610 
611  #ifdef PLATFORM_CONSOLE
612  #ifdef PLATFORM_PS4
613  m_TextMap.Insert( OptionAccessType.AT_OPTIONS_FLIPMODE, new Param2<string, string>( "#options_video_V-sync", "#options_video_V-sync_desc" ) );
614  #endif
615  #else
616  m_TextMap.Insert( OptionAccessType.AT_QUALITY_PREFERENCE, new Param2<string, string>( "#options_video_quality", "#options_video_quality_desc" ) );
617  m_TextMap.Insert( OptionAccessType.AT_OPTIONS_DISPLAY_MODE, new Param2<string, string>( "#options_video_display_mode", "#options_video_display_mode_desc" ) );
618  m_TextMap.Insert( OptionAccessType.AT_OPTIONS_RESOLUTION, new Param2<string, string>( "#options_video_resolution", "#options_video_resolution_desc" ) );
619  m_TextMap.Insert( OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER, new Param2<string, string>( "#options_video_brightness", "#options_video_brightness_desc" ) );
620  m_TextMap.Insert( OptionAccessType.AT_VSYNC_VALUE, new Param2<string, string>( "#options_video_V-sync", "#options_video_V-sync_desc" ) );
621  m_TextMap.Insert( OptionAccessType.AT_HDR_DETAIL, new Param2<string, string>( "#options_video_color_depth", "#options_video_color_depth_desc" ) );
622  m_TextMap.Insert( OptionAccessType.AT_OBJECTS_DETAIL, new Param2<string, string>( "#options_video_object_detail", "#options_video_object_detail_desc" ) );
623  m_TextMap.Insert( OptionAccessType.AT_OPTIONS_TERRAIN, new Param2<string, string>( "#options_video_terrain_detail", "#options_video_terrain_detail_desc" ) );
624  m_TextMap.Insert( OptionAccessType.AT_TEXTURE_DETAIL, new Param2<string, string>( "#options_video_texture_detail", "#options_video_texture_detail_desc" ) );
625  m_TextMap.Insert( OptionAccessType.AT_SHADOW_DETAIL, new Param2<string, string>( "#options_video_shadow_detail", "#options_video_shadow_detail_desc" ) );
626  m_TextMap.Insert( OptionAccessType.AT_ANISO_DETAIL, new Param2<string, string>( "#options_video_texture_filtering", "#options_video_texture_filtering_desc" ) );
627  m_TextMap.Insert( OptionAccessType.AT_OPTIONS_TERRAIN_SHADER, new Param2<string, string>( "#options_video_terrain_surface_detail", "#options_video_terrain_surface_detail_desc" ) );
628  m_TextMap.Insert( OptionAccessType.AT_OPTIONS_FXAA_VALUE, new Param2<string, string>( "#options_video_anti-aliasing", "#options_video_anti-aliasing_desc" ) );
629  m_TextMap.Insert( OptionAccessType.AT_FSAA_DETAIL, new Param2<string, string>( "#options_video_anti-aliasing_hardware", "#options_video_anti-aliasing_hardware_desc" ) );
630  m_TextMap.Insert( OptionAccessType.AT_ATOC_DETAIL, new Param2<string, string>( "#options_video_foliage_smoothing", "#options_video_foliage_smoothing_desc" ) );
631  m_TextMap.Insert( OptionAccessType.AT_AMBIENT_OCCLUSION, new Param2<string, string>( "#options_video_ambient_occlusion", "#options_video_ambient_occlusion_desc" ) );
632  m_TextMap.Insert( OptionAccessType.AT_POSTPROCESS_EFFECTS, new Param2<string, string>( "#options_video_post_process", "#options_video_post_process_desc" ) );
633  m_TextMap.Insert( OptionAccessType.AT_WATER_DETAIL, new Param2<string, string>( "#STR_option_video_ssr_quality_tip_header", "#STR_option_video_ssr_quality_tip" ) );
634  #endif
635  }
636 }
Param2< string, string >
GetGame
proto native CGame GetGame()
OptionIDsScript
OptionIDsScript
Used for script-based game options. For anything C++ based, you would most likely use "Option Access ...
Definition: gameplay.c:1264
Focus
void Focus()
Definition: serverbrowsertab.c:181
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
y
Icon y
GameOptions
Definition: gameplay.c:1420
m_Menu
protected ServerBrowserMenuNew m_Menu
Definition: serverbrowsertab.c:30
OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition: uihintpanel.c:276
RichTextWidget
Definition: gameplay.c:315
map
map
Definition: controlsxboxnew.c:3
TextWidget
Definition: enwidgets.c:219
OptionAccessType
OptionAccessType
C++ OptionAccessType.
Definition: gameplay.c:1200
array< string >
SetFocus
proto native void SetFocus(Widget w)
x
Icon x
OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition: serverbrowsertab.c:217
Widget
Definition: enwidgets.c:189
m_Root
protected Widget m_Root
Definition: sizetochild.c:91
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition: uihintpanel.c:267
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition: enwidgets.c:650