DayZ 1.24
Loading...
Searching...
No Matches
OptionsMenuControls.c
Go to the documentation of this file.
1class OptionsMenuControls extends ScriptedWidgetEventHandler
2{
3 protected Widget m_Root;
4
6 protected Widget m_DetailsRoot;
9#ifdef PLATFORM_CONSOLE
10 protected bool m_MaKOptionAvailable;
13#endif
17
19 protected OptionsMenu m_Menu;
20
21 // console options accessors
24
25 // console options selectors
26 protected ref OptionSelectorMultistate m_KeyboardSelector;
27 protected ref OptionSelectorMultistate m_AimHelperSelector;
28
29 // mouse accessors
35
36 // mouse selectors
37 protected ref OptionSelectorMultistate m_Mouse_InvertSelector;
38 protected ref OptionSelectorSlider m_Mouse_VSensitivitySelector;
39 protected ref OptionSelectorSlider m_Mouse_HSensitivitySelector;
40 protected ref OptionSelectorSlider m_Mouse_AimMod_VSensitivitySelector;
41 protected ref OptionSelectorSlider m_Mouse_AimMod_HSensitivitySelector;
42
43 // gamepad/controller accessors
54
55 // gamepad/controller selectors
56 protected ref OptionSelectorSlider m_ControllerLS_VSensitivitySelector;
57 protected ref OptionSelectorSlider m_ControllerLS_HSensitivitySelector;
59 protected ref OptionSelectorMultistate m_ControllerRS_InvertSelector;
60 protected ref OptionSelectorSlider m_ControllerRS_VSensitivitySelector;
61 protected ref OptionSelectorSlider m_ControllerRS_HSensitivitySelector;
62 protected ref OptionSelectorSlider m_ControllerRS_CurvatureSelector;
63 protected ref OptionSelectorSlider m_ControllerRS_AimMod_VSensitivitySelector;
64 protected ref OptionSelectorSlider m_ControllerRS_AimMod_HSensitivitySelector;
65 protected ref OptionSelectorSlider m_ControllerRS_AimMod_CurvatureSelector;
66
68
69 static const float SLIDER_STEP = 0.025;
70
72 {
73 array<string> opt = { "#options_controls_disabled", "#options_controls_enabled" };
74
75 m_Root = GetGame().GetWorkspace().CreateWidgets(GetLayoutName(), parent);
76 m_Options = options;
77 m_Menu = menu;
78
79 m_DetailsRoot = details_root;
80 m_DetailsBodyDefault = m_DetailsRoot.FindAnyWidget("settings_details_body");
81 m_DetailsBodyConnectivity = m_DetailsRoot.FindAnyWidget("settings_details_body_connectivity");
82 m_DetailsLabel = TextWidget.Cast(m_DetailsRoot.FindAnyWidget("details_label"));
83 m_DetailsText = RichTextWidget.Cast(m_DetailsRoot.FindAnyWidget("details_content"));
84 m_Keybindings = GridSpacerWidget.Cast(m_Root.FindAnyWidget("keyboard_settings_content"));
85 if (m_Keybindings)
86 m_Keybindings.SetUserID(777);
87
89
90 // mouse (PC & consoles)
91 Widget mouse_InvertSettingOption = m_Root.FindAnyWidget("mouse_invert_setting_option");
92 Widget mouse_VSensitivitySettingOption = m_Root.FindAnyWidget("mouse_vsensitivity_setting_option");
93 Widget mouse_HSensitivitySettingOption = m_Root.FindAnyWidget("mouse_hsensitivity_setting_option");
94 Widget mouse_AimMod_VSensitivitySettingOption = m_Root.FindAnyWidget("mouse_aimmod_vsensitivity_setting_option");
95 Widget mouse_AimMod_HSensitivitySettingOption = m_Root.FindAnyWidget("mouse_aimmod_hsensitivity_setting_option");
96
97 mouse_InvertSettingOption.SetUserID(OptionAccessType.AT_OPTIONS_MOUSE_YAXIS_INVERTED);
98 mouse_VSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_MOUSE_YAXIS);
99 mouse_HSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_MOUSE_XAXIS);
100 mouse_AimMod_VSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_MOUSE_YAXIS_AIM_MOD);
101 mouse_AimMod_HSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_MOUSE_XAXIS_AIM_MOD);
102
103 m_Mouse_InvertSelector = new OptionSelectorMultistate(mouse_InvertSettingOption, m_Mouse_InvertOption.GetIndex(), this, false, opt);
104 m_Mouse_VSensitivitySelector = new OptionSelectorSlider(mouse_VSensitivitySettingOption, m_Mouse_VSensitivityOption.ReadValue(), this, false, m_Mouse_VSensitivityOption.GetMin(), m_Mouse_VSensitivityOption.GetMax());
105 m_Mouse_VSensitivitySelector.SetStep(SLIDER_STEP);
106 m_Mouse_HSensitivitySelector = new OptionSelectorSlider(mouse_HSensitivitySettingOption, m_Mouse_HSensitivityOption.ReadValue(), this, false, m_Mouse_HSensitivityOption.GetMin(), m_Mouse_HSensitivityOption.GetMax());
107 m_Mouse_HSensitivitySelector.SetStep(SLIDER_STEP);
108 m_Mouse_AimMod_VSensitivitySelector = new OptionSelectorSlider(mouse_AimMod_VSensitivitySettingOption, m_Mouse_AimMod_VSensitivityOption.ReadValue(), this, false, m_Mouse_AimMod_VSensitivityOption.GetMin(), m_Mouse_AimMod_VSensitivityOption.GetMax());
109 m_Mouse_AimMod_VSensitivitySelector.SetStep(SLIDER_STEP);
110 m_Mouse_AimMod_HSensitivitySelector = new OptionSelectorSlider(mouse_AimMod_HSensitivitySettingOption, m_Mouse_AimMod_HSensitivityOption.ReadValue(), this, false, m_Mouse_AimMod_HSensitivityOption.GetMin(), m_Mouse_AimMod_HSensitivityOption.GetMax());
111 m_Mouse_AimMod_HSensitivitySelector.SetStep(SLIDER_STEP);
112
113 m_Mouse_InvertSelector.m_OptionChanged.Insert(UpdateMouseInvertView);
114 m_Mouse_VSensitivitySelector.m_OptionChanged.Insert(UpdateMouseVSensitivity);
115 m_Mouse_HSensitivitySelector.m_OptionChanged.Insert(UpdateMouseHSensitivity);
116 m_Mouse_AimMod_VSensitivitySelector.m_OptionChanged.Insert(UpdateMouseAimModVSensitivity);
117 m_Mouse_AimMod_HSensitivitySelector.m_OptionChanged.Insert(UpdateMouseAimModHSensitivity);
118
119 // controller (consoles only)
120#ifdef PLATFORM_CONSOLE
121 m_MaKOptionAvailable = g_Game.GetGameState() != DayZGameState.IN_GAME || GetGame().GetWorld().IsMouseAndKeyboardEnabledOnServer();
122 m_ConsoleControllerSensitivityWidget = m_Root.FindAnyWidget("controller_settings_root");
123 m_ConsoleMouseSensitivityWidget = m_Root.FindAnyWidget("mouse_settings_root");
124
125 Widget keyboardSettingOption = m_Root.FindAnyWidget("keyboard_setting_option");
126 Widget aimHelperSettingOption = m_Root.FindAnyWidget("aimhelper_setting_option");
127
128 Widget controllerLS_VSensitivitySettingOption = m_Root.FindAnyWidget("controller_ls_vsensitivity_setting_option");
129 Widget controllerLS_HSensitivitySettingOption = m_Root.FindAnyWidget("controller_ls_hsensitivity_setting_option");
130 Widget controllerLS_VehicleMod_HSensitivitySettingOption = m_Root.FindAnyWidget("controller_ls_vehicle_sensitivity_setting_option");
131 Widget controllerRS_InvertSettingOption = m_Root.FindAnyWidget("controller_rs_invert_setting_option");
132 Widget controllerRS_VSensitivitySettingOption = m_Root.FindAnyWidget("controller_rs_vsensitivity_setting_option");
133 Widget controllerRS_HSensitivitySettingOption = m_Root.FindAnyWidget("controller_rs_hsensitivity_setting_option");
134 Widget controllerRS_CurvatureSettingOption = m_Root.FindAnyWidget("controller_rs_curvature_setting_option");
135 Widget controllerRS_AimMod_VSensitivitySettingOption = m_Root.FindAnyWidget("controller_rs_aimmod_vsensitivity_setting_option");
136 Widget controllerRS_AimMod_HSensitivitySettingOption = m_Root.FindAnyWidget("controller_rs_aimmod_hsensitivity_setting_option");
137 Widget controllerRS_AimMod_CurvatureSettingOption = m_Root.FindAnyWidget("controller_rs_aimmod_curvature_setting_option");
138
139 keyboardSettingOption.SetUserID(OptionAccessType.AT_OPTIONS_MOUSE_AND_KEYBOARD);
140 aimHelperSettingOption.SetUserID(OptionAccessType.AT_OPTIONS_AIM_HELPER);
141
142 controllerLS_VSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_LS_YAXIS);
143 controllerLS_HSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_LS_XAXIS);
144 controllerLS_VehicleMod_HSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_LS_XAXIS_VEHICLE_MOD);
145 controllerRS_InvertSettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_YAXIS_INVERTED);
146 controllerRS_VSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_YAXIS);
147 controllerRS_HSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_XAXIS);
148 controllerRS_CurvatureSettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_CURVATURE);
149 controllerRS_AimMod_VSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_YAXIS_AIM_MOD);
150 controllerRS_AimMod_HSensitivitySettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_XAXIS_AIM_MOD);
151 controllerRS_AimMod_CurvatureSettingOption.SetUserID(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_CURVATURE_AIM_MOD);
152
153 m_KeyboardSelector = new OptionSelectorMultistate(keyboardSettingOption, m_KeyboardOption.GetIndex(), this, !m_MaKOptionAvailable, opt);
154 m_AimHelperSelector = new OptionSelectorMultistate(aimHelperSettingOption, m_AimHelperOption.GetIndex(), this, false, opt);
155
156 m_ControllerLS_VSensitivitySelector = new OptionSelectorSlider(controllerLS_VSensitivitySettingOption, m_ControllerLS_VSensitivityOption.ReadValue(), this, false, m_ControllerLS_VSensitivityOption.GetMin(), m_ControllerLS_VSensitivityOption.GetMax());
157 m_ControllerLS_VSensitivitySelector.SetStep(SLIDER_STEP);
158 m_ControllerLS_HSensitivitySelector = new OptionSelectorSlider(controllerLS_HSensitivitySettingOption, m_ControllerLS_HSensitivityOption.ReadValue(), this, false, m_ControllerLS_HSensitivityOption.GetMin(), m_ControllerLS_HSensitivityOption.GetMax());
159 m_ControllerLS_HSensitivitySelector.SetStep(SLIDER_STEP);
160 m_ControllerLS_VehicleMod_HSensitivitySelector = new OptionSelectorSlider(controllerLS_VehicleMod_HSensitivitySettingOption, m_ControllerLS_VehicleMod_HSensitivityOption.ReadValue(), this, false, m_ControllerLS_VehicleMod_HSensitivityOption.GetMin(), m_ControllerLS_VehicleMod_HSensitivityOption.GetMax());
161 m_ControllerLS_VehicleMod_HSensitivitySelector.SetStep(SLIDER_STEP);
162 m_ControllerRS_InvertSelector = new OptionSelectorMultistate(controllerRS_InvertSettingOption, m_ControllerRS_InvertOption.GetIndex(), this, false, opt);
163 m_ControllerRS_VSensitivitySelector = new OptionSelectorSlider(controllerRS_VSensitivitySettingOption, m_ControllerRS_VSensitivityOption.ReadValue(), this, false, m_ControllerRS_VSensitivityOption.GetMin(), m_ControllerRS_VSensitivityOption.GetMax());
164 m_ControllerRS_VSensitivitySelector.SetStep(SLIDER_STEP);
165 m_ControllerRS_HSensitivitySelector = new OptionSelectorSlider(controllerRS_HSensitivitySettingOption, m_ControllerRS_HSensitivityOption.ReadValue(), this, false, m_ControllerRS_HSensitivityOption.GetMin(), m_ControllerRS_HSensitivityOption.GetMax());
166 m_ControllerRS_HSensitivitySelector.SetStep(SLIDER_STEP);
167 m_ControllerRS_CurvatureSelector = new OptionSelectorSlider(controllerRS_CurvatureSettingOption, m_ControllerRS_CurvatureOption.ReadValue(), this, false, m_ControllerRS_CurvatureOption.GetMin(), m_ControllerRS_CurvatureOption.GetMax());
168 m_ControllerRS_CurvatureSelector.SetStep(SLIDER_STEP);
169 m_ControllerRS_AimMod_VSensitivitySelector = new OptionSelectorSlider(controllerRS_AimMod_VSensitivitySettingOption, m_ControllerRS_AimMod_VSensitivityOption.ReadValue(), this, false, m_ControllerRS_AimMod_VSensitivityOption.GetMin(), m_ControllerRS_AimMod_VSensitivityOption.GetMax());
170 m_ControllerRS_AimMod_VSensitivitySelector.SetStep(SLIDER_STEP);
171 m_ControllerRS_AimMod_HSensitivitySelector = new OptionSelectorSlider(controllerRS_AimMod_HSensitivitySettingOption, m_ControllerRS_AimMod_HSensitivityOption.ReadValue(), this, false, m_ControllerRS_AimMod_HSensitivityOption.GetMin(), m_ControllerRS_AimMod_HSensitivityOption.GetMax());
172 m_ControllerRS_AimMod_HSensitivitySelector.SetStep(SLIDER_STEP);
173 m_ControllerRS_AimMod_CurvatureSelector = new OptionSelectorSlider(controllerRS_AimMod_CurvatureSettingOption, m_ControllerRS_AimMod_CurvatureOption.ReadValue(), this, false, m_ControllerRS_AimMod_CurvatureOption.GetMin(), m_ControllerRS_AimMod_CurvatureOption.GetMax());
174 m_ControllerRS_AimMod_CurvatureSelector.SetStep(SLIDER_STEP);
175
176 m_KeyboardSelector.m_OptionChanged.Insert(UpdateKeyboard);
177 m_AimHelperSelector.m_OptionChanged.Insert(UpdateAimHelper);
178
179 m_ControllerLS_VSensitivitySelector.m_OptionChanged.Insert(UpdateControllerLS_VSensitivity);
180 m_ControllerLS_HSensitivitySelector.m_OptionChanged.Insert(UpdateControllerLS_HSensitivity);
181 m_ControllerLS_VehicleMod_HSensitivitySelector.m_OptionChanged.Insert(UpdateControllerLS_VehicleMod_HSensitivity);
182 m_ControllerRS_InvertSelector.m_OptionChanged.Insert(UpdateControllerRS_InvertView);
183 m_ControllerRS_VSensitivitySelector.m_OptionChanged.Insert(UpdateControllerRS_VSensitivity);
184 m_ControllerRS_HSensitivitySelector.m_OptionChanged.Insert(UpdateControllerRS_HSensitivity);
185 m_ControllerRS_CurvatureSelector.m_OptionChanged.Insert(UpdateControllerRS_Curvature);
186 m_ControllerRS_AimMod_VSensitivitySelector.m_OptionChanged.Insert(UpdateControllerRS_AimMod_VSensitivity);
187 m_ControllerRS_AimMod_HSensitivitySelector.m_OptionChanged.Insert(UpdateControllerRS_AimMod_HSensitivity);
188 m_ControllerRS_AimMod_CurvatureSelector.m_OptionChanged.Insert(UpdateControllerRS_AimMod_Curvature);
189
190 ShowConsoleSensitivityOptions(m_KeyboardOption.GetIndex());
191
192 bool MaKState = m_KeyboardSelector.IsEnabled() && GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
193 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(m_Menu.ToggleDependentOptions, EDependentOptions.MOUSEANDKEYBOARD_QUICKBAR, MaKState);
194#endif
195
196 FillTextMap();
197
198 float x, y, y2;
199 m_Root.FindAnyWidget("controls_settings_scroll").GetScreenSize(x, y);
200 m_Root.FindAnyWidget("controls_settings_root").GetScreenSize(x, y2);
201 int f = (y2 > y);
202 m_Root.FindAnyWidget("controls_settings_scroll").SetAlpha(f);
203
204 m_Root.SetHandler(this);
205 }
206
208 {
209#ifdef PLATFORM_CONSOLE
210 return "gui/layouts/new_ui/options/xbox/controls_tab.layout";
211#else
212 return "gui/layouts/new_ui/options/pc/controls_tab.layout";
213#endif
214 }
215
217 {
218 m_Menu.EnterScriptedMenu(MENU_KEYBINDINGS);
219 }
220
222 void Focus()
223 {
224#ifdef PLATFORM_CONSOLE
225 if (m_KeyboardSelector && m_KeyboardSelector.IsSelectorEnabled())
226 m_KeyboardSelector.Focus();
227 else if (m_AimHelperSelector)
228 m_AimHelperSelector.Focus();
229#endif
230 }
231
232 override bool OnMouseEnter(Widget w, int x, int y)
233 {
234 if (w && w.IsInherited(ScrollWidget))
235 return false;
236
237 m_Menu.ColorHighlight(w);
238
239 return true;
240 }
241
242 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
243 {
244 if (w && w.IsInherited(ScrollWidget))
245 return false;
246
247 m_Menu.ColorNormal(w);
248 return true;
249 }
250
251 override bool OnMouseButtonUp(Widget w, int x, int y, int button)
252 {
253 if (button == MouseState.LEFT)
254 {
255#ifndef PLATFORM_CONSOLE
256 if (w == m_Keybindings)
257 {
259 return true;
260 }
261#endif
262 }
263 return false;
264 }
265
266 override bool OnFocus(Widget w, int x, int y)
267 {
268 OptionsMenu menu = OptionsMenu.Cast(GetGame().GetUIManager().GetMenu());
269 if (menu)
270 menu.OnFocus(w, x, y);
271
272 if (w)
273 {
274 if (TextMapUpdateWidget(w.GetUserID()))
275 return true;
276
277 if (w.IsInherited(SliderWidget))
278 {
279 ColorRed(w);
280 return true;
281 }
282
283 if (IsFocusable(w))
284 {
285 ColorRed(w);
286 return true;
287 }
288 }
289 else
290 m_DetailsRoot.Show(false);
291 return (w != null);
292 }
293
294 override bool OnFocusLost(Widget w, int x, int y)
295 {
296 if (IsFocusable(w))
297 {
298 ColorWhite(w, null);
299 return true;
300 }
301 return false;
302 }
303
305 {
306 return w && (w.GetFlags() & ~WidgetFlags.NOFOCUS);
307 }
308
310 {
311 bool connectivityInfoShown = key == OptionIDsScript.OPTION_CONNECTIVITY_INFO;
313 Param tmp = m_TextMap.Get(key);
314
315 m_DetailsBodyDefault.Show(!connectivityInfoShown);
316 m_DetailsBodyConnectivity.Show(connectivityInfoShown);
317
318 if (Class.CastTo(p, tmp))
319 {
320 m_DetailsRoot.Show(true);
321 m_DetailsText.Show(true);
322 m_DetailsLabel.SetText(p.param1);
323 m_DetailsText.SetText(p.param2);
324
325 m_DetailsText.Update();
326 m_DetailsLabel.Update();
327 m_DetailsRoot.Update();
328 m_DetailsBodyConnectivity.Update(); //...
329 return true;
330 }
331 return false;
332 }
333
335 {
336#ifdef PLATFORM_CONSOLE
337 return ((m_KeyboardSelector.IsEnabled() && m_KeyboardOption.GetIndex() == 0) || (!m_KeyboardSelector.IsEnabled() && m_KeyboardOption.GetIndex() == 1));
338#else
339 return false;
340#endif
341 }
342
343 void Apply()
344 {
345#ifdef PLATFORM_CONSOLE
346 bool changed = false;
348 {
349 //on change
350 if ((m_KeyboardSelector.IsEnabled() && m_KeyboardOption.GetIndex() == 0) || (!m_KeyboardSelector.IsEnabled() && m_KeyboardOption.GetIndex() == 1))
351 {
352 m_KeyboardOption.Switch();
353 changed = true;
354 }
355 }
356
357 Focus();
358 GetGame().GetUIManager().ShowUICursor(m_MaKOptionAvailable && m_KeyboardOption.GetIndex());
359 if (changed)
360 g_Game.UpdateInputDeviceDisconnectWarning();
361
362 m_Menu.Refresh();
363#endif
364 }
365
366 void Revert()
367 {
368 if (m_Mouse_InvertSelector)
369 m_Mouse_InvertSelector.SetValue(m_Mouse_InvertOption.GetIndex(), true);
370 if (m_Mouse_VSensitivitySelector)
371 m_Mouse_VSensitivitySelector.SetValue(m_Mouse_VSensitivityOption.ReadValue(), true);
372 if (m_Mouse_HSensitivitySelector)
373 m_Mouse_HSensitivitySelector.SetValue(m_Mouse_HSensitivityOption.ReadValue(), true);
374 if (m_Mouse_AimMod_VSensitivitySelector)
375 m_Mouse_AimMod_VSensitivitySelector.SetValue(m_Mouse_AimMod_VSensitivityOption.ReadValue(), true);
376 if (m_Mouse_AimMod_HSensitivitySelector)
377 m_Mouse_AimMod_HSensitivitySelector.SetValue(m_Mouse_AimMod_HSensitivityOption.ReadValue(), true);
378
379
380#ifdef PLATFORM_CONSOLE
381 if (m_KeyboardSelector)
382 m_KeyboardSelector.SetValue(m_KeyboardOption.GetIndex(), true);
383 if (m_AimHelperSelector)
384 m_AimHelperSelector.SetValue(m_AimHelperOption.GetIndex(), true);
385
386 if (m_ControllerLS_VSensitivitySelector)
387 m_ControllerLS_VSensitivitySelector.SetValue(m_ControllerLS_VSensitivityOption.ReadValue(), true);
388 if (m_ControllerLS_HSensitivitySelector)
389 m_ControllerLS_HSensitivitySelector.SetValue(m_ControllerLS_HSensitivityOption.ReadValue(), true);
390 if (m_ControllerLS_VehicleMod_HSensitivitySelector)
391 m_ControllerLS_VehicleMod_HSensitivitySelector.SetValue(m_ControllerLS_VehicleMod_HSensitivityOption.ReadValue(), true);
392 if (m_ControllerRS_InvertSelector)
393 m_ControllerRS_InvertSelector.SetValue(m_ControllerRS_InvertOption.GetIndex(), true);
394 if (m_ControllerRS_VSensitivitySelector)
395 m_ControllerRS_VSensitivitySelector.SetValue(m_ControllerRS_VSensitivityOption.ReadValue(), true);
396 if (m_ControllerRS_HSensitivitySelector)
397 m_ControllerRS_HSensitivitySelector.SetValue(m_ControllerRS_HSensitivityOption.ReadValue(), true);
398 if (m_ControllerRS_CurvatureSelector)
399 m_ControllerRS_CurvatureSelector.SetValue(m_ControllerRS_CurvatureOption.ReadValue(), true);
400 if (m_ControllerRS_AimMod_VSensitivitySelector)
401 m_ControllerRS_AimMod_VSensitivitySelector.SetValue(m_ControllerRS_AimMod_VSensitivityOption.ReadValue(), true);
402 if (m_ControllerRS_AimMod_HSensitivitySelector)
403 m_ControllerRS_AimMod_HSensitivitySelector.SetValue(m_ControllerRS_AimMod_HSensitivityOption.ReadValue(), true);
404 if (m_ControllerRS_AimMod_CurvatureSelector)
405 m_ControllerRS_AimMod_CurvatureSelector.SetValue(m_ControllerRS_AimMod_CurvatureOption.ReadValue(), true);
406#endif
407 }
408
410 {
411 if (m_Mouse_InvertSelector)
412 m_Mouse_InvertSelector.SetValue(m_Mouse_InvertOption.GetDefaultIndex(), true);
413 if (m_Mouse_VSensitivitySelector)
414 m_Mouse_VSensitivitySelector.SetValue(m_Mouse_VSensitivityOption.GetDefault(), true);
415 if (m_Mouse_HSensitivitySelector)
416 m_Mouse_HSensitivitySelector.SetValue(m_Mouse_HSensitivityOption.GetDefault(), true);
417 if (m_Mouse_AimMod_VSensitivitySelector)
418 m_Mouse_AimMod_VSensitivitySelector.SetValue(m_Mouse_AimMod_VSensitivityOption.GetDefault(), true);
419 if (m_Mouse_AimMod_HSensitivitySelector)
420 m_Mouse_AimMod_HSensitivitySelector.SetValue(m_Mouse_AimMod_HSensitivityOption.GetDefault(), true);
421
422#ifdef PLATFORM_CONSOLE
423 if (m_KeyboardSelector)
424 m_KeyboardSelector.SetValue(m_KeyboardOption.GetDefaultIndex(), true);
425 if (m_AimHelperSelector)
426 m_AimHelperSelector.SetValue(m_AimHelperOption.GetDefaultIndex(), true);
427
428 if (m_ControllerLS_VSensitivitySelector)
429 m_ControllerLS_VSensitivitySelector.SetValue(m_ControllerLS_VSensitivityOption.GetDefault(), true);
430 if (m_ControllerLS_HSensitivitySelector)
431 m_ControllerLS_HSensitivitySelector.SetValue(m_ControllerLS_HSensitivityOption.GetDefault(), true);
432 if (m_ControllerLS_VehicleMod_HSensitivitySelector)
433 m_ControllerLS_VehicleMod_HSensitivitySelector.SetValue(m_ControllerLS_VehicleMod_HSensitivityOption.GetDefault(), true);
434 if (m_ControllerRS_InvertSelector)
435 m_ControllerRS_InvertSelector.SetValue(m_ControllerRS_InvertOption.GetDefaultIndex(), true);
436 if (m_ControllerRS_VSensitivitySelector)
437 m_ControllerRS_VSensitivitySelector.SetValue(m_ControllerRS_VSensitivityOption.GetDefault(), true);
438 if (m_ControllerRS_HSensitivitySelector)
439 m_ControllerRS_HSensitivitySelector.SetValue(m_ControllerRS_HSensitivityOption.GetDefault(), true);
440 if (m_ControllerRS_CurvatureSelector)
441 m_ControllerRS_CurvatureSelector.SetValue(m_ControllerRS_CurvatureOption.GetDefault(), true);
442 if (m_ControllerRS_AimMod_VSensitivitySelector)
443 m_ControllerRS_AimMod_VSensitivitySelector.SetValue(m_ControllerRS_AimMod_VSensitivityOption.GetDefault(), true);
444 if (m_ControllerRS_AimMod_HSensitivitySelector)
445 m_ControllerRS_AimMod_HSensitivitySelector.SetValue(m_ControllerRS_AimMod_HSensitivityOption.GetDefault(), true);
446 if (m_ControllerRS_AimMod_CurvatureSelector)
447 m_ControllerRS_AimMod_CurvatureSelector.SetValue(m_ControllerRS_AimMod_CurvatureOption.GetDefault(), true);
448
449 Focus();
450#endif
451
452 }
453
454#ifdef PLATFORM_CONSOLE
456 {
458 }
459
460 void UpdateKeyboard(int index)
461 {
462 Focus();
464 m_Menu.OnChanged();
465 //m_Menu.ToggleDependentOptions(EDependentOptions.MOUSEANDKEYBOARD_QUICKBAR,index == 1 && GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
466 }
467
468 void UpdateAimHelper(int index)
469 {
470 if (m_AimHelperOption.GetIndex() != index)
471 {
472 m_AimHelperOption.Switch();
473 m_Menu.OnChanged();
474 }
475 }
476
478 {
479 m_ControllerLS_VSensitivityOption.WriteValue(value);
480 m_Menu.OnChanged();
481 }
482
484 {
485 m_ControllerLS_HSensitivityOption.WriteValue(value);
486 m_Menu.OnChanged();
487 }
488
490 {
491 m_ControllerLS_VehicleMod_HSensitivityOption.WriteValue(value);
492 m_Menu.OnChanged();
493 }
494
496 {
497 if (m_ControllerRS_InvertOption.GetIndex() != index)
498 {
499 m_ControllerRS_InvertOption.Switch();
500 m_Menu.OnChanged();
501 }
502 }
503
505 {
506 m_ControllerRS_VSensitivityOption.WriteValue(value);
507 m_Menu.OnChanged();
508 }
509
511 {
512 m_ControllerRS_HSensitivityOption.WriteValue(value);
513 m_Menu.OnChanged();
514 }
515
517 {
518 m_ControllerRS_CurvatureOption.WriteValue(value);
519 m_Menu.OnChanged();
520 }
521
523 {
524 m_ControllerRS_AimMod_VSensitivityOption.WriteValue(value);
525 m_Menu.OnChanged();
526 }
527
529 {
530 m_ControllerRS_AimMod_HSensitivityOption.WriteValue(value);
531 m_Menu.OnChanged();
532 }
533
535 {
536 m_ControllerRS_AimMod_CurvatureOption.WriteValue(value);
537 m_Menu.OnChanged();
538 }
539#endif
540
542 {
543 if (m_Mouse_InvertOption.GetIndex() != index)
544 {
545 m_Mouse_InvertOption.Switch();
546 m_Menu.OnChanged();
547 }
548 }
549
551 {
552 m_Mouse_VSensitivityOption.WriteValue(value);
553 m_Menu.OnChanged();
554 }
555
557 {
558 m_Mouse_HSensitivityOption.WriteValue(value);
559 m_Menu.OnChanged();
560 }
561
563 {
564 m_Mouse_AimMod_VSensitivityOption.WriteValue(value);
565 m_Menu.OnChanged();
566 }
567
569 {
570 m_Mouse_AimMod_HSensitivityOption.WriteValue(value);
571 m_Menu.OnChanged();
572 }
573
575 {
576 m_Menu.ReloadOptions();
577 }
578
580 {
581 m_Options = options;
582
583 // mouse (PC & consoles)
584 m_Mouse_InvertOption = SwitchOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_MOUSE_YAXIS_INVERTED));
585 m_Mouse_VSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_MOUSE_YAXIS));
586 m_Mouse_HSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_MOUSE_XAXIS));
587 m_Mouse_AimMod_VSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_MOUSE_YAXIS_AIM_MOD));
588 m_Mouse_AimMod_HSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_MOUSE_XAXIS_AIM_MOD));
589
590 // controller (consoles only)
591#ifdef PLATFORM_CONSOLE
592 m_KeyboardOption = SwitchOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_MOUSE_AND_KEYBOARD));
593 m_AimHelperOption = SwitchOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_AIM_HELPER));
594
595 m_ControllerLS_VSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_LS_YAXIS));
596 m_ControllerLS_HSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_LS_XAXIS));
597 m_ControllerLS_VehicleMod_HSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_LS_XAXIS_VEHICLE_MOD));
598 m_ControllerRS_InvertOption = SwitchOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_YAXIS_INVERTED));
599 m_ControllerRS_VSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_YAXIS));
600 m_ControllerRS_HSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_XAXIS));
601 m_ControllerRS_CurvatureOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_CURVATURE));
602 m_ControllerRS_AimMod_VSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_YAXIS_AIM_MOD));
603 m_ControllerRS_AimMod_HSensitivityOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_XAXIS_AIM_MOD));
604 m_ControllerRS_AimMod_CurvatureOption = NumericOptionsAccess.Cast(m_Options.GetOptionByType(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_CURVATURE_AIM_MOD));
605#endif
606
607 Revert();
608 }
609
611 {
612 }
613
617
619 {
621 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_MOUSE_YAXIS_INVERTED, new Param2<string, string>("#STR_Invert_Vertical_tip_header", "#STR_Invert_Vertical_tip"));
622 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_MOUSE_YAXIS, new Param2<string, string>("#STR_Camera_V_Sensitivity_tip_header", "#STR_Camera_V_Sensitivity_tip"));
623 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_MOUSE_XAXIS, new Param2<string, string>("#STR_Camera_H_Sensitivity_tip_header", "#STR_Camera_H_Sensitivity_tip"));
624 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_MOUSE_YAXIS_AIM_MOD, new Param2<string, string>("#STR_Aiming_V_Sensitivity_tip_header", "#STR_Aiming_V_Sensitivity_tip"));
625 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_MOUSE_XAXIS_AIM_MOD, new Param2<string, string>("#STR_Aiming_H_Sensitivity_tip_header", "#STR_Aiming_H_Sensitivity_tip"));
626
627#ifdef PLATFORM_CONSOLE
628 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_MOUSE_AND_KEYBOARD, new Param2<string, string>("#xbox_options_controls_mandk_contr", "#xbox_options_controls_mandk_contr_desc"));
629 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_AIM_HELPER, new Param2<string, string>("#ps4_options_controls_aim_helper_contr", "#ps4_options_controls_aim_helper_contr_desc"));
630
631 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_LS_YAXIS, new Param2<string, string>("#STR_Movement_V_Sensitivity_tip_header", "#STR_Movement_V_Sensitivity_tip"));
632 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_LS_XAXIS, new Param2<string, string>("#STR_Movement_H_Sensitivity_tip_header", "#STR_Movement_H_Sensitivity_tip"));
633 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_LS_XAXIS_VEHICLE_MOD, new Param2<string, string>("#STR_Movement_Vehicle_Sensitivity_tip_header", "#STR_Movement_Vehicle_Sensitivity_tip"));
634 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_YAXIS_INVERTED, new Param2<string, string>("#STR_Invert_Vertical_tip_header", "#STR_Invert_Vertical_tip"));
635 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_YAXIS, new Param2<string, string>("#STR_Camera_V_Sensitivity_tip_header", "#STR_Camera_V_Sensitivity_tip"));
636 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_XAXIS, new Param2<string, string>("#STR_Camera_H_Sensitivity_tip_header", "#STR_Camera_H_Sensitivity_tip"));
637 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_CURVATURE, new Param2<string, string>("#STR_Camera_Curvature_tip_header", "#STR_Camera_Curvature_tip"));
638 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_YAXIS_AIM_MOD, new Param2<string, string>("#STR_Aiming_V_Sensitivity_tip_header", "#STR_Aiming_V_Sensitivity_tip"));
639 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_XAXIS_AIM_MOD, new Param2<string, string>("#STR_Aiming_H_Sensitivity_tip_header", "#STR_Aiming_H_Sensitivity_tip"));
640 m_TextMap.Insert(OptionAccessType.AT_OPTIONS_CONTROLLER_RS_CURVATURE_AIM_MOD, new Param2<string, string>("#STR_Aiming_Curvature_tip_header", "#STR_Camera_Curvature_tip"));
641#endif
642 }
643
644 //Coloring functions (Until WidgetStyles are useful)
646 {
647 SetFocus(w);
649 if (Class.CastTo(button, w))
650 {
651 button.SetTextColor(ARGB(255, 255, 0, 0));
652 button.SetAlpha(0.9);
653 }
654 }
655
657 {
659 if (Class.CastTo(button, w))
660 {
661 button.SetTextColor(ARGB(255, 255, 255, 255));
662 button.SetAlpha(0.0);
663 }
664 }
665}
DayZGame g_Game
Definition DayZGame.c:3528
EDependentOptions
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.
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 NumericOptionsAccess m_Mouse_AimMod_VSensitivityOption
ref OptionSelectorSlider m_ControllerLS_VehicleMod_HSensitivitySelector
void UpdateMouseAimModHSensitivity(float value)
ref OptionSelectorSlider m_ControllerRS_HSensitivitySelector
ref OptionSelectorMultistate m_AimHelperSelector
ref NumericOptionsAccess m_Mouse_VSensitivityOption
ref OptionSelectorMultistate m_KeyboardSelector
ref NumericOptionsAccess m_ControllerRS_CurvatureOption
ref NumericOptionsAccess m_ControllerRS_AimMod_VSensitivityOption
void UpdateMouseVSensitivity(float value)
ref NumericOptionsAccess m_ControllerLS_VSensitivityOption
void ColorWhite(Widget w, Widget enterW)
ref NumericOptionsAccess m_ControllerRS_VSensitivityOption
ref OptionSelectorSlider m_Mouse_AimMod_VSensitivitySelector
ref OptionSelectorMultistate m_Mouse_InvertSelector
ref NumericOptionsAccess m_ControllerRS_AimMod_HSensitivityOption
void UpdateMouseAimModVSensitivity(float value)
ref OptionSelectorSlider m_ControllerRS_AimMod_VSensitivitySelector
override bool OnFocusLost(Widget w, int x, int y)
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
ref NumericOptionsAccess m_ControllerRS_AimMod_CurvatureOption
void ToggleDependentOptions(int mode, bool state)
ref NumericOptionsAccess m_ControllerRS_HSensitivityOption
void SetOptions(GameOptions options)
void ColorWhite(Widget w, Widget enterW, int x, int y)
ref OptionSelectorSlider m_ControllerRS_AimMod_HSensitivitySelector
void OptionsMenuControls(Widget parent, Widget details_root, GameOptions options, OptionsMenu menu)
void ColorRed(Widget w, int x, int y)
ref NumericOptionsAccess m_ControllerLS_VehicleMod_HSensitivityOption
ref SwitchOptionsAccess m_ControllerRS_InvertOption
ref SwitchOptionsAccess m_AimHelperOption
ref OptionSelectorSlider m_ControllerLS_HSensitivitySelector
ref OptionSelectorSlider m_Mouse_AimMod_HSensitivitySelector
void Focus()
Focuses the first viable item.
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
ref OptionSelectorSlider m_Mouse_HSensitivitySelector
ref OptionSelectorSlider m_ControllerRS_AimMod_CurvatureSelector
ref SwitchOptionsAccess m_KeyboardOption
ref NumericOptionsAccess m_Mouse_AimMod_HSensitivityOption
ref map< int, ref Param2< string, string > > m_TextMap
ref OptionSelectorSlider m_Mouse_VSensitivitySelector
bool IsFocusable(Widget w)
Definition CTKeyframe.c:156
ref OptionSelectorSlider m_ControllerRS_VSensitivitySelector
override bool OnFocus(Widget w, int x, int y)
ref OptionSelectorSlider m_ControllerRS_CurvatureSelector
void UpdateMouseHSensitivity(float value)
ref OptionSelectorMultistate m_ControllerRS_InvertSelector
ref SwitchOptionsAccess m_Mouse_InvertOption
ref NumericOptionsAccess m_ControllerLS_HSensitivityOption
override bool OnMouseEnter(Widget w, int x, int y)
ref NumericOptionsAccess m_Mouse_HSensitivityOption
ref OptionSelectorSlider m_ControllerLS_VSensitivitySelector
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
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int MENU_KEYBINDINGS
Definition constants.c:193
MouseState
Definition EnSystem.c:311
const int CALL_CATEGORY_GUI
Definition tools.c:9
WidgetFlags
Definition EnWidgets.c:58
proto native void SetFocus(Widget w)
int ARGB(int a, int r, int g, int b)
Definition proto.c:322