DayZ 1.24
Loading...
Searching...
No Matches
ControlMappingKeybinds.c
Go to the documentation of this file.
1class TutorialKeybinds extends ScriptedWidgetEventHandler
2{
3 protected Widget m_Root;
5
7
9 {
10 m_Root = GetGame().GetWorkspace().CreateWidgets(GetLayoutName(), parent);
11
12 m_Menu = menu;
13
14 int actionCount;
15 int actionMax = 80;
16
17 int column_index = 0;
18 int item_index;
19 string output = "";
20 string option_text = "";
22 GetUApi().GetActiveInputs(actions);
23
24 actionCount = actions.Count();
25 for (int i = 0; i < actionCount; i++)
26 {
27 UAInput input = GetUApi().GetInputByID(actions.Get(i));
28 if (input)
29 {
31 {
32 output = "";
33 option_text = "";
34 GetGame().GetInput().GetActionDesc(actions.Get(i), option_text);
36 {
38 Widget w = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/tutorials/xbox/keybindings_panels/keybinding_panel.layout", m_Root.FindAnyWidget("container" + column_index));
39 Widget spacer = w.FindWidget("Spacer");
40 TextWidget name = TextWidget.Cast(w.FindWidget("KeybindName"));
41 TextWidget mod = TextWidget.Cast(spacer.FindWidget("KeybindModifier"));
42 TextWidget value = TextWidget.Cast(spacer.FindWidget("KeybindButton"));
43
44 string modifier_text = "";
45 name.SetText(option_text);
46 value.SetText(output);
47
49 mod.SetText(modifier_text);
50
51 name.Update();
52 mod.Update();
53 value.Update();
54 spacer.Update();
55
56 item_index++;
57 }
58 }
59 else
60 {
61 option_text = "";
62 GetGame().GetInput().GetActionDesc(actions[i], option_text);
63 ErrorEx("input action " + option_text + " index out of bounds!", ErrorExSeverity.INFO);
64 }
65 }
66 }
67
68 m_Root.SetHandler(this);
69 }
70
73 {
74 int a, i, countbind = 0;
75
76 for (a = 0; a < pInput.AlternativeCount(); a++)
77 {
78 pInput.SelectAlternative(a);
79 if (pInput.IsCombo())
80 {
81 if (pInput.BindingCount() > 0)
82 {
83 if (pInput.Binding(0) != 0 && pInput.CheckBindDevice(0, iDeviceFlags))
84 {
85 if (countbind > 0)
86 output += ", ";
87
88 output += GetUApi().GetButtonName(pInput.Binding(0));
89 countbind++;
90
91 for (i = 1; i < pInput.BindingCount(); i++)
92 {
93 if (pInput.Binding(i) != 0)
94 {
95 output += " + " + GetUApi().GetButtonName(pInput.Binding(i));
96 countbind++;
97 }
98 }
99
100 }
101 }
102 }
103 else
104 {
105 if (pInput.BindingCount() > 0)
106 {
107 if (pInput.Binding(0) != 0 && pInput.CheckBindDevice(0, iDeviceFlags))
108 {
109 if (countbind > 0)
110 output += ", ";
111
112 output += GetUApi().GetButtonName(pInput.Binding(0));
113 countbind++;
114 }
115 }
116 }
117
118 }
119
120 return (countbind > 0);
121 }
122
125 {
126 if (pInput.IsLimited())
127 {
128 if (pInput.IsPressLimit())
129 output = "#keybind_press";
130 if (pInput.IsReleaseLimit())
131 output = "#keybind_release";
132 if (pInput.IsHoldLimit())
133 output = "#keybind_hold";
134 if (pInput.IsHoldBeginLimit())
135 output = "#keybind_holdbegin";
136 if (pInput.IsClickLimit())
137 output = "#keybind_click";
138 if (pInput.IsDoubleClickLimit())
139 output = "#keybind_doubletap";
140
141 return true;
142 }
143 else
144 return false;
145 }
146
148 {
149
150 }
151
153 {
154 return "gui/layouts/new_ui/tutorials/xbox/keybinds_tab.layout";
155 }
156}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
ServerBrowserMenuNew m_Menu
Widget m_Root
Definition SizeToChild.c:85
proto native UAInputAPI GetUApi()
Definition EnMath.c:7
map: item x vector(index, width, height)
Definition EnWidgets.c:651
bool SetElementModifier(UAInput pInput, out string output)
Determine the active limiter of the bindings (currently unreliable, multiple limiters can be active o...
bool SetElementTitle(UAInput pInput, int iDeviceFlags, out string output)
assemble all active bindings at widget element
void TutorialKeybinds(Widget parent, TutorialsMenu menu)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
ErrorExSeverity
Definition EnDebug.c:62
enum ShapeType ErrorEx
array< int > TIntArray
Definition EnScript.c:668
static proto float Floor(float f)
Returns floor of value.