Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_GameplaySettingsSubMenu.c
Go to the documentation of this file.
3 typedef ScriptInvokerBase<ScriptInvoker_GameplaySettingsSubMenu> ScriptInvoker_GameplaySettingsSubMenuChanged;
4 
6 {
7  protected static const ref array<string> m_aLanguages = {
8  "en_us",
9  "fr_fr",
10  "it_it",
11  "de_de",
12  "es_es",
13  "cs_cz",
14  "pl_pl",
15  "ru_ru",
16  "ja_jp",
17  "ko_kr",
18  "pt_br",
19  "zh_cn"
20  };
21 
23 
24  //------------------------------------------------------------------------------------------------
25  override void OnTabHide()
26  {
27  super.OnTabHide();
28 
30  if (playerController)
31  playerController.SetGameUserSettings();
32  }
33 
34  //------------------------------------------------------------------------------------------------
35  override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index)
36  {
37  super.OnTabCreate(menuRoot, buttonsLayout, index);
38 
39  m_aSettingsBindings.Clear();
40 
41  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("InputDeviceUserSettings", "MouseInvert", "MouseY"));
42  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("InputDeviceUserSettings", "GamepadInvert", "GamepadY"));
43  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_HintSettings", "m_bHintsEnabled", "ContextHints"));
44  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_GameplaySettings", "m_bControlHints", "ControlHints"));
45  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_GameplaySettings", "m_b2DScopes", "ScopeMode"));
46  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_GameplaySettings", "m_bStickyADS", "StickyADS"));
47  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_GameplaySettings", "m_bStickyGadgets", "StickyGadgets"));
48  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_GameplaySettings", "m_bShowRadioProtocolText", "RadioProtocolSubtitles"));
49  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_GameplaySettings", "m_bMouseControlAircraft", "MouseControlAircraft"));
50  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_GameplaySettings", "m_eDrivingAssistance", "DrivingAssistance"));
51 
52  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_FieldOfViewSettings", "m_fFirstPersonFOV", "1PP"));
53  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_FieldOfViewSettings", "m_fThirdPersonFOV", "3PP"));
54  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_FieldOfViewSettings", "m_fVehicleFOV", "VehicleFOV"));
55  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_FieldOfViewSettings", "m_fFocusInADS", "FocusIntensityADS"));
56 
57  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_AimSensitivitySettings", "m_fMouseSensitivity", "AimMouse"));
58  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_AimSensitivitySettings", "m_fStickSensitivity", "AimGamepad"));
59  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_AimSensitivitySettings", "m_fAimADS", "AimADS"));
60  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("UserInterfaceSettings", "UseSoftwareCursor", "CursorMode"));
61 
62  LoadSettings();
63 
64  BindFOVSettings();
65  BindSensitivitySettings();
66  BindLanguage();
67 
68 // Hide unusual console settings (consoles -can- use USB KBM)
69 #ifdef PLATFORM_CONSOLE
70  HideMenuItem("MouseY");
71  HideMenuItem("CursorMode");
72  HideMenuItem("AimMouse");
73 #endif
74  }
75 
76  //------------------------------------------------------------------------------------------------
77  protected void HideMenuItem(string widgetName)
78  {
79  Widget w = GetRootWidget().FindAnyWidget(widgetName);
80  if (w)
81  w.SetVisible(false);
82  }
83 
84  //------------------------------------------------------------------------------------------------
85  protected void BindLanguage()
86  {
87  BaseContainer setting = GetGame().GetEngineUserSettings().GetModule("UserInterfaceSettings");
88  if (!setting)
89  return;
90 
91  string currentLang;
92  setting.Get("LanguageCode", currentLang);
93 
94  int i = m_aLanguages.Find(currentLang);
95  if (i == -1)
96  return;
97 
98  Widget w = m_wRoot.FindAnyWidget("Language");
99  if (!w)
100  return;
101 
103  if (!comp)
104  return;
105 
106  comp.SetCurrentItem(i);
107  comp.m_OnChanged.Insert(OnLanguageChange);
108  }
109  //------------------------------------------------------------------------------------------------
110  protected void BindFOVSettings()
111  {
112  SCR_CheckboxComponent chkboxMaximumZoomInADS = SCR_CheckboxComponent.GetCheckboxComponent("MaxZoomADS", m_wRoot);
113 
114  if (chkboxMaximumZoomInADS)
115  chkboxMaximumZoomInADS.m_OnChanged.Insert(OnGameSettingsCheckboxChange);
116 
118  if (playerController)
119  playerController.SetGameUserSettings();
120  }
121  //------------------------------------------------------------------------------------------------
122  protected void BindSensitivitySettings()
123  {
124  SCR_SliderComponent sliderMouse = SCR_SliderComponent.GetSliderComponent("AimMouse", m_wRoot);
125  SCR_SliderComponent sliderGamepad = SCR_SliderComponent.GetSliderComponent("AimGamepad", m_wRoot);
126  SCR_SliderComponent sliderADS = SCR_SliderComponent.GetSliderComponent("AimADS", m_wRoot);
127 
128  if (sliderMouse)
129  sliderMouse.GetOnChangedFinal().Insert(OnGameSettingsSliderChange);
130 
131  if (sliderGamepad)
132  sliderGamepad.GetOnChangedFinal().Insert(OnGameSettingsSliderChange);
133 
134  if (sliderADS)
135  sliderADS.GetOnChangedFinal().Insert(OnGameSettingsSliderChange);
136 
138  if (playerController)
139  playerController.SetGameUserSettings();
140  }
141 
142  //------------------------------------------------------------------------------------------------
143  protected void OnLanguageChange(SCR_SpinBoxComponent comp, int i)
144  {
145  BaseContainer setting = GetGame().GetEngineUserSettings().GetModule("UserInterfaceSettings");
146  if (!setting)
147  return;
148 
149  if (i >= m_aLanguages.Count())
150  return;
151 
152  string currentLang;
153  setting.Set("LanguageCode", m_aLanguages[i]);
154  GetGame().UserSettingsChanged();
155 
156  m_OnLanguageChanged.Invoke(this);
157  }
158 
159  //------------------------------------------------------------------------------------------------
160  protected void OnGameSettingsSliderChange(SCR_SliderComponent comp, float val)
161  {
163  if (playerController)
164  playerController.SetGameUserSettings();
165  }
166 
167  //------------------------------------------------------------------------------------------------
168  protected void OnGameSettingsCheckboxChange(SCR_CheckboxComponent comp, bool val)
169  {
171  if (playerController)
172  playerController.SetGameUserSettings();
173  }
174 };
SCR_CheckboxComponent
This is refactored checkbox preserving its own class and API for compatability purposes.
Definition: SCR_CheckboxComponent.c:3
SCR_PlayerController
Definition: SCR_PlayerController.c:31
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
ScriptInvoker_GameplaySettingsSubMenuChanged
ScriptInvokerBase< ScriptInvoker_GameplaySettingsSubMenu > ScriptInvoker_GameplaySettingsSubMenuChanged
Definition: SCR_GameplaySettingsSubMenu.c:3
SCR_SettingBindingEngine
Definition: SCR_SettingBindingEngine.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
ScriptInvoker_GameplaySettingsSubMenu
func ScriptInvoker_GameplaySettingsSubMenu
Definition: SCR_GameplaySettingsSubMenu.c:2
func
func
Definition: SCR_AIThreatSystem.c:5
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
GetRootWidget
Widget GetRootWidget()
Definition: SCR_UITaskManagerComponent.c:160
SCR_SettingBindingGameplay
Definition: SCR_SettingBindingGameplay.c:1
SCR_SliderComponent
Definition: SCR_SliderComponent.c:2
LoadSettings
protected void LoadSettings()
Definition: SCR_HintManagerComponent.c:449
SCR_SpinBoxComponent
Definition: SCR_SpinBoxComponent.c:1
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_SettingsSubMenuBase
Definition: SCR_SettingsSubMenuBase.c:1
SCR_GameplaySettingsSubMenu
Definition: SCR_GameplaySettingsSubMenu.c:5