Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл ControlsXbox.c

См. исходные тексты.

Структуры данных

class  JsonControlMappingInfo
 

Функции

void ControlsXbox ()
 
void ~ControlsXbox ()
 
void Back ()
 
void DrawConnectingLines (int index)
 
array< ref JsonControlMappingInfoGetControlMappingInfo ()
 
override Widget Init ()
 Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)
 
override void OnShow ()
 
override bool OnClick (Widget w, int x, int y, int button)
 
override void Update (float timeslice)
 
void LoadFooterButtonTexts ()
 Initial texts load for the footer buttons.
 
void LoadTextStrings ()
 Set correct bottom button texts based on platform (ps4 vs xbox texts)
 
void SwitchPreset ()
 

Переменные

class JsonControlMappingInfo m_BackButtonTextID
 
ButtonWidget m_Back
 
ImageWidget m_ControlsLayoutImage
 
const int TABS_COUNT = 4
 
ImageWidget m_tab_images [TABS_COUNT]
 
TabberUI m_TabScript
 

Функции

◆ Back()

void Back ( )
protected
37 {
38 GetGame().GetUIManager().Back();
39 }
proto native CGame GetGame()

Перекрестные ссылки GetGame().

Используется в UIScriptedMenu::OnClick() и UIScriptedMenu::Update().

◆ ControlsXbox()

void ControlsXbox ( )
protected
27 {
28
29 }

◆ DrawConnectingLines()

void DrawConnectingLines ( int index)
protected
42 {
45
48
51 float dot_pos_x, dot_pos_y;
52 float dot_width, dot_height;
54
55 CanvasWidget canvas_widget = CanvasWidget.Cast(layoutRoot.FindAnyWidget("CanvasWidget_" + index));
56 canvas_widget.Clear();
58
59 for (int i = 0; i < m_TabScript.GetTabCount(); i++)
60 {
62 for (int j = 0; j < 20; j++)
63 {
64 tab_array[i].Insert(null);
65 }
66 }
67
68 // insert json info to array by index, so it is sorted
69 for (i = 0; i < control_mapping_info.Count(); i++)
70 {
72 tab_array[info.m_TabID][info.m_TextWidgetID] = info;
73 }
74
75 // create group of buttons which are connected together with line
76 for (int l = 0; l < control_mapping_info.Count(); l++)
77 {
79 string button_name = info1.m_ButtonName;
80 int text_widget_id = info1.m_TextWidgetID;
81 if (info1.m_TabID != index)
82 {
83 continue;
84 }
86 {
89 }
90 else
91 {
93 }
94 }
95
96 // we want groups which are bigger than 1
97 for (l = 0; l < button_marker_groups_unflitred.Count(); l++)
98 {
99 if (button_marker_groups_unflitred.GetElement(l).Count() > 1)
100 {
101 string key = button_marker_groups_unflitred.GetKey(l);
103 }
104 }
105
107 // hide all button markers
108 #ifdef PLATFORM_XBOX
109 controls_image = layoutRoot.FindAnyWidget("XboxControlsImage");
110 #else
111 #ifdef PLATFORM_PS4
112 controls_image = layoutRoot.FindAnyWidget("PSControlsImage");
113 #endif
114 #endif
115
116 Widget child = controls_image.GetChildren();
117 child.Show(false);
118 while (child.GetSibling())
119 {
120 child = child.GetSibling();
121 child.Show(false);
122 }
123
126
127 for (l = 0; l < tab_array[index].Count(); l++)
128 {
129 panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + l);
130 if (tab_array[index][l] != null)
131 {
132 TextWidget text_widget = TextWidget.Cast(panel_widget.FindAnyWidget("TextWidget" + l));
133
134 string key_prefix;
135 #ifdef PLATFORM_XBOX
136 key_prefix = "xb_button_marker_";
137 #else
138 #ifdef PLATFORM_PS4
139 key_prefix = "ps_button_marker_";
140 #endif
141 #endif
142
143 button_marker_widget = layoutRoot.FindAnyWidget(key_prefix + tab_array[index][l].m_ButtonName);
144 text_widget.SetText(tab_array[index][l].m_InfoText);
145 panel_widget.Show(true);
146 button_marker_widget.Show(true);
147 panel_widget.Update();
148 if (!button_marker_groups.Contains(tab_array[index][l].m_ButtonName))
149 {
152
155
157 if (l < 10)
158 {
160 }
161 else
162 {
164 }
165 canvas_widget.DrawLine(draw_pos_x, draw_pos_y, dot_pos_x+dot_width/2, draw_pos_y, 2, ARGBF(0.6, 1, 1, 1));
167 }
168 }
169 else
170 {
171 panel_widget.Show(false);
172 }
173 panel_widget.Update();
174 }
175
176 // draw connecting lines
177 for (l = 0; l < button_marker_groups.Count(); l++)
178 {
183 float group_point_x = 0, group_point_y = 0;
184 float first_x = 0, first_y = 0;
185
187 string key_name = button_marker_groups.GetKey(l);
188 #ifdef PLATFORM_XBOX
189 key_prefix = "xb_button_marker_";
190 #else
191 #ifdef PLATFORM_PS4
192 key_prefix = "ps_button_marker_";
193 #endif
194 #endif
195 button_marker_widget = layoutRoot.FindAnyWidget(key_prefix + key_name);
196
197 for (int g = 0; g < element.Count(); g++)
198 {
199 panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + element[g]);
200
203
204 if (g == 0)
205 {
206 if (element[0] < 10)
207 {
209 }
210 else
211 {
213 }
214
216 }
217
220 if (element[0] < 10)
221 {
223 }
224 else
225 {
227 }
228 }
229 if (element[0] < 10)
230 {
232 }
233 else
234 {
235 group_point_x = group_point_x/element.Count() - 50;
236 }
237
238 if (element.Count() % 2 == 0)
239 {
241 }
242 else
243 {
246
247 panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + element[1]);
248
251
253 }
254
257
260
261 if (element[0] < 10)
262 {
264 }
265 else
266 {
268 }
269 }
270 }
TabberUI m_TabScript
Definition ControlsXbox.c:21
array< ref JsonControlMappingInfo > GetControlMappingInfo()
Definition ControlsXbox.c:272
Definition ControlsXbox.c:6
Definition EntityAI.c:95
Definition EnWidgets.c:220
Definition EnWidgets.c:190
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition proto.c:332

