3 enum EConsoleButtonsControls
31 protected string m_NextPresetText;
32 protected int m_CurrentTabIdx = -1;
33 protected int m_CurrentPresetVariant = -1;
35 protected ButtonWidget
m_Back;
39 protected CanvasWidget m_CanvasWidget;
41 protected Widget m_TabberWidget;
42 protected Widget m_ControlsImage;
43 protected Widget m_PlatformHolder;
44 protected Widget m_VariantWidget;
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;
58 void ~ControlsXboxNew()
60 PPERequesterBank.GetRequester(PPERequesterBank.REQ_MENUEFFECTS).Stop();
65 #ifdef PLATFORM_CONSOLE
78 GetGame().GetUIManager().Back();
81 void UpdateTabContent(
int tab_index)
85 if (m_CurrentTabIdx != -1)
87 m_VariantWidget.Show(
false);
88 while (m_VariantWidget.GetParent())
90 m_VariantWidget = m_VariantWidget.GetParent();
91 m_VariantWidget.Show(
false);
95 w = FindChildByID(m_CategoryStructure[tab_index],
InputUtils.GetConsolePresetID());
106 m_CurrentTabIdx = tab_index;
114 m_CanvasWidget.Clear();
122 wid_side = m_VariantWidget.GetChildren();
123 typename t = EConsoleButtonsControls;
133 side_idx = wid_side.GetUserID();
134 wid_spacer = wid_side.GetChildren();
136 for (
int i = 1; i <
EnumTools.GetEnumSize(EConsoleButtonsControls); i++)
140 t.GetVariableValue(
null, i, enum_value);
142 FindAllChildrenByID(wid_spacer,enum_value,items_raw);
143 if (FilterByVisible(items_raw,items_filtered) > 0)
145 button_mapping.Insert(enum_value,items_filtered);
157 m_AreasLR.Insert(side_idx,button_mapping);
159 wid_side = wid_side.GetSibling();
398 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/xbox/Controls_Screen.layout");
400 m_ControlsImage = layoutRoot.FindAnyWidget(
"XboxControlsImage");
403 m_ControlsImage = layoutRoot.FindAnyWidget(
"PSControlsImage");
406 m_ControlsImage.Show(
true);
407 m_TabberWidget = layoutRoot.FindAnyWidget(
"Tabber");
409 m_TabScript.m_OnTabSwitch.Insert(UpdateTabContent);
410 m_CanvasWidget = CanvasWidget.Cast(layoutRoot.FindAnyWidget(
"CanvasUniversal"));
411 m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"back"));
417 PPERequester_MenuEffects requester;
418 Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequesterBank.REQ_MENUEFFECTS));
419 requester.SetVignetteIntensity(0.6);
495 return (w && w ==
m_Back);
498 override void Update(
float timeslice)
500 if (
GetUApi().GetInputByID(UAUITabLeft).LocalPress())
505 if (
GetUApi().GetInputByID(UAUITabRight).LocalPress())
510 if (
GetUApi().GetInputByID(UAUIBack).LocalPress())
515 if (
GetUApi().GetInputByID(UASwitchPreset).LocalPress())
517 PerformSwitchPreset();
518 UpdateTabContent(m_CurrentTabIdx);
524 protected void ComposeData()
526 if (m_CategoryStructure)
528 m_CategoryStructure =
null;
532 if (m_ImageMarkerStructure)
534 m_ImageMarkerStructure =
null;
538 Widget w = m_ControlsImage.GetChildren();
539 m_ImageMarkerStructure.Set(w.GetUserID(),w);
541 while (w.GetSibling())
544 m_ImageMarkerStructure.Set(w.GetUserID(),w);
550 m_PlatformHolder = FindChildByID(layoutRoot,PLATFORM_ADJUST_X1);
552 m_PlatformHolder = FindChildByID(layoutRoot,PLATFORM_ADJUST_PS);
556 Widget category_widget = m_PlatformHolder.GetChildren();
557 m_CategoryStructure.Set(category_widget.GetUserID(),category_widget);
559 while (category_widget.GetSibling())
561 category_widget = category_widget.GetSibling();
562 m_CategoryStructure.Set(category_widget.GetUserID(),category_widget);
566 protected void PerformSwitchPreset()
572 index = inputAPI.PresetCurrent() + 1;
573 if (index >= inputAPI.PresetCount())
578 inputAPI.SupressNextFrame(
true);
579 inputAPI.PresetSelect(index);
582 GetGame().GetMission().GetOnInputPresetChanged().Invoke();
584 #ifdef PLATFORM_WINDOWS
587 GetUApi().SaveInputPresetMiscData();
594 protected void UpdateToolbarText()
597 int target_idx = inputAPI.PresetCurrent() + 1;
598 int count = inputAPI.PresetCount();
599 if (target_idx >= inputAPI.PresetCount())
604 m_NextPresetText = inputAPI.PresetName(target_idx);
605 if (m_NextPresetText ==
InputUtils.PRESET_OLD)
607 m_NextPresetText =
"#STR_UAPRESET_ChangeTo_0";
609 else if (m_NextPresetText ==
InputUtils.PRESET_NEW)
611 m_NextPresetText =
"#STR_UAPRESET_ChangeTo_1";
615 m_NextPresetText =
"Invalid console preset name: " + m_NextPresetText;
622 Widget ret = wid.GetChildren();
625 if (ret.GetUserID() == user_id)
629 ret = ret.GetSibling();
637 Widget child = wid.GetChildren();
640 if (child.GetUserID() == user_id)
642 results.Insert(child);
644 child = child.GetSibling();
646 return (results && results.Count() > 0);
652 for (
int i = 0; i < input.Count(); i++)
656 filtered.Insert(input[i]);
660 return filtered.Count();
668 int color_pnl =
ARGB(255, 0, 0, 0);
669 int color_lbl =
ARGB(255, 255, 0, 0);
671 #ifdef PLATFORM_CONSOLE
672 color_pnl =
ARGB(255, 200, 0, 0);
673 color_lbl =
ARGB(255, 255, 255, 255);
676 ButtonSetColor(w, color_pnl);
677 ButtonSetTextColor(w, color_lbl);
685 int color_pnl =
ARGB(0, 0, 0, 0);
686 int color_lbl =
ARGB(255, 255, 255, 255);
688 ButtonSetColor(w, color_pnl);
689 ButtonSetTextColor(w, color_lbl);
692 void ButtonSetText(
Widget w,
string text)
706 void ButtonSetColor(
Widget w,
int color)
711 Widget panel = w.FindWidget(w.GetName() +
"_panel");
715 panel.SetColor(color);
719 void ButtonSetTextColor(
Widget w,
int color)
730 label.SetColor(color);
735 text.SetColor(color);
740 text2.SetColor(color);
747 toolbar_switch.SetText(
InputUtils.GetRichtextButtonIconFromInputAction(
"UASwitchPreset", m_NextPresetText, EUAINPUT_DEVICE_CONTROLLER,
InputUtils.ICON_SCALE_TOOLBAR));
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);
754 toolbar_b2.SetText(
InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIBack",
"", EUAINPUT_DEVICE_CONTROLLER,
InputUtils.ICON_SCALE_TOOLBAR));
759 bool toolbarShow =
false;
760 #ifdef PLATFORM_CONSOLE
761 toolbarShow = !
GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() ||
GetGame().GetInput().GetCurrentInputDevice() ==
EInputDeviceType.CONTROLLER;
764 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(toolbarShow);
765 layoutRoot.FindAnyWidget(
"play_panel_root").Show(!toolbarShow);