DayZ 1.24
Loading...
Searching...
No Matches
OptionsMenuGame.c
Go to the documentation of this file.
1class OptionsMenuGame extends ScriptedWidgetEventHandler
2{
3 private const float HUD_BRIGHTNESS_MIN = -1.0;
4 private const float HUD_BRIGHTNESS_MAX = 0.0;
5
6 protected Widget m_Root;
7
8 protected Widget m_SettingsRoot;
9 protected Widget m_DetailsRoot;
12 protected TextWidget m_DetailsLabel;
15
19#ifdef PLATFORM_CONSOLE
21 protected ref OptionSelectorSlider m_BrightnessSelector;
22#endif
23
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;
37
38 protected GameOptions m_Options;
39 protected OptionsMenu m_Menu;
40
42
44 {
45 m_Root = GetGame().GetWorkspace().CreateWidgets(GetLayoutName(), parent);
46
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"));
52
53 m_Options = options;
54 m_Menu = menu;
55
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));
59
60 m_Root.FindAnyWidget("fov_setting_option").SetUserID(OptionAccessType.AT_OPTIONS_FIELD_OF_VIEW);
61 m_Root.FindAnyWidget("hud_setting_option").SetUserID(OptionIDsScript.OPTION_HUD);
62 m_Root.FindAnyWidget("hud_brightness_setting_option").SetUserID(OptionIDsScript.OPTION_HUD_BRIGHTNESS);
63 m_Root.FindAnyWidget("crosshair_setting_option").SetUserID(OptionIDsScript.OPTION_CROSSHAIR);
64 m_Root.FindAnyWidget("game_setting_option").SetUserID(OptionIDsScript.OPTION_GAME_MESSAGES);
65 m_Root.FindAnyWidget("admin_setting_option").SetUserID(OptionIDsScript.OPTION_ADMIN_MESSAGES);
66 m_Root.FindAnyWidget("player_setting_option").SetUserID(OptionIDsScript.OPTION_PLAYER_MESSAGES);
67 m_Root.FindAnyWidget("language_setting_option").SetUserID(OptionAccessType.AT_OPTIONS_LANGUAGE);
68 m_Root.FindAnyWidget("bleeding_indication_setting_option").SetUserID(OptionIDsScript.OPTION_BLEEDINGINDICATION);
69 m_Root.FindAnyWidget("connectivity_setting_option").SetUserID(OptionIDsScript.OPTION_CONNECTIVITY_INFO);
70 m_Root.FindAnyWidget("quickbar_setting_option").SetUserID(OptionIDsScript.OPTION_QUICKBAR);
71
72#ifdef PLATFORM_CONSOLE
73 m_QuickbarButton = ButtonWidget.Cast(m_Root.FindAnyWidget("quickbar_button"));
74 m_Root.FindAnyWidget("brightness_setting_option").SetUserID(OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER);
75#else
76 m_Root.FindAnyWidget("serverinfo_setting_option").SetUserID(OptionIDsScript.OPTION_SERVER_INFO);
77 m_Root.FindAnyWidget("pause_setting_option").SetUserID(OptionAccessType.AT_OPTIONS_PAUSE);
78#endif
79
81
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)
86 {
87 string text;
88 m_LanguageOption.GetItemText(i, text);
89 opt3.Insert(text);
90 }
91
92 array<string> opt4 = { "#options_pc_nopause_0", "#options_pc_nopause_1", "#options_pc_nopause_2" }; // Pause options menu strings
93
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);
105
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);
117
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);
122#else
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);
125
126 m_ShowServerInfoSelector.m_OptionChanged.Insert(UpdateServerInfoOption);
127 m_PauseSelector.m_OptionChanged.Insert(UpdatePauseOption);
128#endif
129
130 float x, y, y2;
131 m_Root.FindAnyWidget("game_settings_scroll").GetScreenSize(x, y);
132 m_Root.FindAnyWidget("game_settings_root").GetScreenSize(x, y2);
133 int f = (y2 > y);
134 m_Root.FindAnyWidget("game_settings_scroll").SetAlpha(f);
135
136 m_Root.SetHandler(this);
137 m_DetailsRoot.Show(false);
138
140 }
141
143 {
144 if (m_FOVOption)
145 {
146 m_FOVOption.Revert();
147 g_Game.SetUserFOV(m_FOVOption.ReadValue());
148 }
149
151 }
152
154 {
155#ifdef PLATFORM_CONSOLE
156 return "gui/layouts/new_ui/options/xbox/game_tab.layout";
157#else
158 return "gui/layouts/new_ui/options/pc/game_tab.layout";
159#endif
160 }
161
162 void Focus()
163 {
164#ifdef PLATFORM_CONSOLE
165 SetFocus(m_LanguageSelector.GetParent());
166#endif
167 }
168
170 {
171 bool universal = (m_ShowHUDSelector.GetValue() != g_Game.GetProfileOptionBool(EDayZProfilesOptions.HUD) || m_ShowCrosshairSelector.GetValue() != g_Game.GetProfileOptionBool(EDayZProfilesOptions.CROSSHAIR));
172 universal = universal || m_HUDBrightnessSelector.GetValue() != g_Game.GetProfileOptionFloat(EDayZProfilesOptions.HUD_BRIGHTNESS);
173 universal = universal || (m_ShowGameSelector.GetValue() != g_Game.GetProfileOptionBool(EDayZProfilesOptions.GAME_MESSAGES) || m_ShowAdminSelector.GetValue() != g_Game.GetProfileOptionBool(EDayZProfilesOptions.ADMIN_MESSAGES));
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();
178
179#ifdef PLATFORM_CONSOLE
180 return universal;
181#else
182 return (universal || m_ShowQuickbarSelector.GetValue() != g_Game.GetProfileOptionBool(EDayZProfilesOptions.QUICKBAR) || m_ShowServerInfoSelector.GetValue() != g_Game.GetProfileOptionBool(EDayZProfilesOptions.SERVERINFO_DISPLAY));
183#endif
184 }
185
186 void Apply()
187 {
188 IngameHud hud = GetHud();
189 InGameMenu menu = InGameMenu.Cast(GetGame().GetUIManager().FindMenu(MENU_INGAME));
190 MissionGameplay mission = MissionGameplay.Cast(GetGame().GetMission());
191
192 g_Game.SetProfileOptionBool(EDayZProfilesOptions.HUD, m_ShowHUDSelector.GetValue());
193 g_Game.SetProfileOptionBool(EDayZProfilesOptions.CROSSHAIR, m_ShowCrosshairSelector.GetValue());
194 g_Game.SetProfileOptionBool(EDayZProfilesOptions.GAME_MESSAGES, m_ShowGameSelector.GetValue());
195 g_Game.SetProfileOptionBool(EDayZProfilesOptions.ADMIN_MESSAGES, m_ShowAdminSelector.GetValue());
196 g_Game.SetProfileOptionBool(EDayZProfilesOptions.PLAYER_MESSAGES, m_ShowPlayerSelector.GetValue());
197 g_Game.SetProfileOptionFloat(EDayZProfilesOptions.HUD_BRIGHTNESS, m_HUDBrightnessSelector.GetValue());
198
199#ifndef PLATFORM_CONSOLE
200 g_Game.SetProfileOptionBool(EDayZProfilesOptions.QUICKBAR, m_ShowQuickbarSelector.GetValue());
201 g_Game.SetProfileOptionBool(EDayZProfilesOptions.SERVERINFO_DISPLAY, m_ShowServerInfoSelector.GetValue());
202#endif
203
204 if (hud)
205 {
206#ifndef PLATFORM_CONSOLE
207 hud.ShowQuickBar(m_ShowQuickbarSelector.GetValue());
208#else
209 hud.ShowQuickBar(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
210#endif
211 hud.ShowHud(m_ShowHUDSelector.GetValue());
212 }
213
214 bool bleedingIndicationOld = g_Game.GetProfileOptionBool(EDayZProfilesOptions.BLEEDINGINDICATION);
215 bool bleedingIndicationNew = m_BleedingIndication.GetValue();
216 bool connectivityOld = g_Game.GetProfileOptionBool(EDayZProfilesOptions.CONNECTIVITY_INFO);
217 bool connectivityNew = m_ConnectivityInfo.GetValue();
218
219 g_Game.SetProfileOptionBool(EDayZProfilesOptions.BLEEDINGINDICATION, bleedingIndicationNew);
220 g_Game.SetProfileOptionBool(EDayZProfilesOptions.CONNECTIVITY_INFO, connectivityNew);
221
222 if (mission)
223 {
224 //BLEEDINGINDICATION changed
227
228 //CONNECTIVITY_INFO changed
230 mission.GetConnectivityInvoker().Invoke(connectivityNew);
231 }
232
233#ifndef PLATFORM_CONSOLE
234 if (menu)
235 menu.SetServerInfoVisibility(m_ShowServerInfoSelector.GetValue());
236#endif
237
238 if (m_LanguageOption.IsChanged()) //language changed
239 {
240 if (mission)
242 else
243 ErrorEx("mission not found!", ErrorExSeverity.INFO);
244 }
245 }
246
247 void Revert()
248 {
249 if (m_ShowHUDSelector)
250 m_ShowHUDSelector.SetValue(g_Game.GetProfileOptionBool(EDayZProfilesOptions.HUD), false);
251
253
254 if (m_ShowCrosshairSelector)
255 m_ShowCrosshairSelector.SetValue(g_Game.GetProfileOptionBool(EDayZProfilesOptions.CROSSHAIR), false);
256 if (m_FOVOption)
257 {
258 m_FOVSelector.SetValue(m_FOVOption.ReadValue(), false);
259 g_Game.SetUserFOV(m_FOVOption.ReadValue());
260 }
261 if (m_LanguageOption)
262 m_LanguageSelector.SetValue(m_LanguageOption.GetIndex(), false);
263 if (m_ShowGameSelector)
264 m_ShowGameSelector.SetValue(g_Game.GetProfileOptionBool(EDayZProfilesOptions.GAME_MESSAGES), false);
265 if (m_ShowAdminSelector)
266 m_ShowAdminSelector.SetValue(g_Game.GetProfileOptionBool(EDayZProfilesOptions.ADMIN_MESSAGES), false);
267 if (m_ShowPlayerSelector)
268 m_ShowPlayerSelector.SetValue(g_Game.GetProfileOptionBool(EDayZProfilesOptions.PLAYER_MESSAGES), false);
269 if (m_BleedingIndication)
270 m_BleedingIndication.SetValue(g_Game.GetProfileOptionBool(EDayZProfilesOptions.BLEEDINGINDICATION), false);
271 if (m_ConnectivityInfo)
272 m_ConnectivityInfo.SetValue(g_Game.GetProfileOptionBool(EDayZProfilesOptions.CONNECTIVITY_INFO), false);
273
274#ifdef PLATFORM_CONSOLE
275 if (m_BrightnessSelector)
276 m_BrightnessSelector.SetValue(m_BrightnessOption.ReadValue(), false);
277#else
278 if (m_ShowQuickbarSelector)
279 m_ShowQuickbarSelector.SetValue(g_Game.GetProfileOptionBool(EDayZProfilesOptions.QUICKBAR), false);
280 if (m_ShowServerInfoSelector)
281 m_ShowServerInfoSelector.SetValue(g_Game.GetProfileOptionBool(EDayZProfilesOptions.SERVERINFO_DISPLAY), false);
282 if (m_PauseOption)
283 m_PauseSelector.SetValue(m_PauseOption.GetIndex(), false);
284#endif
285 }
286
288 {
289 g_Game.ResetProfileOptions();
290
291 if (m_ShowHUDSelector)
292 m_ShowHUDSelector.SetValue(g_Game.GetProfileOptionDefaultBool(EDayZProfilesOptions.HUD), false);
293
294 if (m_HUDBrightnessSelector)
295 {
296 m_HUDBrightnessSelector.SetValue(g_Game.GetProfileOptionDefaultFloat(EDayZProfilesOptions.HUD_BRIGHTNESS), false);
297 g_Game.SetHudBrightness(m_HUDBrightnessSelector.GetValue());
298 }
299
300 if (m_ShowCrosshairSelector)
301 m_ShowCrosshairSelector.SetValue(g_Game.GetProfileOptionDefaultBool(EDayZProfilesOptions.CROSSHAIR), false);
302
303 if (m_FOVOption)
304 {
305 m_FOVOption.WriteValue(m_FOVOption.GetDefault());
306 m_FOVSelector.SetValue(m_FOVOption.ReadValue(), false);
307 g_Game.SetUserFOV(m_FOVOption.GetDefault());
308 }
309 if (m_ShowGameSelector)
310 m_ShowGameSelector.SetValue(g_Game.GetProfileOptionDefaultBool(EDayZProfilesOptions.GAME_MESSAGES), false);
311 if (m_ShowAdminSelector)
312 m_ShowAdminSelector.SetValue(g_Game.GetProfileOptionDefaultBool(EDayZProfilesOptions.ADMIN_MESSAGES), false);
313 if (m_ShowPlayerSelector)
314 m_ShowPlayerSelector.SetValue(g_Game.GetProfileOptionDefaultBool(EDayZProfilesOptions.PLAYER_MESSAGES), false);
315 if (m_BleedingIndication)
316 m_BleedingIndication.SetValue(g_Game.GetProfileOptionDefaultBool(EDayZProfilesOptions.BLEEDINGINDICATION), false);
317 if (m_ConnectivityInfo)
318 m_ConnectivityInfo.SetValue(g_Game.GetProfileOptionDefaultBool(EDayZProfilesOptions.CONNECTIVITY_INFO), false);
319
320#ifdef PLATFORM_CONSOLE
321 if (m_BrightnessSelector)
322 {
323 m_BrightnessOption.WriteValue(m_BrightnessOption.GetDefault());
324 m_BrightnessSelector.SetValue(m_BrightnessOption.GetDefault(), false);
325 }
326#else
327 if (m_ShowQuickbarSelector)
328 m_ShowQuickbarSelector.SetValue(g_Game.GetProfileOptionDefaultBool(EDayZProfilesOptions.QUICKBAR), false);
329 if (m_ShowServerInfoSelector)
330 m_ShowServerInfoSelector.SetValue(g_Game.GetProfileOptionDefaultBool(EDayZProfilesOptions.SERVERINFO_DISPLAY), false);
331 if (m_PauseOption)
332 {
333 m_PauseOption.SetIndex(m_PauseOption.GetDefaultIndex());
334 m_PauseSelector.SetValue(m_PauseOption.GetIndex(), false);
335 }
336#endif
337 }
338
340 {
341 m_Menu.ReloadOptions();
342 }
343
345 {
346 m_Options = options;
347
348 m_FOVOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_FIELD_OF_VIEW));
349 m_LanguageOption = ListOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_LANGUAGE));
350
351 if (m_FOVSelector)
352 m_FOVSelector.SetValue(m_FOVOption.ReadValue(), false);
353
354 if (m_LanguageOption)
355 m_LanguageSelector.SetValue(m_LanguageOption.GetIndex(), false);
356
357#ifdef PLATFORM_CONSOLE
358 m_BrightnessOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER));
359 if (m_BrightnessOption)
360 m_BrightnessSelector.SetValue(m_BrightnessOption.ReadValue(), false);
361#endif
362 }
363
365 {
366 }
367
369 {
370#ifdef PLATFORM_CONSOLE
371 m_QuickbarButton.Show(false);
372#endif
373 }
374
375 protected void UpdateLanguageOption(int new_index)
376 {
377 m_LanguageOption.SetIndex(new_index);
378 m_Menu.OnChanged();
379
380 TextMapUpdateWidget(OptionAccessType.AT_OPTIONS_LANGUAGE);
381 }
382
383 protected void UpdatePauseOption(int new_index)
384 {
385 m_PauseOption.SetIndex(new_index);
386 m_Menu.OnChanged();
387 }
388
389 protected void UpdateFOVOption(float new_value)
390 {
391 m_FOVOption.WriteValue(new_value);
392 g_Game.SetUserFOV(new_value);
393 m_Menu.OnChanged();
394 }
395
397 {
398 g_Game.SetHudBrightness(newValue);
399 m_Menu.OnChanged();
400 }
401
402 protected void UpdateHUDOption(int new_index)
403 {
404 m_Menu.OnChanged();
405 }
406
408 {
409 m_Menu.OnChanged();
410 }
411
413 {
414 m_Menu.OnChanged();
415 }
416
418 {
419 m_Menu.OnChanged();
420 }
421
422 protected void UpdateQuickbarOption(int new_index)
423 {
424 m_Menu.OnChanged();
425 }
426
427 protected void UpdateGameOption(int new_index)
428 {
429 m_Menu.OnChanged();
430 }
431
432 protected void UpdateAdminOption(int new_index)
433 {
434 m_Menu.OnChanged();
435 }
436
437 protected void UpdatePlayerOption(int new_index)
438 {
439 m_Menu.OnChanged();
440 }
441
443 {
444 m_Menu.OnChanged();
445 }
446
447 IngameHud GetHud()
448 {
449 Mission mission = GetGame().GetMission();
450 if (mission)
451 {
452 IngameHud hud = IngameHud.Cast(mission.GetHud());
453 return hud;
454 }
455 return null;
456 }
457
458#ifdef PLATFORM_CONSOLE
459 void UpdateBrightnessOption(float value)
460 {
461 m_BrightnessOption.WriteValue(value);
462 m_Menu.OnChanged();
463 }
464#endif
465
466 override bool OnMouseEnter(Widget w, int x, int y)
467 {
468 if (w && w.IsInherited(ScrollWidget))
469 return false;
470
471 if (w && w.IsInherited(SliderWidget))
472 return false;
473
474 m_Menu.ColorHighlight(w);
475
476 return true;
477 }
478
479 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
480 {
481 if (w && w.IsInherited(ScrollWidget))
482 return false;
483
484 m_Menu.ColorNormal(w);
485 return true;
486 }
487
488 override bool OnFocus(Widget w, int x, int y)
489 {
490 if (m_Menu)
491 m_Menu.OnFocus(w, x, y);
492
493 if (w)
494 {
495 if (TextMapUpdateWidget(w.GetUserID()))
496 return true;
497
498 if (w.IsInherited(SliderWidget))
499 return true;
500 }
501 m_DetailsRoot.Show(false);
502 return (w != null);
503 }
504
506 {
507 MissionGameplay mission = MissionGameplay.Cast(GetGame().GetMission());
508 if (mission)
509 {
512 }
513 }
514
516 {
517 bool connectivityInfoShown = key == OptionIDsScript.OPTION_CONNECTIVITY_INFO;
519 Param tmp = m_TextMap.Get(key);
520
521 m_DetailsBodyDefault.Show(!connectivityInfoShown);
522 m_DetailsBodyConnectivity.Show(connectivityInfoShown);
523
524 if (Class.CastTo(p, tmp))
525 {
526 m_DetailsRoot.Show(true);
527 m_DetailsText.Show(true);
528 m_DetailsLabel.SetText(p.param1);
529 m_DetailsText.SetText(p.param2);
530
531 m_DetailsText.Update();
532 m_DetailsLabel.Update();
533 m_DetailsRoot.Update();
534 m_DetailsBodyConnectivity.Update(); //...
535 return true;
536 }
537 return false;
538 }
539
541 {
543 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_LANGUAGE, new Param2<string, string>("#options_game_select_language", "#options_game_select_language_desc"));
544 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_FIELD_OF_VIEW, new Param2<string, string>("#options_game_field_of_view", "#options_game_field_of_view_desc"));
545 m_TextMap.Insert(OptionIDsScript.OPTION_HUD, new Param2<string, string>("#options_game_show_HUD", "#options_game_show_HUD_desc"));
546 m_TextMap.Insert(OptionIDsScript.OPTION_HUD_BRIGHTNESS, new Param2<string, string>("#options_game_hud_brightness", "#options_game_hud_brightness_desc"));
547 m_TextMap.Insert(OptionIDsScript.OPTION_CROSSHAIR, new Param2<string, string>("#options_game_show_crosshair", "#options_game_show_crosshair_desc"));
548 m_TextMap.Insert(OptionIDsScript.OPTION_QUICKBAR, new Param2<string, string>("#options_game_show_quickbar", "#options_game_show_quickbar_desc"));
549 m_TextMap.Insert(OptionIDsScript.OPTION_SERVER_INFO, new Param2<string, string>("#options_game_show_serverinfo", "#options_game_show_serverinfo_desc"));
550 m_TextMap.Insert(OptionIDsScript.OPTION_BLEEDINGINDICATION, new Param2<string, string>("#options_game_show_bleedingindication", "#options_game_show_bleedingindication_desc"));
551 m_TextMap.Insert(OptionIDsScript.OPTION_CONNECTIVITY_INFO, new Param2<string, string>("#options_game_connectivity", ""));
552
553#ifdef PLATFORM_WINDOWS
554 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_PAUSE, new Param2<string, string>("#layout_options_pc_nopause_title", "#layout_options_pc_nopause_tooltip"));
555 m_TextMap.Insert(OptionIDsScript.OPTION_GAME_MESSAGES, new Param2<string, string>("#options_pc_game_messages", "#options_game_show_game_msg"));
556 m_TextMap.Insert(OptionIDsScript.OPTION_ADMIN_MESSAGES, new Param2<string, string>("#options_pc_admin_mes", "#options_game_show_admin_msg"));
557 m_TextMap.Insert(OptionIDsScript.OPTION_PLAYER_MESSAGES, new Param2<string, string>("#options_pc_player_messages", "#options_game_show_player_msg"));
558#else
559#ifdef PLATFORM_XBOX
560 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER, new Param2<string, string>("#options_video_brightness", "#options_video_brightness_desc"));
561 m_TextMap.Insert(OptionIDsScript.OPTION_GAME_MESSAGES, new Param2<string, string>("#options_xbox_game_messages", "#options_game_show_game_msg"));
562 m_TextMap.Insert(OptionIDsScript.OPTION_ADMIN_MESSAGES, new Param2<string, string>("#options_xbox_admin_mes", "#options_game_show_admin_msg"));
563 m_TextMap.Insert(OptionIDsScript.OPTION_PLAYER_MESSAGES, new Param2<string, string>("#options_xbox_player_messages", "#options_game_show_player_msg"));
564#else
565#ifdef PLATFORM_PS4
566 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_BRIGHT_SLIDER, new Param2<string, string>("#ps4_options_video_brightness", "#ps4_options_video_brightness_desc"));
567 m_TextMap.Insert(OptionIDsScript.OPTION_GAME_MESSAGES, new Param2<string, string>("#ps4_options_game_messages", "#ps4_options_game_show_game_msg"));
568 m_TextMap.Insert(OptionIDsScript.OPTION_ADMIN_MESSAGES, new Param2<string, string>("#ps4_options_admin_mes", "#ps4_options_game_show_admin_msg"));
569 m_TextMap.Insert(OptionIDsScript.OPTION_PLAYER_MESSAGES, new Param2<string, string>("#ps4_options_player_messages", "#ps4_options_game_show_player_msg"));
570#endif
571#endif
572#endif
573 }
574
575 private void RevertHUDBrightness()
576 {
577 if (m_HUDBrightnessSelector)
578 {
579 m_HUDBrightnessSelector.SetValue(g_Game.GetProfileOptionFloat(EDayZProfilesOptions.HUD_BRIGHTNESS), false);
580 g_Game.SetHudBrightness(m_HUDBrightnessSelector.GetValue());
581 }
582 }
583}
ActionInput GetInput()
Definition ActionBase.c:989
DayZGame g_Game
Definition DayZGame.c:3528
Mission mission
EDayZProfilesOptions
Icon x
Icon y
ServerBrowserMenuNew m_Menu
Widget m_Root
Definition SizeToChild.c:85
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native OptionsAccess GetOptionByType(int accessType)
Get option by AccessType.
override void UpdateWidgets(int type=-1, float timeSlice=0, Param p=null, int handle=-1)
Usually called in course of an OnFrame update, can be manually called from elsewhere with parameters.
Mission class.
Definition gameplay.c:668
Hud GetHud()
Definition gameplay.c:701
GameplayEffectWidgets_base GetEffectWidgets()
Definition gameplay.c:822
void ResetGUI()
Definition gameplay.c:698
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
map: item x vector(index, width, height)
Definition EnWidgets.c:651
ref OptionSelectorMultistate m_ShowCrosshairSelector
void UpdateCrosshairOption(int new_index)
ref OptionSelectorSlider m_HUDBrightnessSelector
void UpdateConnectivityInfo(int newIndex)
void OptionsMenuGame(Widget parent, Widget details_root, GameOptions options, OptionsMenu menu)
void UpdateBleedingIndication(int new_index)
void UpdateHUDBrightnessOption(float newValue)
void ToggleDependentOptions(int mode, bool state)
ref OptionSelectorMultistate m_ShowGameSelector
ref NumericOptionsAccess m_FOVOption
ref OptionSelectorMultistate m_LanguageSelector
ref OptionSelectorMultistate m_BleedingIndication
void UpdateQuickbarOption(int new_index)
void SetOptions(GameOptions options)
void UpdatePauseOption(int new_index)
ref OptionSelectorSlider m_FOVSelector
ref OptionSelectorMultistate m_ShowQuickbarSelector
void UpdateGameOption(int new_index)
ref OptionSelectorMultistate m_PauseSelector
CameraToolsMenu m_Menu
Definition CTEvent.c:8
void OnBleedingIndicationChanged(bool state)
ref OptionSelectorMultistate m_ShowServerInfoSelector
void UpdateHUDOption(int new_index)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
void UpdateLanguageOption(int new_index)
ref ListOptionsAccess m_PauseOption
ref map< int, ref Param2< string, string > > m_TextMap
ref OptionSelectorSlider m_BrightnessSelector
ref OptionSelectorMultistate m_ShowAdminSelector
void UpdateServerInfoOption(int new_index)
void UpdatePlayerOption(int new_index)
override bool OnFocus(Widget w, int x, int y)
ref ListOptionsAccess m_LanguageOption
override bool OnMouseEnter(Widget w, int x, int y)
ref OptionSelectorMultistate m_ShowPlayerSelector
ref OptionSelectorMultistate m_ConnectivityInfo
ref OptionSelectorMultistate m_ShowHUDSelector
void UpdateFOVOption(float new_value)
void UpdateAdminOption(int new_index)
ref NumericOptionsAccess m_BrightnessOption
OptionIDsScript
Used for script-based game options. For anything C++ based, you would most likely use "Option Access ...
Definition gameplay.c:1246
proto native CGame GetGame()
OptionAccessType
C++ OptionAccessType.
Definition gameplay.c:1182
ErrorExSeverity
Definition EnDebug.c:62
enum ShapeType ErrorEx
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int MENU_INGAME
Definition constants.c:168
proto native void SetFocus(Widget w)