Перекрестные ссылки ARGBF(), UIScriptedMenu::GetControlMappingInfo() и m_TabScript.

Используется в Init(), UIScriptedMenu::Init(), UIScriptedMenu::UpdateTabContent() и UIScriptedMenu::~TutorialsMenu().

◆ GetControlMappingInfo()

array< ref JsonControlMappingInfo > GetControlMappingInfo ( )
protected
273 {
275
276 string file_path = "xbox/pagedatacontroller.json";
277 #ifdef PLATFORM_PS4
278 file_path = "ps4/pagedatacontroller.json";
279 #endif
282
283 string js_error = "";
284 string line_content = "";
285 string content = "";
286 if (file_handle)
287 {
288 while (FGets(file_handle, line_content) >= 0)
289 {
291 }
293
294 if (js.ReadFromString(control_mapping_info, content, js_error))
295 {
297 }
298 else
299 {
300 ErrorEx("JSON ERROR => [ControlMappingInfo.json]: "+ js_error,ErrorExSeverity.INFO);
301 }
302 }
303
305 }
Class for sending RPC over network.
Definition gameplay.c:50
ErrorExSeverity
Definition EnDebug.c:62
enum ShapeType ErrorEx
FileMode
Definition EnSystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto int FGets(FileHandle file, string var)
Get line from file, every next call of this function returns next line.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.

Перекрестные ссылки CloseFile(), ErrorEx, FGets() и OpenFile().

Используется в UIScriptedMenu::DrawConnectingLines().

◆ Init()

override Widget Init ( )
protected

Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)

pre-init arrays

311 {
312 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/control_mapping_info_screen.layout");
313
314 layoutRoot.FindAnyWidget("Tabber").GetScript(m_TabScript);
315
316 m_TabScript.m_OnTabSwitch.Insert(DrawConnectingLines);
317
318 m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget("back"));
319
320 #ifdef PLATFORM_CONSOLE
321 RichTextWidget toolbar_switch = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ChangePresetIcon"));
322 RichTextWidget toolbar_back = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon"));
325 #endif
326
327 #ifdef PLATFORM_XBOX
328 layoutRoot.FindAnyWidget("XboxControlsImage").Show(true);
329 #else
330 #ifdef PLATFORM_PS4
331 layoutRoot.FindAnyWidget("PSControlsImage").Show(true);
332 #endif
333 #endif
334
335 m_tab_images[0] = ImageWidget.Cast(layoutRoot.FindAnyWidget("MovementTabBackdropImageWidget"));
336 m_tab_images[1] = ImageWidget.Cast(layoutRoot.FindAnyWidget("WeaponsAndActionsBackdropImageWidget"));
337 m_tab_images[2] = ImageWidget.Cast(layoutRoot.FindAnyWidget("InventoryTabBackdropImageWidget"));
338 m_tab_images[3] = ImageWidget.Cast(layoutRoot.FindAnyWidget("MenusTabBackdropImageWidget"));
339
341 Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequesterBank.REQ_MENUEFFECTS));
342 requester.SetVignetteIntensity(0.6);
343
345
346 return layoutRoot;
347 }
void DrawConnectingLines(int index)
Definition ControlsXbox.c:41
ButtonWidget m_Back
Definition ControlsXbox.c:17
ImageWidget m_tab_images[TABS_COUNT]
Definition ControlsXbox.c:20
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition InputUtils.c:2
static const float ICON_SCALE_TOOLBAR
Definition InputUtils.c:15
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition InputUtils.c:167
Definition gameplay.c:316
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки Class::CastTo(), DrawConnectingLines(), UIScriptedMenu::DrawConnectingLines(), GetGame(), InputUtils::GetRichtextButtonIconFromInputAction(), InputUtils::ICON_SCALE_TOOLBAR, m_Back, m_tab_images и m_TabScript.

