3 private const float HUD_BRIGHTNESS_MIN = -1.0;
4 private const float HUD_BRIGHTNESS_MAX = 0.0;
8 protected Widget m_SettingsRoot;
9 protected Widget m_DetailsRoot;
10 protected Widget m_DetailsBodyDefault;
11 protected Widget m_DetailsBodyConnectivity;
14 protected ButtonWidget m_QuickbarButton;
16 protected ref NumericOptionsAccess m_FOVOption;
17 protected ref ListOptionsAccess m_LanguageOption;
18 protected ref ListOptionsAccess m_PauseOption;
19 #ifdef PLATFORM_CONSOLE
20 protected ref NumericOptionsAccess m_BrightnessOption;
21 protected ref OptionSelectorSlider m_BrightnessSelector;
24 protected ref OptionSelectorMultistate m_LanguageSelector;
25 protected ref OptionSelectorSlider m_FOVSelector;
26 protected ref OptionSelectorMultistate m_ShowHUDSelector;
27 protected ref OptionSelectorMultistate m_ShowCrosshairSelector;
28 protected ref OptionSelectorMultistate m_ShowQuickbarSelector;
29 protected ref OptionSelectorMultistate m_ShowGameSelector;
30 protected ref OptionSelectorMultistate m_ShowAdminSelector;
31 protected ref OptionSelectorMultistate m_ShowPlayerSelector;
32 protected ref OptionSelectorMultistate m_ShowServerInfoSelector;
33 protected ref OptionSelectorMultistate m_BleedingIndication;
34 protected ref OptionSelectorMultistate m_ConnectivityInfo;
35 protected ref OptionSelectorSlider m_HUDBrightnessSelector;
36 protected ref OptionSelectorMultistate m_PauseSelector;
39 protected OptionsMenu
m_Menu;
45 m_Root =
GetGame().GetWorkspace().CreateWidgets(GetLayoutName(), parent);
47 m_DetailsRoot = details_root;
48 m_DetailsBodyDefault = m_DetailsRoot.FindAnyWidget(
"settings_details_body");
49 m_DetailsBodyConnectivity = m_DetailsRoot.FindAnyWidget(
"settings_details_body_connectivity");
50 m_DetailsLabel =
TextWidget.Cast(m_DetailsRoot.FindAnyWidget(
"details_label"));
51 m_DetailsText =
RichTextWidget.Cast(m_DetailsRoot.FindAnyWidget(
"details_content"));
56 m_FOVOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_FIELD_OF_VIEW));
57 m_LanguageOption = ListOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_LANGUAGE));
58 m_PauseOption = ListOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_PAUSE));
62 m_Root.FindAnyWidget(
"hud_brightness_setting_option").SetUserID(
OptionIDsScript.OPTION_HUD_BRIGHTNESS);
68 m_Root.FindAnyWidget(
"bleeding_indication_setting_option").SetUserID(
OptionIDsScript.OPTION_BLEEDINGINDICATION);
69 m_Root.FindAnyWidget(
"connectivity_setting_option").SetUserID(
OptionIDsScript.OPTION_CONNECTIVITY_INFO);
72 #ifdef PLATFORM_CONSOLE
73 m_QuickbarButton = ButtonWidget.Cast(
m_Root.FindAnyWidget(
"quickbar_button"));
82 array<string> opt = {
"#options_controls_disabled",
"#options_controls_enabled" };
83 array<string> opt2 = {
"#options_controls_enabled",
"#options_controls_disabled" };
85 for (
int i = 0; i < m_LanguageOption.GetItemsCount(); ++i)
88 m_LanguageOption.GetItemText(i, text);
92 array<string> opt4 = {
"#options_pc_nopause_0",
"#options_pc_nopause_1",
"#options_pc_nopause_2" };
94 m_LanguageSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"language_setting_option"), m_LanguageOption.GetIndex(),
this,
false, opt3);
95 m_FOVSelector =
new OptionSelectorSlider(
m_Root.FindAnyWidget(
"fov_setting_option"), m_FOVOption.ReadValue(),
this,
false, m_FOVOption.GetMin(), m_FOVOption.GetMax());
96 m_ShowHUDSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"hud_setting_option"),
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.HUD),
this,
false, opt);
97 m_HUDBrightnessSelector =
new OptionSelectorSlider(
m_Root.FindAnyWidget(
"hud_brightness_setting_option"),
g_Game.GetProfileOptionFloat(
EDayZProfilesOptions.HUD_BRIGHTNESS),
this,
false, HUD_BRIGHTNESS_MIN, HUD_BRIGHTNESS_MAX);
98 m_ShowCrosshairSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"crosshair_setting_option"),
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.CROSSHAIR),
this,
false, opt);
99 m_ShowGameSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"game_setting_option"),
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.GAME_MESSAGES),
this,
false, opt2);
100 m_ShowAdminSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"admin_setting_option"),
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.ADMIN_MESSAGES),
this,
false, opt2);
101 m_ShowPlayerSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"player_setting_option"),
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.PLAYER_MESSAGES),
this,
false, opt2);
102 m_BleedingIndication =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"bleeding_indication_setting_option"),
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.BLEEDINGINDICATION),
this,
false, opt);
103 m_ConnectivityInfo =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"connectivity_setting_option"),
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.CONNECTIVITY_INFO),
this,
false, opt);
104 m_ShowQuickbarSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"quickbar_setting_option"),
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.QUICKBAR),
this,
false, opt);
106 m_LanguageSelector.m_OptionChanged.Insert(UpdateLanguageOption);
107 m_FOVSelector.m_OptionChanged.Insert(UpdateFOVOption);
108 m_ShowHUDSelector.m_OptionChanged.Insert(UpdateHUDOption);
109 m_HUDBrightnessSelector.m_OptionChanged.Insert(UpdateHUDBrightnessOption);
110 m_ShowCrosshairSelector.m_OptionChanged.Insert(UpdateCrosshairOption);
111 m_ShowGameSelector.m_OptionChanged.Insert(UpdateGameOption);
112 m_ShowAdminSelector.m_OptionChanged.Insert(UpdateAdminOption);
113 m_ShowPlayerSelector.m_OptionChanged.Insert(UpdatePlayerOption);
114 m_BleedingIndication.m_OptionChanged.Insert(UpdateBleedingIndication);
115 m_ConnectivityInfo.m_OptionChanged.Insert(UpdateConnectivityInfo);
116 m_ShowQuickbarSelector.m_OptionChanged.Insert(UpdateQuickbarOption);
118 #ifdef PLATFORM_CONSOLE
119 m_BrightnessOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER));
120 m_BrightnessSelector =
new OptionSelectorSlider(
m_Root.FindAnyWidget(
"brightness_setting_option"), m_BrightnessOption.ReadValue(),
this,
false, m_BrightnessOption.GetMin(), m_BrightnessOption.GetMax());
121 m_BrightnessSelector.m_OptionChanged.Insert(UpdateBrightnessOption);
123 m_ShowServerInfoSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"serverinfo_setting_option"),
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.SERVERINFO_DISPLAY),
this,
false, opt);
124 m_PauseSelector =
new OptionSelectorMultistate(
m_Root.FindAnyWidget(
"pause_setting_option"), m_PauseOption.GetIndex(),
this,
false, opt4);
126 m_ShowServerInfoSelector.m_OptionChanged.Insert(UpdateServerInfoOption);
127 m_PauseSelector.m_OptionChanged.Insert(UpdatePauseOption);
131 m_Root.FindAnyWidget(
"game_settings_scroll").GetScreenSize(
x,
y);
132 m_Root.FindAnyWidget(
"game_settings_root").GetScreenSize(
x, y2);
134 m_Root.FindAnyWidget(
"game_settings_scroll").SetAlpha(f);
137 m_DetailsRoot.Show(
false);
139 InitDependentOptionsVisibility();
142 void ~OptionsMenuGame()
146 m_FOVOption.Revert();
147 g_Game.SetUserFOV(m_FOVOption.ReadValue());
150 RevertHUDBrightness();
153 string GetLayoutName()
155 #ifdef PLATFORM_CONSOLE
156 return "gui/layouts/new_ui/options/xbox/game_tab.layout";
158 return "gui/layouts/new_ui/options/pc/game_tab.layout";
164 #ifdef PLATFORM_CONSOLE
165 SetFocus(m_LanguageSelector.GetParent());
172 universal = universal || m_HUDBrightnessSelector.GetValue() !=
g_Game.GetProfileOptionFloat(
EDayZProfilesOptions.HUD_BRIGHTNESS);
174 universal = universal || m_ShowPlayerSelector.GetValue() !=
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.PLAYER_MESSAGES);
175 universal = universal || m_BleedingIndication.GetValue() !=
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.BLEEDINGINDICATION);
176 universal = universal || m_ConnectivityInfo.GetValue() !=
g_Game.GetProfileOptionBool(
EDayZProfilesOptions.CONNECTIVITY_INFO);
177 universal = universal || m_LanguageOption.IsChanged();
179 #ifdef PLATFORM_CONSOLE
188 IngameHud hud = GetHud();
190 MissionGameplay
mission = MissionGameplay.Cast(
GetGame().GetMission());
199 #ifndef PLATFORM_CONSOLE
206 #ifndef PLATFORM_CONSOLE
207 hud.ShowQuickBar(m_ShowQuickbarSelector.GetValue());
209 hud.ShowQuickBar(
GetGame().
GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
211 hud.ShowHud(m_ShowHUDSelector.GetValue());
215 bool bleedingIndicationNew = m_BleedingIndication.GetValue();
217 bool connectivityNew = m_ConnectivityInfo.GetValue();
225 if (bleedingIndicationOld != bleedingIndicationNew)
227 OnBleedingIndicationChanged(bleedingIndicationNew);
231 if (connectivityOld != connectivityNew)
233 mission.GetConnectivityInvoker().Invoke(connectivityNew);
237 #ifndef PLATFORM_CONSOLE
240 menu.SetServerInfoVisibility(m_ShowServerInfoSelector.GetValue());
244 if (m_LanguageOption.IsChanged())
259 if (m_ShowHUDSelector)
262 RevertHUDBrightness();
264 if (m_ShowCrosshairSelector)
268 m_FOVSelector.SetValue(m_FOVOption.ReadValue(),
false);
269 g_Game.SetUserFOV(m_FOVOption.ReadValue());
271 if (m_LanguageOption)
272 m_LanguageSelector.SetValue(m_LanguageOption.GetIndex(),
false);
273 if (m_ShowGameSelector)
275 if (m_ShowAdminSelector)
277 if (m_ShowPlayerSelector)
279 if (m_BleedingIndication)
281 if (m_ConnectivityInfo)
284 #ifdef PLATFORM_CONSOLE
285 if (m_BrightnessSelector)
286 m_BrightnessSelector.SetValue(m_BrightnessOption.ReadValue(),
false);
288 if (m_ShowQuickbarSelector)
290 if (m_ShowServerInfoSelector)
294 m_PauseSelector.SetValue(m_PauseOption.GetIndex(),
false);
301 g_Game.ResetProfileOptions();
303 if (m_ShowHUDSelector)
306 if (m_HUDBrightnessSelector)
309 g_Game.SetHudBrightness(m_HUDBrightnessSelector.GetValue());
312 if (m_ShowCrosshairSelector)
317 m_FOVOption.WriteValue(m_FOVOption.GetDefault());
318 m_FOVSelector.SetValue(m_FOVOption.ReadValue(),
false);
319 g_Game.SetUserFOV(m_FOVOption.GetDefault());
321 if (m_ShowGameSelector)
323 if (m_ShowAdminSelector)
325 if (m_ShowPlayerSelector)
327 if (m_BleedingIndication)
329 if (m_ConnectivityInfo)
332 #ifdef PLATFORM_CONSOLE
333 if (m_BrightnessSelector)
335 m_BrightnessOption.WriteValue(m_BrightnessOption.GetDefault());
336 m_BrightnessSelector.SetValue(m_BrightnessOption.GetDefault(),
false);
339 if (m_ShowQuickbarSelector)
341 if (m_ShowServerInfoSelector)
345 m_PauseOption.SetIndex(m_PauseOption.GetDefaultIndex());
346 m_PauseSelector.SetValue(m_PauseOption.GetIndex(),
false);
360 m_FOVOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_FIELD_OF_VIEW));
361 m_LanguageOption = ListOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_LANGUAGE));
364 m_FOVSelector.SetValue(m_FOVOption.ReadValue(),
false);
366 if (m_LanguageOption)
367 m_LanguageSelector.SetValue(m_LanguageOption.GetIndex(),
false);
369 #ifdef PLATFORM_CONSOLE
370 m_BrightnessOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(
OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER));
371 if (m_BrightnessOption)
372 m_BrightnessSelector.SetValue(m_BrightnessOption.ReadValue(),
false);
376 void ToggleDependentOptions(
int mode,
bool state)
380 void InitDependentOptionsVisibility()
382 #ifdef PLATFORM_CONSOLE
383 m_QuickbarButton.Show(
false);
387 protected void UpdateLanguageOption(
int new_index)
389 m_LanguageOption.SetIndex(new_index);
395 protected void UpdatePauseOption(
int new_index)
397 m_PauseOption.SetIndex(new_index);
401 protected void UpdateFOVOption(
float new_value)
403 m_FOVOption.WriteValue(new_value);
404 g_Game.SetUserFOV(new_value);
408 protected void UpdateHUDBrightnessOption(
float newValue)
410 g_Game.SetHudBrightness(newValue);
414 protected void UpdateHUDOption(
int new_index)
419 protected void UpdateBleedingIndication(
int new_index)
424 protected void UpdateConnectivityInfo(
int newIndex)
429 protected void UpdateCrosshairOption(
int new_index)
434 protected void UpdateQuickbarOption(
int new_index)
439 protected void UpdateGameOption(
int new_index)
444 protected void UpdateAdminOption(
int new_index)
449 protected void UpdatePlayerOption(
int new_index)
454 protected void UpdateServerInfoOption(
int new_index)
464 IngameHud hud = IngameHud.Cast(
mission.GetHud());
470 #ifdef PLATFORM_CONSOLE
471 void UpdateBrightnessOption(
float value)
473 m_BrightnessOption.WriteValue(value);
480 if (w && w.IsInherited(ScrollWidget))
485 if (w && w.IsInherited(SliderWidget))
497 if (w && w.IsInherited(ScrollWidget))
515 if (TextMapUpdateWidget(w.GetUserID()))
520 if (w.IsInherited(SliderWidget))
525 m_DetailsRoot.Show(
false);
529 protected void OnBleedingIndicationChanged(
bool state)
531 MissionGameplay
mission = MissionGameplay.Cast(
GetGame().GetMission());
534 Param1<bool> par =
new Param1<bool>(state);
535 mission.GetEffectWidgets().UpdateWidgets(EffectWidgetsTypes.BLEEDING_LAYER,0,par);
539 bool TextMapUpdateWidget(
int key)
541 bool connectivityInfoShown = key ==
OptionIDsScript.OPTION_CONNECTIVITY_INFO;
543 Param tmp = m_TextMap.Get(key);
545 m_DetailsBodyDefault.Show(!connectivityInfoShown);
546 m_DetailsBodyConnectivity.Show(connectivityInfoShown);
548 if (
Class.CastTo(p,tmp))
550 m_DetailsRoot.Show(
true);
551 m_DetailsText.Show(
true);
552 m_DetailsLabel.SetText(p.param1);
553 m_DetailsText.SetText(p.param2);
555 m_DetailsText.Update();
556 m_DetailsLabel.Update();
557 m_DetailsRoot.Update();
558 m_DetailsBodyConnectivity.Update();
577 #ifdef PLATFORM_WINDOWS
599 private void RevertHUDBrightness()
601 if (m_HUDBrightnessSelector)
604 g_Game.SetHudBrightness(m_HUDBrightnessSelector.GetValue());