Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_VideoSettingsConsoleSubMenu.c
Go to the documentation of this file.
2 {
3  protected const int COMBO_OPTION_QUALITY = 0;
4  protected const int COMBO_OPTION_PERFORMANCE = 1;
5 
6  protected EPlatform m_ePlatform;
7  SCR_SettingsManagerVideoModule m_SettingsVideoModule;
8 
9  //------------------------------------------------------------------------------------------------
10  override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index)
11  {
12  super.OnTabCreate(menuRoot, buttonsLayout, index);
13 
14  SCR_SettingsManager settingsManager = GetGame().GetSettingsManager();
15 
16  if (!settingsManager)
17  return;
18 
19  m_SettingsVideoModule = SCR_SettingsManagerVideoModule.Cast(settingsManager.GetModule(ESettingManagerModuleType.SETTINGS_MANAGER_VIDEO));
20  if (!m_SettingsVideoModule)
21  Print("VideoSettingsConsoleSubMenu: Video settings manager module not found!", LogLevel.WARNING);
22 
23  m_ePlatform = System.GetPlatform();
24  SetupQualityPreset();
25  }
26 
27  //------------------------------------------------------------------------------------------------
28  protected void OnQualityPresetChanged(SCR_ComboBoxComponent combobox, int itemIndex)
29  {
30  if (m_ePlatform != EPlatform.XBOX_SERIES_X && m_ePlatform != EPlatform.XBOX_SERIES_S)
31  return;
32 
33  ChangePreset(m_ePlatform, itemIndex);
34  }
35 
36  //------------------------------------------------------------------------------------------------
37  protected void ChangePreset(EPlatform platform, int itemIndex)
38  {
39  if (!m_SettingsVideoModule)
40  return;
41 
42  if (platform == EPlatform.XBOX_SERIES_S && itemIndex == COMBO_OPTION_QUALITY)
43  m_SettingsVideoModule.SetConsolePreset(EVideoQualityPreset.SERIES_S_PRESET_QUALITY);
44 
45  if (platform == EPlatform.XBOX_SERIES_S && itemIndex == COMBO_OPTION_PERFORMANCE)
46  m_SettingsVideoModule.SetConsolePreset(EVideoQualityPreset.SERIES_S_PRESET_PERFORMANCE);
47 
48  if (platform == EPlatform.XBOX_SERIES_X && itemIndex == COMBO_OPTION_QUALITY)
49  m_SettingsVideoModule.SetConsolePreset(EVideoQualityPreset.SERIES_X_PRESET_QUALITY);
50 
51  if (platform == EPlatform.XBOX_SERIES_X && itemIndex == COMBO_OPTION_PERFORMANCE)
52  m_SettingsVideoModule.SetConsolePreset(EVideoQualityPreset.SERIES_X_PRESET_PERFORMANCE);
53 
54  }
55 
56  //------------------------------------------------------------------------------------------------
57  protected void SetupQualityPreset()
58  {
59  SCR_ComboBoxComponent qualityPreset = SCR_ComboBoxComponent.GetComboBoxComponent("QualityPreset", m_wRoot);
60  if (!qualityPreset)
61  return;
62 
63  int lastPreset;
64 
65  BaseContainer videoSettings = GetGame().GetGameUserSettings().GetModule("SCR_VideoSettings");
66  if (!videoSettings)
67  return;
68 
69  videoSettings.Get("m_iLastUsedPreset", lastPreset);
70 
71  if (lastPreset == EVideoQualityPreset.SERIES_X_PRESET_QUALITY || lastPreset == EVideoQualityPreset.SERIES_S_PRESET_QUALITY)
72  qualityPreset.SetCurrentItem(COMBO_OPTION_QUALITY);
73 
74  if (lastPreset == EVideoQualityPreset.SERIES_X_PRESET_PERFORMANCE || lastPreset == EVideoQualityPreset.SERIES_S_PRESET_PERFORMANCE)
75  qualityPreset.SetCurrentItem(COMBO_OPTION_PERFORMANCE);
76 
77  qualityPreset.m_OnChanged.Insert(OnQualityPresetChanged);
78  }
79 };
SCR_ComboBoxComponent
Definition: SCR_ComboBoxComponent.c:1
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SettingsManagerVideoModule
Definition: SCR_SettingsManagerVideoModule.c:2
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_SettingsManager
Definition: SCR_SettingsManager.c:10
SCR_VideoSettingsConsoleSubMenu
Definition: SCR_VideoSettingsConsoleSubMenu.c:1
SCR_SettingsSubMenuBase
Definition: SCR_SettingsSubMenuBase.c:1
ESettingManagerModuleType
ESettingManagerModuleType
Definition: SCR_SettingsManager.c:2