Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
presetsmenu.c
Go to the documentation of this file.
1class PresetsMenu extends UIScriptedMenu
2{
3 void PresetsMenu()
4 {
5 }
6
7 void ~PresetsMenu()
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 {
28 m_schemes_list.SelectRow(i);
29 }
30
31 return layoutRoot;
32 }
33
34 override bool OnClick(Widget w, int x, int y, int button)
35 {
36 super.OnClick(w, x, y, button);
37
38 switch (w.GetUserID())
39 {
40 case IDC_CANCEL:
41 Close();
42
43 return true;
44
45 case IDC_OK:
46 int index = m_schemes_list.GetSelectedRow();
47 if (index != -1)
48 {
49 GetGame().GetInput().SetProfile(index);
50 GetGame().GetMission().GetOnInputPresetChanged().Invoke();
51 Close();
52 }
53
54 return true;
55 }
56
57 return false;
58 }
59
60 private TextListboxWidget m_schemes_list;
61}
override Widget Init()
Definition bookmenu.c:11
override bool OnClick(Widget w, int x, int y, int button)
Definition bookmenu.c:34
proto native CGame GetGame()
const int IDC_CANCEL
Definition constants.c:136
const int IDC_OK
Definition constants.c:135
Icon x
Icon y
void Close()