◆ LoadFooterButtonTexts()

void LoadFooterButtonTexts ( )
protected

Initial texts load for the footer buttons.

405 {
406 TextWidget uiBackText = TextWidget.Cast(layoutRoot.FindAnyWidget("BackText"));
407 if (uiBackText)
408 {
410 }
411 }
class JsonControlMappingInfo m_BackButtonTextID

Перекрестные ссылки m_BackButtonTextID.

◆ LoadTextStrings()

void LoadTextStrings ( )
protected

Set correct bottom button texts based on platform (ps4 vs xbox texts)

415 {
416 #ifdef PLATFORM_PS4
417 m_BackButtonTextID = "ps4_ingame_menu_back";
418 #else
419 m_BackButtonTextID = "STR_rootFrame_toolbar_bg_ConsoleToolbar_Back_BackText0";
420 #endif
421 }

Перекрестные ссылки m_BackButtonTextID.

◆ OnClick()

override bool OnClick ( Widget w,
int x,
int y,
int button )
protected
368 {
369 if (button == MouseState.LEFT)
370 {
371 if (w == m_Back)
372 {
373 Back();
374 return true;
375 }
376 }
377 return false;
378 }
void Back()
Definition ControlsXbox.c:36
MouseState
Definition EnSystem.c:311

Перекрестные ссылки UIScriptedMenu::Back() и m_Back.

◆ OnShow()

override void OnShow ( )
protected
350 {
351 super.OnShow();
352 #ifdef PLATFORM_CONSOLE
353 //layoutRoot.FindAnyWidget("toolbar_bg").Show(!GetGame().GetInput().IsEnabledMouseAndKeyboard());
354 layoutRoot.FindAnyWidget("toolbar_bg").Show(true);//TODO: temporarily always on for preset switching
355
356 string preset_text;
359 if (Class.CastTo(nameWidget,layoutRoot.FindAnyWidget("PresetText")));
360 {
361 preset_text = inputAPI.PresetName(inputAPI.PresetCurrent());
362 nameWidget.SetText(preset_text);
363 }
364 #endif
365 }
proto native UAInputAPI GetUApi()
Definition UAInput.c:165

Перекрестные ссылки Class::CastTo() и GetUApi().

Используется в Container::Open(), ClosableContainer::Open() и Container::SetOpenState().

◆ SwitchPreset()

void SwitchPreset ( )
protected
424 {
425 int index;
426 string preset_text;
429
430 index = inputAPI.PresetCurrent() + 1;
431 if (index >= inputAPI.PresetCount())
432 {
433 index = 0;
434 }
435
436 inputAPI.PresetSelect(index);
437 if (Class.CastTo(nameWidget,layoutRoot.FindAnyWidget("PresetText")));
438 {
439 preset_text = inputAPI.PresetName(inputAPI.PresetCurrent());
440 nameWidget.SetText(preset_text);
441 }
442
443 GetGame().GetInput().SetProfile(index);
444 GetUApi().Export();
445 GetGame().GetMission().GetOnInputPresetChanged().Invoke();
446 }

Перекрестные ссылки Class::CastTo(), GetGame() и GetUApi().

Используется в Update().

◆ Update()

override void Update ( float timeslice)
protected
381 {
382 if (GetUApi().GetInputByID(UAUITabLeft).LocalPress())
383 {
384 m_TabScript.PreviousTab();
385 }
386
387 if (GetUApi().GetInputByID(UAUITabRight).LocalPress())
388 {
389 m_TabScript.NextTab();
390 }
391
392 if (GetUApi().GetInputByID(UAUIBack).LocalPress())
393 {
394 Back();
395 }
396
397 if (GetUApi().GetInputByID(UASwitchPreset).LocalPress())
398 {
399 SwitchPreset();
400 }
401 }
void SwitchPreset()
Definition ControlsXbox.c:423

Перекрестные ссылки UIScriptedMenu::Back(), GetUApi(), m_TabScript и SwitchPreset().

◆ ~ControlsXbox()

void ~ControlsXbox ( )
protected
32 {
34 }

Переменные

◆ m_Back

◆ m_BackButtonTextID

◆ m_ControlsLayoutImage

ImageWidget m_ControlsLayoutImage
protected

◆ m_tab_images

ImageWidget m_tab_images[TABS_COUNT]
protected

Используется в Init() и UIScriptedMenu::Init().

◆ m_TabScript

◆ TABS_COUNT

const int TABS_COUNT = 4
protected