3 protected const string PATH_MOUSEKEY =
"scripts/data/pagedatatutorials.json";
4 protected const string PATH_X1_OLD =
"xbox/pagedatatutorials.json";
5 protected const string PATH_X1_NEW =
"xbox/pagedatatutorialsalternate.json";
6 protected const string PATH_PS_OLD =
"ps4/pagedatatutorials.json";
7 protected const string PATH_PS_NEW =
"ps4/pagedatatutorialsalternate.json";
11 protected Widget m_InfoTextLeft;
12 protected Widget m_InfoTextRight;
13 protected ButtonWidget
m_Back;
19 protected ref TutorialKeybinds m_KeybindsTab;
26 #ifdef PLATFORM_CONSOLE
27 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/tutorials/xbox/tutorials.layout");
29 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/tutorials/pc/tutorials.layout");
32 m_InfoTextLeft = layoutRoot.FindAnyWidget(
"InfoTextLeft");
33 m_InfoTextRight = layoutRoot.FindAnyWidget(
"InfoTextRight");
35 m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"back"));
37 layoutRoot.FindAnyWidget(
"Tabber").GetScript(
m_TabScript);
40 #ifdef PLATFORM_CONSOLE
43 m_KeybindsTab =
new TutorialKeybinds(layoutRoot.FindAnyWidget(
"Tab_6"),
this);
48 m_tab_images[0] = ImageWidget.Cast(layoutRoot.FindAnyWidget(
"MovementTabBackdropImageWidget"));
49 m_tab_images[1] = ImageWidget.Cast(layoutRoot.FindAnyWidget(
"WeaponsAndActionsBackdropImageWidget"));
50 m_tab_images[2] = ImageWidget.Cast(layoutRoot.FindAnyWidget(
"InventoryTabBackdropImageWidget"));
51 m_tab_images[3] = ImageWidget.Cast(layoutRoot.FindAnyWidget(
"MenusTabBackdropImageWidget"));
56 PPERequesterBank.GetRequester(PPERequester_TutorialMenu).Start(
new Param1<float>(0.6));
70 PPERequesterBank.GetRequester(PPERequester_TutorialMenu).Stop();
75 #ifdef PLATFORM_CONSOLE
95 GetGame().GetUIManager().Back();
102 m_InfoTextLeft.Show(
false);
103 m_InfoTextRight.Show(
false);
107 m_InfoTextLeft.Show(
true);
108 m_InfoTextRight.Show(
true);
115 float text_widget_pos_x, text_widget_pos_y;
116 float text_widget_width, text_widget_height;
117 float dot_pos_x, dot_pos_y;
118 float dot_width, dot_height;
119 float draw_pos_x, draw_pos_y;
121 CanvasWidget canvas_widget = CanvasWidget.Cast(layoutRoot.FindAnyWidget(
"CanvasWidget_" + index));
122 canvas_widget.Clear();
125 for (
int i = 0; i <
m_TabScript.GetTabCount(); i++)
128 for (
int j = 0; j < 30; j++)
130 tab_array[i].Insert(NULL);
135 for (i = 0; i < control_mapping_info.Count(); i++)
138 tab_array[info.m_TabID][info.m_TextWidgetID] = info;
142 for (
int l = 0; l < control_mapping_info.Count(); l++)
145 string button_name = info1.m_ButtonName;
146 int text_widget_id = info1.m_TextWidgetID;
147 if (info1.m_TabID != index)
151 if (!button_marker_groups_unflitred.Contains(button_name))
153 button_marker_groups_unflitred.Insert(button_name,
new ref
array<int>);
154 button_marker_groups_unflitred.Get(button_name).Insert(text_widget_id);
158 button_marker_groups_unflitred.Get(button_name).Insert(text_widget_id);
163 for (l = 0; l < button_marker_groups_unflitred.Count(); l++)
165 if (button_marker_groups_unflitred.GetElement(l).Count() > 1)
167 string key = button_marker_groups_unflitred.GetKey(l);
168 button_marker_groups.Insert(button_marker_groups_unflitred.GetKey(l), button_marker_groups_unflitred.Get(key));
173 Widget xbox_controls_image = layoutRoot.FindAnyWidget(
"Markers_" + index);
176 Widget button_marker_widget;
178 for (l = 0; l < tab_array[index].Count(); l++)
180 panel_widget = layoutRoot.FindAnyWidget(
"PanelWidget" + l);
181 if (tab_array[index][l] != NULL)
184 button_marker_widget = layoutRoot.FindAnyWidget(
"button_marker_" + tab_array[index][l].m_ButtonName);
185 text_widget.SetText(tab_array[index][l].m_InfoText);
186 panel_widget.Show(
true);
187 panel_widget.Update();
189 if (!button_marker_groups.Contains(tab_array[index][l].m_ButtonName))
191 panel_widget.GetScreenPos(text_widget_pos_x, text_widget_pos_y);
192 panel_widget.GetScreenSize(text_widget_width,text_widget_height);
194 button_marker_widget.GetScreenPos(dot_pos_x, dot_pos_y);
195 button_marker_widget.GetScreenSize(dot_width, dot_height);
197 draw_pos_y = text_widget_pos_y + text_widget_height / 2;
201 draw_pos_x = text_widget_pos_x + text_widget_width - 1;
205 draw_pos_x = text_widget_pos_x;
208 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));
209 canvas_widget.DrawLine(dot_pos_x+dot_width/2, draw_pos_y, dot_pos_x+dot_width/2, dot_pos_y+dot_height/2, 2,
ARGBF(0.6, 1, 1, 1));
214 panel_widget.Show(
false);
216 panel_widget.Update();
220 for (l = 0; l < button_marker_groups.Count(); l++)
222 text_widget_pos_x = 0;
223 text_widget_pos_y = 0;
224 text_widget_width = 0;
225 text_widget_height = 0;
226 float group_point_x = 0, group_point_y = 0;
227 float first_x = 0, first_y = 0;
229 ref
array<int> element = button_marker_groups.GetElement(l);
230 string key_name = button_marker_groups.GetKey(l);
231 button_marker_widget = layoutRoot.FindAnyWidget(
"button_marker_" + key_name);
233 for (
int g = 0; g < element.Count(); g++)
235 panel_widget = layoutRoot.FindAnyWidget(
"PanelWidget" + element[g]);
237 panel_widget.GetScreenPos(text_widget_pos_x, text_widget_pos_y);
238 panel_widget.GetScreenSize(text_widget_width, text_widget_height);
244 first_x = text_widget_pos_x + text_widget_width +50;
248 first_x = text_widget_pos_x - 50;
250 first_y = text_widget_pos_y + text_widget_height/2;
254 group_point_x += text_widget_pos_x;
255 group_point_y += text_widget_pos_y;
259 canvas_widget.DrawLine(text_widget_pos_x + text_widget_width - 1, text_widget_pos_y + text_widget_height/2, text_widget_pos_x + text_widget_width +50, text_widget_pos_y + text_widget_height/2, 2,
ARGBF(0.6, 1, 1, 1));
263 canvas_widget.DrawLine(text_widget_pos_x, text_widget_pos_y + text_widget_height/2, text_widget_pos_x - 50, text_widget_pos_y + text_widget_height/2, 2,
ARGBF(0.6, 1, 1, 1));
269 group_point_x = group_point_x/element.Count() + text_widget_width + 50;
273 group_point_x = group_point_x/element.Count() - 50;
276 group_point_y = group_point_y/element.Count() + text_widget_height/2;
278 button_marker_widget.GetScreenPos(dot_pos_x, dot_pos_y);
279 button_marker_widget.GetScreenSize(dot_width, dot_height);
281 canvas_widget.DrawLine(group_point_x, group_point_y, dot_pos_x+dot_width/2, group_point_y, 2,
ARGBF(0.6, 1, 1, 1));
282 canvas_widget.DrawLine(dot_pos_x+dot_width/2, group_point_y, dot_pos_x+dot_width/2, dot_pos_y, 2,
ARGBF(0.6, 1, 1, 1));
286 canvas_widget.DrawLine(first_x, first_y, text_widget_pos_x + text_widget_width +50, text_widget_pos_y + text_widget_height/2, 2,
ARGBF(0.6, 1, 1, 1));
290 canvas_widget.DrawLine(first_x, first_y, text_widget_pos_x - 50, text_widget_pos_y + text_widget_height/2, 2,
ARGBF(0.6, 1, 1, 1));
299 string file_path = PATH_MOUSEKEY;
300 string profile_name =
"";
303 #ifdef PLATFORM_CONSOLE
306 if (profile_name ==
"#STR_UAPRESET_0")
309 file_path = PATH_X1_OLD;
311 file_path = PATH_PS_OLD;
314 else if (profile_name ==
"#STR_UAPRESET_1")
317 file_path = PATH_X1_NEW;
319 file_path = PATH_PS_NEW;
332 string js_error =
"";
333 string line_content =
"";
337 while (
FGets(file_handle, line_content) >= 0)
339 content += line_content;
343 if (js.ReadFromString(control_mapping_info, content, js_error))
345 return control_mapping_info;
349 ErrorEx(
"JSON ERROR => [TutorialsMenu]: " + js_error);
354 ErrorEx(
"FILEHANDLE ERROR => [TutorialsMenu]: " + js_error);
357 return control_mapping_info;
360 override void Update(
float timeslice)
362 if (
GetUApi().GetInputByID(UAUITabLeft).LocalPress())
368 if (
GetUApi().GetInputByID(UAUITabRight).LocalPress())
373 if (
GetUApi().GetInputByID(UAUIBack).LocalPress())
454 return (w && w ==
m_Back);
463 int color_pnl =
ARGB(255, 0, 0, 0);
464 int color_lbl =
ARGB(255, 255, 0, 0);
465 int color_img =
ARGB(255, 200, 0, 0);
467 #ifdef PLATFORM_CONSOLE
468 color_pnl =
ARGB(255, 200, 0, 0);
469 color_lbl =
ARGB(255, 255, 255, 255);
472 ButtonSetColor(w, color_pnl);
473 ButtonSetTextColor(w, color_lbl);
474 ImagenSetColor(w, color_img);
482 int color_pnl =
ARGB(0, 0, 0, 0);
483 int color_lbl =
ARGB(255, 255, 255, 255);
484 int color_img =
ARGB(255, 255, 255, 255);
486 ButtonSetColor(w, color_pnl);
487 ButtonSetTextColor(w, color_lbl);
488 ImagenSetColor(w, color_img);
491 void ButtonSetText(
Widget w,
string text)
505 void ButtonSetColor(
Widget w,
int color)
510 Widget panel = w.FindWidget(w.GetName() +
"_panel");
514 panel.SetColor(color);
518 void ImagenSetColor(
Widget w,
int color)
523 Widget panel = w.FindWidget(w.GetName() +
"_image");
527 panel.SetColor(color);
531 void ButtonSetTextColor(
Widget w,
int color)
542 label.SetColor(color);
547 text.SetColor(color);
552 text2.SetColor(color);
558 #ifdef PLATFORM_CONSOLE
562 string text =
string.Format(
" %1",
InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIBack",
"#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Back_BackText0", EUAINPUT_DEVICE_CONTROLLER,
InputUtils.ICON_SCALE_TOOLBAR));
563 toolbar_text.SetText(text);
567 toolbar_b2.SetText(
InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIBack",
"", EUAINPUT_DEVICE_CONTROLLER,
InputUtils.ICON_SCALE_TOOLBAR));
573 bool toolbarShow =
false;
574 #ifdef PLATFORM_CONSOLE
575 toolbarShow = !
GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() ||
GetGame().GetInput().GetCurrentInputDevice() ==
EInputDeviceType.CONTROLLER;
578 #ifdef PLATFORM_CONSOLE
579 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(toolbarShow);
581 layoutRoot.FindAnyWidget(
"play_panel_root").Show(!toolbarShow);