Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
controlsxboxnew.c
Go to the documentation of this file.
1 
2 //used as UserID in the layout. Values assigned for convenience here
3 enum EConsoleButtonsControls
4 {
5  INVALID = 0, //assumed unassigned value, ignored (dividers, formatting elements etc.)
8  BUTTON_A = 4,
9  BUTTON_B = 8,
10  BUTTON_X = 16,
11  BUTTON_Y = 32,
24 }
25 
26 typedef map<int,ref array<Widget>> TButtonPairingInfo; //<button_mask,<associated widgets on the respective side>>
27 
28 class ControlsXboxNew extends UIScriptedMenu
29 {
30  protected string m_BackButtonTextID;
31  protected string m_NextPresetText;
32  protected int m_CurrentTabIdx = -1;
33  protected int m_CurrentPresetVariant = -1;
34 
35  protected ButtonWidget m_Back;
36  protected ImageWidget m_ControlsLayoutImage;
37 
38  //-------------
39  protected CanvasWidget m_CanvasWidget;
40  protected TabberUI m_TabScript;
41  protected Widget m_TabberWidget;
42  protected Widget m_ControlsImage;
43  protected Widget m_PlatformHolder; //controls container for selected platform
44  protected Widget m_VariantWidget;
45 
46  protected ref map<int,Widget> m_ImageMarkerStructure;
47  protected ref map<int,Widget> m_CategoryStructure;
48  protected ref map<int,ref TButtonPairingInfo> m_AreasLR; //left/right area holders
49 
50  protected const int AREA_LEFT = 1;
51  protected const int AREA_RIGHT = 2;
52  protected const int PLATFORM_ADJUST_X1 = 1000;
53  protected const int PLATFORM_ADJUST_PS = 2000;
54 
55  //============================================
56  // ControlsXboxNew
57  //============================================
58  void ~ControlsXboxNew()
59  {
60  PPERequesterBank.GetRequester(PPERequesterBank.REQ_MENUEFFECTS).Stop();
61  }
62 
63  protected void OnInputPresetChanged()
64  {
65  #ifdef PLATFORM_CONSOLE
68  #endif
69  }
70 
71  protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
72  {
74  }
75 
76  void Back()
77  {
78  GetGame().GetUIManager().Back();
79  }
80 
81  void UpdateTabContent(int tab_index)
82  {
83  Widget w;
84  //hide old
85  if (m_CurrentTabIdx != -1)
86  {
87  m_VariantWidget.Show(false);
88  while (m_VariantWidget.GetParent())
89  {
90  m_VariantWidget = m_VariantWidget.GetParent();
91  m_VariantWidget.Show(false);
92  }
93  }
94  //show new
95  w = FindChildByID(m_CategoryStructure[tab_index],InputUtils.GetConsolePresetID());
96  w.Show(true);
97  m_VariantWidget = w;
98 
99  while (w.GetParent())
100  {
101  w = w.GetParent();
102  w.Show(true);
103  }
104 
105  DrawConnectingLines(tab_index);
106  m_CurrentTabIdx = tab_index;
107  }
108 
109  protected void DrawConnectingLines(int index)
110  {
111  //disconnected for now, to be finished
112  return;
113 
114  m_CanvasWidget.Clear();
115 
116  //TODO drawing over nyah
117  m_VariantWidget;
118  m_AreasLR = new map<int,ref TButtonPairingInfo>;
119 
120  Widget wid_side; //left or right area
121  Widget wid_spacer; //item in the L/R areas
122  wid_side = m_VariantWidget.GetChildren();
123  typename t = EConsoleButtonsControls;
124  int side_idx;
125  int enum_value;
126  array<Widget> items_raw;
127  array<Widget> items_filtered;
128 
129  while (wid_side)
130  {
131  TButtonPairingInfo button_mapping = new TButtonPairingInfo;
132 
133  side_idx = wid_side.GetUserID();
134  wid_spacer = wid_side.GetChildren(); //dig into the side first..
135 
136  for (int i = 1; i < EnumTools.GetEnumSize(EConsoleButtonsControls); i++)
137  {
138  items_raw = new array<Widget>;
139  items_filtered = new array<Widget>;
140  t.GetVariableValue(null, i, enum_value); //TODO
141 
142  FindAllChildrenByID(wid_spacer,enum_value,items_raw);
143  if (FilterByVisible(items_raw,items_filtered) > 0) //if there are any button-relevant items..
144  {
145  button_mapping.Insert(enum_value,items_filtered);
146 
147  //dump it!
148 /*
149  for (int dump = 0; dump < items_filtered.Count(); dump++)
150  {
151  Print("key: " + i + " | name: " + items_filtered[dump].GetName());
152  }
153  Print("-");
154 */
155  }
156  }
157  m_AreasLR.Insert(side_idx,button_mapping);
158 
159  wid_side = wid_side.GetSibling();
160  }
161 
162  //dump it 2: the dumpening!
163 /*
164  int count_2 = m_AreasLR.Count();
165  for (int z = 0; z < m_AreasLR.Count(); z++)
166  {
167  Print("---------");
168  Print("Area: " + z);
169  TButtonPairingInfo tmp_info = m_AreasLR.GetElement(z);
170  int count_1 = tmp_info.Count();
171  for (int zz = 0; zz < tmp_info.Count(); zz++)
172  {
173  for (int zzz = 0; zzz < tmp_info.GetElement(zz).Count(); zzz++)
174  {
175  Print("key: " + tmp_info.GetKey(zz) + " | name: " + tmp_info.GetElement(zz).Get(zzz).GetName());
176  }
177  }
178  }
179 
180  Print("------------------------");
181 */
182  /*
183  map<string, ref array<int>> button_marker_groups_unflitred = new map<string, ref array<int>>;
184  map<string, ref array<int>> button_marker_groups = new map<string, ref array<int>>;
185 
186  float text_widget_pos_x, text_widget_pos_y;
187  float text_widget_width, text_widget_height;
188  float dot_pos_x, dot_pos_y;
189  float dot_width, dot_height;
190  float draw_pos_x, draw_pos_y;
191 
192  m_CanvasWidget.Clear();
193 
194  for (int i = 0; i < m_TabScript.GetTabCount(); i++)
195  {
196  tab_array.Insert(new array<ref JsonControlMappingInfo>);
197  for (int j = 0; j < 20; j++)
198  {
199  tab_array[i].Insert(null);
200  }
201  }
202 
203  // insert json info to array by index, so it is sorted
204  for (i = 0; i < control_mapping_info.Count(); i++)
205  {
206  JsonControlMappingInfo info = control_mapping_info.Get(i);
207  tab_array[info.m_TabID][info.m_TextWidgetID] = info;
208  }
209 
210  // create group of buttons which are connected together with line
211  for (int l = 0; l < control_mapping_info.Count(); l++)
212  {
213  JsonControlMappingInfo info1 = control_mapping_info[l];
214  string button_name = info1.m_ButtonName;
215  int text_widget_id = info1.m_TextWidgetID;
216  if (info1.m_TabID != index)
217  {
218  continue;
219  }
220  if (!button_marker_groups_unflitred.Contains(button_name))
221  {
222  button_marker_groups_unflitred.Insert(button_name, new ref array<int>);
223  button_marker_groups_unflitred.Get(button_name).Insert(text_widget_id);
224  }
225  else
226  {
227  button_marker_groups_unflitred.Get(button_name).Insert(text_widget_id);
228  }
229  }
230 
231  // we want groups which are bigger than 1
232  for (l = 0; l < button_marker_groups_unflitred.Count(); l++)
233  {
234  if (button_marker_groups_unflitred.GetElement(l).Count() > 1)
235  {
236  string key = button_marker_groups_unflitred.GetKey(l);
237  button_marker_groups.Insert(button_marker_groups_unflitred.GetKey(l), button_marker_groups_unflitred.Get(key));
238  }
239  }
240 
241  Widget panel_widget;
242  Widget button_marker_widget;
243 
244  for (l = 0; l < tab_array[index].Count(); l++)
245  {
246  panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + l);
247  if (tab_array[index][l] != null)
248  {
249  TextWidget text_widget = TextWidget.Cast(panel_widget.FindAnyWidget("TextWidget" + l));
250 
251  string key_prefix;
252  #ifdef PLATFORM_XBOX
253  key_prefix = "xb_button_marker_";
254  #else
255  #ifdef PLATFORM_PS4
256  key_prefix = "ps_button_marker_";
257  #endif
258  #endif
259 
260  button_marker_widget = layoutRoot.FindAnyWidget(key_prefix + tab_array[index][l].m_ButtonName);
261  text_widget.SetText(tab_array[index][l].m_InfoText);
262  panel_widget.Show(true);
263  button_marker_widget.Show(true);
264  panel_widget.Update();
265  if (!button_marker_groups.Contains(tab_array[index][l].m_ButtonName))
266  {
267  panel_widget.GetScreenPos(text_widget_pos_x, text_widget_pos_y);
268  panel_widget.GetScreenSize(text_widget_width,text_widget_height);
269 
270  button_marker_widget.GetScreenPos(dot_pos_x, dot_pos_y);
271  button_marker_widget.GetScreenSize(dot_width, dot_height);
272 
273  draw_pos_y = text_widget_pos_y + text_widget_height / 2;
274  if (l < 10)
275  {
276  draw_pos_x = text_widget_pos_x + text_widget_width - 1;
277  }
278  else
279  {
280  draw_pos_x = text_widget_pos_x;
281  }
282  m_CanvasWidget.DrawLine(draw_pos_x, draw_pos_y, dot_pos_x+dot_width/2, draw_pos_y, 2, ARGBF(0.6, 1, 1, 1));
283  m_CanvasWidget.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));
284  }
285  }
286  else
287  {
288  panel_widget.Show(false);
289  }
290  panel_widget.Update();
291  }
292 
293  // draw connecting lines
294  for (l = 0; l < button_marker_groups.Count(); l++)
295  {
296  text_widget_pos_x = 0;
297  text_widget_pos_y = 0;
298  text_widget_width = 0;
299  text_widget_height = 0;
300  float group_point_x = 0, group_point_y = 0;
301  float first_x = 0, first_y = 0;
302 
303  ref array<int> element = button_marker_groups.GetElement(l);
304  string key_name = button_marker_groups.GetKey(l);
305  #ifdef PLATFORM_XBOX
306  key_prefix = "xb_button_marker_";
307  #else
308  #ifdef PLATFORM_PS4
309  key_prefix = "ps_button_marker_";
310  #endif
311  #endif
312  button_marker_widget = layoutRoot.FindAnyWidget(key_prefix + key_name);
313 
314  for (int g = 0; g < element.Count(); g++)
315  {
316  panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + element[g]);
317 
318  panel_widget.GetScreenPos(text_widget_pos_x, text_widget_pos_y);
319  panel_widget.GetScreenSize(text_widget_width, text_widget_height);
320 
321  if (g == 0)
322  {
323  if (element[0] < 10)
324  {
325  first_x = text_widget_pos_x + text_widget_width +50;
326  }
327  else
328  {
329  first_x = text_widget_pos_x - 50;
330  }
331 
332  first_y = text_widget_pos_y + text_widget_height/2;
333  }
334 
335  group_point_x += text_widget_pos_x;
336  group_point_y += text_widget_pos_y;
337  if (element[0] < 10)
338  {
339  m_CanvasWidget.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));
340  }
341  else
342  {
343  m_CanvasWidget.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));
344  }
345  }
346  if (element[0] < 10)
347  {
348  group_point_x = group_point_x/element.Count() + text_widget_width + 50;
349  }
350  else
351  {
352  group_point_x = group_point_x/element.Count() - 50;
353  }
354 
355  if (element.Count() % 2 == 0)
356  {
357  group_point_y = ((text_widget_pos_y + text_widget_height/2) - first_y) / 2 + first_y;
358  }
359  else
360  {
361  float text_widget_pos_x_center, text_widget_pos_y_center;
362  float text_widget_width_center, text_widget_height_center;
363 
364  panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + element[1]);
365 
366  panel_widget.GetScreenPos(text_widget_pos_x_center, text_widget_pos_y_center);
367  panel_widget.GetScreenSize(text_widget_width_center, text_widget_height_center);
368 
369  group_point_y = text_widget_pos_y_center + text_widget_height_center / 2;
370  }
371 
372  button_marker_widget.GetScreenPos(dot_pos_x, dot_pos_y);
373  button_marker_widget.GetScreenSize(dot_width, dot_height);
374 
375  m_CanvasWidget.DrawLine(group_point_x, group_point_y, dot_pos_x+dot_width/2, group_point_y, 2, ARGBF(0.6, 1, 1, 1));
376  m_CanvasWidget.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));
377 
378  if (element[0] < 10)
379  {
380  m_CanvasWidget.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));
381  }
382  else
383  {
384  m_CanvasWidget.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));
385  }
386  }
387  */
388  }
389 
390  //============================================
391  // Init
392  //============================================
393  override Widget Init()
394  {
395  m_CategoryStructure = new map<int,Widget>;
396  m_ImageMarkerStructure = new map<int,Widget>;
397 
398  layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/Controls_Screen.layout");
399  #ifdef PLATFORM_XBOX
400  m_ControlsImage = layoutRoot.FindAnyWidget("XboxControlsImage");
401  #else
402  #ifdef PLATFORM_PS4
403  m_ControlsImage = layoutRoot.FindAnyWidget("PSControlsImage");
404  #endif
405  #endif
406  m_ControlsImage.Show(true);
407  m_TabberWidget = layoutRoot.FindAnyWidget("Tabber");
408  m_TabberWidget.GetScript(m_TabScript);
409  m_TabScript.m_OnTabSwitch.Insert(UpdateTabContent);
410  m_CanvasWidget = CanvasWidget.Cast(layoutRoot.FindAnyWidget("CanvasUniversal"));
411  m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget("back"));
412 
413  UpdateToolbarText();
416 
417  PPERequester_MenuEffects requester;
418  Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequesterBank.REQ_MENUEFFECTS));
419  requester.SetVignetteIntensity(0.6);
420 
421  ComposeData();
422  UpdateTabContent(0);
423 
424  GetGame().GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
425  GetGame().GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
426 
427  OnInputDeviceChanged(GetGame().GetInput().GetCurrentInputDevice());
428 
429 
430  return layoutRoot;
431  }
432 
433  override void OnShow()
434  {
435  super.OnShow();
436 
437  SetFocus(null);
438  }
439 
440  override bool OnClick(Widget w, int x, int y, int button)
441  {
442  if (button == MouseState.LEFT)
443  {
444  if (w == m_Back)
445  {
446  Back();
447  return true;
448  }
449  }
450  return false;
451  }
452 
453  override bool OnMouseEnter(Widget w, int x, int y)
454  {
455  if (IsFocusable(w))
456  {
457  ColorHighlight(w);
458  return true;
459  }
460  return false;
461  }
462 
463  override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
464  {
465  if (IsFocusable(w))
466  {
467  ColorNormal(w);
468  return true;
469  }
470  return false;
471  }
472 
473  override bool OnFocus(Widget w, int x, int y)
474  {
475  if (IsFocusable(w))
476  {
477  ColorHighlight(w);
478  return true;
479  }
480  return false;
481  }
482 
483  override bool OnFocusLost(Widget w, int x, int y)
484  {
485  if (IsFocusable(w))
486  {
487  ColorNormal(w);
488  return true;
489  }
490  return false;
491  }
492 
493  bool IsFocusable(Widget w)
494  {
495  return (w && w == m_Back);
496  }
497 
498  override void Update(float timeslice)
499  {
500  if (GetUApi().GetInputByID(UAUITabLeft).LocalPress())
501  {
502  m_TabScript.PreviousTab();
503  }
504 
505  if (GetUApi().GetInputByID(UAUITabRight).LocalPress())
506  {
507  m_TabScript.NextTab();
508  }
509 
510  if (GetUApi().GetInputByID(UAUIBack).LocalPress())
511  {
512  Back();
513  }
514 
515  if (GetUApi().GetInputByID(UASwitchPreset).LocalPress())
516  {
517  PerformSwitchPreset();
518  UpdateTabContent(m_CurrentTabIdx);
519  m_TabScript.RefreshTab();
520  }
521  }
522 
524  protected void ComposeData()
525  {
526  if (m_CategoryStructure)
527  {
528  m_CategoryStructure = null;
529  m_CategoryStructure = new map<int,Widget>;
530  }
531 
532  if (m_ImageMarkerStructure)
533  {
534  m_ImageMarkerStructure = null;
535  m_ImageMarkerStructure = new map<int,Widget>;
536  }
537 
538  Widget w = m_ControlsImage.GetChildren();
539  m_ImageMarkerStructure.Set(w.GetUserID(),w);
540 
541  while (w.GetSibling())
542  {
543  w = w.GetSibling();
544  m_ImageMarkerStructure.Set(w.GetUserID(),w); //inits button markers with their IDs
545  }
546 
547  InputUtils.UpdateConsolePresetID();
548 
549  #ifdef PLATFORM_XBOX
550  m_PlatformHolder = FindChildByID(layoutRoot,PLATFORM_ADJUST_X1);
551  #else
552  m_PlatformHolder = FindChildByID(layoutRoot,PLATFORM_ADJUST_PS);
553  #endif
554 
555  //categories
556  Widget category_widget = m_PlatformHolder.GetChildren();
557  m_CategoryStructure.Set(category_widget.GetUserID(),category_widget);
558 
559  while (category_widget.GetSibling())
560  {
561  category_widget = category_widget.GetSibling();
562  m_CategoryStructure.Set(category_widget.GetUserID(),category_widget);
563  }
564  }
565 
566  protected void PerformSwitchPreset()
567  {
568  int index;
569  string preset_text;
570  UAInputAPI inputAPI = GetUApi();
571 
572  index = inputAPI.PresetCurrent() + 1;
573  if (index >= inputAPI.PresetCount())
574  {
575  index = 0;
576  }
577 
578  inputAPI.SupressNextFrame(true);
579  inputAPI.PresetSelect(index);
580  UpdateToolbarText();
581 
582  GetGame().GetMission().GetOnInputPresetChanged().Invoke();
583 
584  #ifdef PLATFORM_WINDOWS
585  GetUApi().Export(); //works on emulated consoles (-xbox,-ps4)
586  #else
587  GetUApi().SaveInputPresetMiscData(); //default console functionality
588  #endif
589 
590  InputUtils.UpdateConsolePresetID();
592  }
593 
594  protected void UpdateToolbarText()
595  {
596  UAInputAPI inputAPI = GetUApi();
597  int target_idx = inputAPI.PresetCurrent() + 1;
598  int count = inputAPI.PresetCount();
599  if (target_idx >= inputAPI.PresetCount())
600  {
601  target_idx = 0;
602  }
603 
604  m_NextPresetText = inputAPI.PresetName(target_idx);
605  if (m_NextPresetText == InputUtils.PRESET_OLD)
606  {
607  m_NextPresetText = "#STR_UAPRESET_ChangeTo_0";
608  }
609  else if (m_NextPresetText == InputUtils.PRESET_NEW)
610  {
611  m_NextPresetText = "#STR_UAPRESET_ChangeTo_1";
612  }
613  else
614  {
615  m_NextPresetText = "Invalid console preset name: " + m_NextPresetText;
616  }
617  }
618 
620  protected Widget FindChildByID(Widget wid, int user_id)
621  {
622  Widget ret = wid.GetChildren();
623  while (ret)
624  {
625  if (ret.GetUserID() == user_id)
626  {
627  return ret;
628  }
629  ret = ret.GetSibling();
630  }
631  return ret;
632  }
633 
635  protected bool FindAllChildrenByID(Widget wid, int user_id, out array<Widget> results)
636  {
637  Widget child = wid.GetChildren();
638  while (child)
639  {
640  if (child.GetUserID() == user_id)
641  {
642  results.Insert(child);
643  }
644  child = child.GetSibling();
645  }
646  return (results && results.Count() > 0);
647  }
648 
650  protected int FilterByVisible(array<Widget> input, array<Widget> filtered)
651  {
652  for (int i = 0; i < input.Count(); i++)
653  {
654  if (input[i].IsVisible())
655  {
656  filtered.Insert(input[i]);
657  }
658  }
659 
660  return filtered.Count();
661  }
662 
663  void ColorHighlight(Widget w)
664  {
665  if (!w)
666  return;
667 
668  int color_pnl = ARGB(255, 0, 0, 0);
669  int color_lbl = ARGB(255, 255, 0, 0);
670 
671  #ifdef PLATFORM_CONSOLE
672  color_pnl = ARGB(255, 200, 0, 0);
673  color_lbl = ARGB(255, 255, 255, 255);
674  #endif
675 
676  ButtonSetColor(w, color_pnl);
677  ButtonSetTextColor(w, color_lbl);
678  }
679 
680  void ColorNormal(Widget w)
681  {
682  if (!w)
683  return;
684 
685  int color_pnl = ARGB(0, 0, 0, 0);
686  int color_lbl = ARGB(255, 255, 255, 255);
687 
688  ButtonSetColor(w, color_pnl);
689  ButtonSetTextColor(w, color_lbl);
690  }
691 
692  void ButtonSetText(Widget w, string text)
693  {
694  if (!w)
695  return;
696 
697  TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
698 
699  if (label)
700  {
701  label.SetText(text);
702  }
703 
704  }
705 
706  void ButtonSetColor(Widget w, int color)
707  {
708  if (!w)
709  return;
710 
711  Widget panel = w.FindWidget(w.GetName() + "_panel");
712 
713  if (panel)
714  {
715  panel.SetColor(color);
716  }
717  }
718 
719  void ButtonSetTextColor(Widget w, int color)
720  {
721  if (!w)
722  return;
723 
724  TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
725  TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
726  TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
727 
728  if (label)
729  {
730  label.SetColor(color);
731  }
732 
733  if (text)
734  {
735  text.SetColor(color);
736  }
737 
738  if (text2)
739  {
740  text2.SetColor(color);
741  }
742  }
743 
744  protected void UpdateControlsElements()
745  {
746  RichTextWidget toolbar_switch = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ChangePresetText"));
747  toolbar_switch.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UASwitchPreset", m_NextPresetText, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
748 
749  RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
750  string text = string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Back_BackText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
751  toolbar_text.SetText(text);
752 
753  RichTextWidget toolbar_b2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon0"));
754  toolbar_b2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
755  }
756 
757  protected void UpdateControlsElementVisibility()
758  {
759  bool toolbarShow = false;
760  #ifdef PLATFORM_CONSOLE
761  toolbarShow = !GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
762  #endif
763 
764  layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
765  layoutRoot.FindAnyWidget("play_panel_root").Show(!toolbarShow);
766  }
767 }
GetGame
proto native CGame GetGame()
UIScriptedMenu
Definition: dayzgame.c:63
BUTTON_GROUP_PAD_COMMON
@ BUTTON_GROUP_PAD_COMMON
Definition: controlsxboxnew.c:23
TButtonPairingInfo
enum map TButtonPairingInfo
BUTTON_X
@ BUTTON_X
Definition: controlsxboxnew.c:10
BUTTON_MENU
@ BUTTON_MENU
Definition: controlsxboxnew.c:6
InputUtils
Definition: inpututils.c:1
DrawConnectingLines
void DrawConnectingLines(int index)
Definition: controlsxbox.c:41
Back
void Back()
Definition: controlsxbox.c:36
BUTTON_PAD_LEFT
@ BUTTON_PAD_LEFT
Definition: controlsxboxnew.c:14
UpdateControlsElements
protected void UpdateControlsElements()
Definition: itemdropwarningmenu.c:92
BUTTON_VIEW
@ BUTTON_VIEW
Definition: controlsxboxnew.c:7
y
Icon y
BUTTON_THUMB_LEFT
@ BUTTON_THUMB_LEFT
Definition: controlsxboxnew.c:18
BUTTON_Y
@ BUTTON_Y
Definition: controlsxboxnew.c:11
BUTTON_SHOULDER_RIGHT
@ BUTTON_SHOULDER_RIGHT
Definition: controlsxboxnew.c:17
m_BackButtonTextID
class JsonControlMappingInfo m_BackButtonTextID
BUTTON_TRIGGER_LEFT
@ BUTTON_TRIGGER_LEFT
Definition: controlsxboxnew.c:20
BUTTON_SHOULDER_LEFT
@ BUTTON_SHOULDER_LEFT
Definition: controlsxboxnew.c:16
OnInputDeviceChanged
protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition: inventory.c:167
BUTTON_B
@ BUTTON_B
Definition: controlsxboxnew.c:9
EInputDeviceType
EInputDeviceType
Definition: input.c:2
OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition: uihintpanel.c:276
BUTTON_GROUP_RIGHT_SIDE_COMMON
@ BUTTON_GROUP_RIGHT_SIDE_COMMON
Definition: controlsxboxnew.c:22
RichTextWidget
Definition: gameplay.c:315
map
map
Definition: controlsxboxnew.c:3
m_Back
protected ButtonWidget m_Back
Definition: controlsxbox.c:17
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
BUTTON_THUMB_RIGHT
@ BUTTON_THUMB_RIGHT
Definition: controlsxboxnew.c:19
TextWidget
Definition: enwidgets.c:219
EnumTools
Definition: enconvert.c:589
ColorNormal
void ColorNormal(Widget w)
Definition: serverbrowsertab.c:668
UpdateControlsElementVisibility
protected void UpdateControlsElementVisibility()
Definition: itemdropwarningmenu.c:100
IsVisible
proto native bool IsVisible()
BUTTON_PAD_UP
@ BUTTON_PAD_UP
Definition: controlsxboxnew.c:12
BUTTON_PAD_DOWN
@ BUTTON_PAD_DOWN
Definition: controlsxboxnew.c:13
ColorHighlight
void ColorHighlight(Widget w)
Definition: serverbrowsertab.c:619
OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition: serverbrowsertab.c:235
MouseState
MouseState
Definition: ensystem.c:310
m_ControlsLayoutImage
protected ImageWidget m_ControlsLayoutImage
Definition: controlsxbox.c:18
array< Widget >
Update
proto native volatile void Update()
Definition: playersoundmanager.c:125
SetFocus
proto native void SetFocus(Widget w)
x
Icon x
BUTTON_TRIGGER_RIGHT
@ BUTTON_TRIGGER_RIGHT
Definition: controlsxboxnew.c:21
OnInputPresetChanged
protected void OnInputPresetChanged()
Definition: inventory.c:160
BUTTON_PAD_RIGHT
@ BUTTON_PAD_RIGHT
Definition: controlsxboxnew.c:15
OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition: serverbrowsertab.c:217
OnShow
override void OnShow()
Definition: controlsxbox.c:349
Widget
Definition: enwidgets.c:189
UAInputAPI
Definition: uainput.c:164
GetUApi
proto native UAInputAPI GetUApi()
GetInput
ActionInput GetInput()
Definition: actionbase.c:1066
OnClick
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition: dayzgame.c:146
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition: uihintpanel.c:267
ARGB
int ARGB(int a, int r, int g, int b)
Definition: proto.c:322
BUTTON_A
@ BUTTON_A
Definition: controlsxboxnew.c:8
IsFocusable
bool IsFocusable(Widget w)
Definition: serverbrowsertab.c:284
INVALID
@ INVALID
Definition: controlsxboxnew.c:5
m_TabScript
protected TabberUI m_TabScript
Definition: controlsxbox.c:21