DayZ 1.24
Loading...
Searching...
No Matches
PresetsMenu.c
Go to the documentation of this file.
1class PresetsMenu extends UIScriptedMenu
2{
4 {
5 }
6
8 {
9 }
10
11 override Widget Init()
12 {
13 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/day_z_options_controls_preset.layout");
14
15 m_schemes_list = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("PresetListboxWidget"));
16
17 int c = GetGame().GetInput().GetProfilesCount();
18 for (int i = 0; i < c; i++)
19 {
20 string tmp;
21 GetGame().GetInput().GetProfileName(i, tmp);
22 m_schemes_list.AddItem(tmp, NULL, 0);
23 }
24
25 i = GetGame().GetInput().GetCurrentProfile();
26 if (i >= 0 && i < c)
27 m_schemes_list.SelectRow(i);
28
29 return layoutRoot;
30 }
31
32 override bool OnClick(Widget w, int x, int y, int button)
33 {
34 super.OnClick(w, x, y, button);
35
36 switch (w.GetUserID())
37 {
38 case IDC_CANCEL:
39 Close();
40
41 return true;
42
43 case IDC_OK:
44 int index = m_schemes_list.GetSelectedRow();
45 if (index != -1)
46 {
47 GetGame().GetInput().SetProfile(index);
48 GetGame().GetMission().GetOnInputPresetChanged().Invoke();
49 Close();
50 }
51
52 return true;
53 }
54
55 return false;
56 }
57
59}
Icon x
Icon y
void Close()
void PresetsMenu()
Definition PresetsMenu.c:3
TextListboxWidget m_schemes_list
Definition PresetsMenu.c:58
override Widget Init()
Definition PresetsMenu.c:11
void ~PresetsMenu()
Definition PresetsMenu.c:7
override bool OnClick(Widget w, int x, int y, int button)
Definition PresetsMenu.c:32
proto native CGame GetGame()
const int IDC_CANCEL
Definition constants.c:128
const int IDC_OK
Definition constants.c:127