123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847 |
- class OptionsMenu extends UIScriptedMenu
- {
- const int MODAL_ID_DEFAULT = 100;
- const int DIALOG_TAB_OFFSET = 1400;
- protected TabberUI m_Tabber;
- protected ref OptionsMenuGame m_GameTab;
- protected ref OptionsMenuSounds m_SoundsTab;
- protected ref OptionsMenuVideo m_VideoTab;
- protected ref OptionsMenuControls m_ControlsTab;
-
- protected ref GameOptions m_Options;
-
- protected ButtonWidget m_Apply;
- protected ButtonWidget m_Back;
- protected ButtonWidget m_Reset; //undo
- protected ButtonWidget m_Defaults; //defaults
-
- protected Widget m_Details;
- protected TextWidget m_Version;
-
- protected int m_ActiveTabIdx = 0;
- protected bool m_ModalLock;
- protected bool m_CanApplyOrReset;
- protected bool m_CanToggle;
-
- void OptionsMenu()
- {
-
- }
-
- override Widget Init()
- {
- m_Options = new GameOptions();
-
- #ifdef PLATFORM_XBOX
- layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/xbox/options_menu.layout", null);
- #else
- #ifdef PLATFORM_PS4
- layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/ps/options_menu.layout", null);
- #else
- #ifdef PLATFORM_WINDOWS
- layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/pc/options_menu.layout", null);
- #endif
- #endif
- #endif
-
- layoutRoot.FindAnyWidget("Tabber").GetScript(m_Tabber);
-
- m_Details = layoutRoot.FindAnyWidget("settings_details");
- m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget("version"));
-
- m_GameTab = new OptionsMenuGame(layoutRoot.FindAnyWidget("Tab_0"), m_Details, m_Options, this);
- m_SoundsTab = new OptionsMenuSounds(layoutRoot.FindAnyWidget("Tab_1"), m_Details, m_Options, this);
-
- #ifdef PLATFORM_XBOX
- m_ControlsTab = new OptionsMenuControls(layoutRoot.FindAnyWidget("Tab_2"), m_Details, m_Options, this);
- #else
- m_VideoTab = new OptionsMenuVideo(layoutRoot.FindAnyWidget("Tab_2"), m_Details, m_Options, this);
- m_ControlsTab = new OptionsMenuControls(layoutRoot.FindAnyWidget("Tab_3"), m_Details, m_Options, this);
- #endif
-
- m_Apply = ButtonWidget.Cast(layoutRoot.FindAnyWidget("apply"));
- m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget("back"));
- m_Reset = ButtonWidget.Cast(layoutRoot.FindAnyWidget("reset"));
- m_Defaults = ButtonWidget.Cast(layoutRoot.FindAnyWidget("defaults"));
-
- m_ModalLock = false;
- m_CanApplyOrReset = false;
- m_CanToggle = false;
-
- string version;
- GetGame().GetVersion(version);
- #ifdef PLATFORM_CONSOLE
- version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
- #else
- version = "#main_menu_version" + " " + version;
- #endif
- m_Version.SetText(version);
-
- #ifdef PLATFORM_WINDOWS
- SetFocus(layoutRoot);
- #else
- ToggleFocus();
- #endif
-
- m_Tabber.m_OnTabSwitch.Insert(OnTabSwitch);
- m_Tabber.m_OnAttemptTabSwitch.Insert(OnAttemptTabSwitch);
-
- GetGame().GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
- GetGame().GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
- OnChanged();
-
- return layoutRoot;
- }
-
- void ~OptionsMenu()
- {
- }
-
- protected void OnInputPresetChanged()
- {
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElementVisibility();
- #endif
- }
-
- protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
- {
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElementVisibility();
- #endif
- }
-
- override bool OnClick(Widget w, int x, int y, int button)
- {
- if (button == MouseState.LEFT)
- {
- switch (w)
- {
- case m_Apply:
- {
- Apply();
- return true;
- }
- case m_Back:
- {
- Back();
- return true;
- }
- case m_Reset:
- {
- ResetCurrentTab();
- return true;
- }
- case m_Defaults:
- {
- //SetToDefaults();
- PerformSetToDefaults();
- return true;
- }
- }
- }
- return false;
- }
-
- void OnTabSwitch(int tab)
- {
- switch (tab)
- {
- case 0:
- {
- m_GameTab.Focus();
- break;
- }
- case 1:
- {
- m_SoundsTab.Focus();
- break;
- }
- case 2:
- {
- #ifdef PLATFORM_XBOX
- m_ControlsTab.Focus();
- #else
- m_VideoTab.Focus();
- #endif
- break;
- }
- case 3:
- {
- #ifndef PLATFORM_XBOX
- m_ControlsTab.Focus();
- #endif
- break;
- }
- }
-
- m_ActiveTabIdx = tab;
- }
-
- void Apply()
- {
- if (m_ControlsTab.IsChanged())
- m_ControlsTab.Apply();
-
- if (m_SoundsTab.IsChanged())
- m_SoundsTab.Apply();
-
- if (m_GameTab.IsChanged())
- m_GameTab.Apply();
-
- if (m_Options.IsChanged() || m_GameTab.IsChanged())
- {
- m_Options.Test();
- m_Options.Apply();
- }
-
- // save input configuration
- GetUApi().Export();
-
- if (GetGame().GetInput().IsEnabledMouseAndKeyboard()) //useless on consoles
- {
- m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
- ColorDisable(m_Apply);
- m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
- ColorDisable(m_Reset);
- }
-
- m_CanApplyOrReset = false;
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- UpdateControlsElementVisibility();
-
- IngameHud hud;
- if (GetGame().GetMission() && Class.CastTo(hud,GetGame().GetMission().GetHud()))
- {
- hud.ShowQuickBar(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
- }
- #endif
-
- if (m_Options.NeedRestart())
- g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#menu_restart_needed", 117, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
- }
-
- void Back()
- {
- if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
- {
- if (IsAnyTabChanged())
- {
- g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#main_menu_configure_desc", 1337, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- #endif
- }
- else
- {
- m_Options.Revert();
- GetGame().EndOptionsVideo();
- GetGame().GetUIManager().Back();
- }
- }
- }
-
- void OnAttemptTabSwitch(int source, int target)
- {
- bool changed = IsAnyTabChanged();
- if (changed)
- {
- if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
- {
- int id = target + DIALOG_TAB_OFFSET;
- g_Game.GetUIManager().ShowDialog("#main_menu_configure", "#main_menu_configure_desc", id, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- #endif
- }
- }
- else
- {
- ResetCurrentTab();
- }
-
- m_Tabber.SetCanSwitch(!changed);
- }
-
- bool IsAnyTabChanged()
- {
- bool changed = (m_Options.IsChanged() || m_GameTab.IsChanged() || m_SoundsTab.IsChanged() || m_ControlsTab.IsChanged());
- #ifndef PLATFORM_XBOX
- changed |= m_VideoTab.IsChanged();
- #endif
-
- return changed;
- }
-
- void OnChanged()
- {
- bool changed = IsAnyTabChanged();
-
- if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
- {
- if (changed)
- {
- m_Reset.ClearFlags(WidgetFlags.IGNOREPOINTER);
- ColorNormal(m_Reset);
- m_Apply.ClearFlags(WidgetFlags.IGNOREPOINTER);
- ColorNormal(m_Apply);
- }
- else
- {
- m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
- ColorDisable(m_Apply);
- m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
- ColorDisable(m_Reset);
- }
- }
-
- m_CanApplyOrReset = changed;
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- UpdateControlsElementVisibility();
- #endif
-
- m_Tabber.AlignTabbers();
- }
-
- //resets it all
- void Reset()
- {
- m_Options.Revert();
- m_GameTab.Revert();
- m_SoundsTab.Revert();
- m_ControlsTab.Revert();
- #ifndef PLATFORM_XBOX
- m_VideoTab.Revert();
- #endif
-
- if (m_Options.IsChanged())
- m_Options.Revert();
-
- if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
- {
- m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
- ColorDisable(m_Apply);
- m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
- ColorDisable(m_Reset);
- }
-
- m_CanApplyOrReset = false;
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- UpdateControlsElementVisibility();
- #endif
- }
-
- void ResetCurrentTab()
- {
- if (m_Options.IsChanged())
- {
- m_Options.Revert();
- }
-
- switch (m_ActiveTabIdx)
- {
- case 0:
- {
- m_GameTab.Revert();
- break;
- }
- case 1:
- {
- m_SoundsTab.Revert();
- break;
- }
- case 2:
- {
- #ifdef PLATFORM_XBOX
- m_ControlsTab.Revert();
- #else
- m_VideoTab.Revert();
- #endif
- break;
- }
- case 3:
- {
- #ifndef PLATFORM_XBOX
- m_ControlsTab.Revert();
- #endif
- break;
- }
- }
-
- if (m_Options.IsChanged())
- {
- m_Options.Revert();
- }
-
- if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
- {
- m_Apply.SetFlags(WidgetFlags.IGNOREPOINTER);
- ColorDisable(m_Apply);
- m_Reset.SetFlags(WidgetFlags.IGNOREPOINTER);
- ColorDisable(m_Reset);
- }
-
- m_CanApplyOrReset = false;
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- UpdateControlsElementVisibility();
- #endif
-
- m_Tabber.AlignTabbers();
- }
-
- void SetToDefaults()
- {
- if (!g_Game.GetUIManager().IsDialogVisible() && !g_Game.GetUIManager().IsModalVisible())
- {
- g_Game.GetUIManager().ShowDialog("#menu_default_cap", "TODO - reset options to default", MODAL_ID_DEFAULT, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
- }
- }
-
- void PerformSetToDefaults()
- {
- switch (m_ActiveTabIdx)
- {
- case 0:
- m_GameTab.SetToDefaults();
- break;
- case 1:
- m_SoundsTab.SetToDefaults();
- break;
- case 2:
- #ifdef PLATFORM_XBOX
- m_ControlsTab.SetToDefaults();
- #else
- m_VideoTab.SetToDefaults();
- #endif
- break;
- case 3:
- #ifndef PLATFORM_XBOX
- m_ControlsTab.SetToDefaults();
- #endif
- break;
- }
-
- if (GetGame().GetInput().IsEnabledMouseAndKeyboard())
- {
- m_Reset.ClearFlags(WidgetFlags.IGNOREPOINTER);
- ColorNormal(m_Reset);
- m_Apply.ClearFlags(WidgetFlags.IGNOREPOINTER);
- ColorNormal(m_Apply);
- }
-
- m_CanApplyOrReset = true;
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- UpdateControlsElementVisibility();
- #endif
- }
-
- void SliderFocus()
- {
- #ifdef PLATFORM_CONSOLE
- m_CanToggle = false;
- UpdateControlsElements();
- #endif
- }
-
- void ToggleFocus()
- {
- #ifdef PLATFORM_CONSOLE
- m_CanToggle = true;
- UpdateControlsElements();
- #endif
- }
-
- //! Controls visibility and sometimes even state of specific, dependent options across sub-menus
- void ToggleDependentOptions(int mode, bool state)
- {
- m_GameTab.ToggleDependentOptions(mode,state);
- m_SoundsTab.ToggleDependentOptions(mode,state);
- m_ControlsTab.ToggleDependentOptions(mode,state);
- #ifndef PLATFORM_XBOX
- m_VideoTab.ToggleDependentOptions(mode,state);
- #endif
- }
-
- void ReloadOptions()
- {
- m_Options = new GameOptions();
-
- if (m_GameTab)
- m_GameTab.SetOptions(m_Options);
- if (m_SoundsTab)
- m_SoundsTab.SetOptions(m_Options);
- if (m_ControlsTab)
- m_ControlsTab.SetOptions(m_Options);
- #ifndef PLATFORM_XBOX
- if (m_VideoTab)
- m_VideoTab.SetOptions(m_Options);
- #endif
- }
-
- void ReloadVideoOptions()
- {
- #ifndef PLATFORM_XBOX
- if (m_VideoTab)
- m_VideoTab.SetOptions(m_Options);
- #endif
- }
-
- override bool OnModalResult(Widget w, int x, int y, int code, int result)
- {
- bool ret = false;
-
- if (code == 1337)
- {
- if (result == 2)
- {
- m_Options.Revert();
- GetGame().EndOptionsVideo();
- GetGame().GetUIManager().Back();
- }
- ret = true;
- }
- else if (code == 117)
- {
- g_Game.RequestRestart(IDC_MAIN_QUIT);
- }
- else if (code == MODAL_ID_DEFAULT)
- {
- if (result == 2)
- {
- PerformSetToDefaults();
- }
- }
- else if (code >= DIALOG_TAB_OFFSET)
- {
- if (result == 2)
- {
- int id = code - DIALOG_TAB_OFFSET;
- //m_Options.Revert();
- ResetCurrentTab();
- m_Tabber.PerformSwitchTab(id);
- }
- ret = true;
- }
-
- m_ModalLock = ret; //prevents dialog being shown on the next update
- return ret;
- }
-
- override bool OnMouseEnter(Widget w, int x, int y)
- {
- if (w && IsFocusable(w))
- {
- ColorHighlight(w);
- return true;
- }
- return false;
- }
-
- override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
- {
- if (w && IsFocusable(w))
- {
- ColorNormal(w);
- return true;
- }
- return false;
- }
-
- override bool OnFocus(Widget w, int x, int y)
- {
- if (w && IsFocusable(w))
- {
- ColorHighlight(w);
- return true;
- }
- else if (y == 1)
- {
- SliderFocus();
- }
- else
- {
- ToggleFocus();
- }
-
- return false;
- }
-
- override bool OnFocusLost(Widget w, int x, int y)
- {
- if (w && IsFocusable(w))
- {
- ColorNormal(w);
- return true;
- }
- return false;
- }
-
- bool IsFocusable(Widget w)
- {
- if (w)
- {
- return (w == m_Apply || w == m_Back || w == m_Reset || w == m_Defaults);
- }
- return false;
- }
-
- override void Refresh()
- {
- string version;
- GetGame().GetVersion(version);
- #ifdef PLATFORM_CONSOLE
- version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
- #else
- version = "#main_menu_version" + " " + version;
- #endif
-
- m_Version.SetText(version);
-
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- UpdateControlsElementVisibility();
- #endif
- }
-
- override void OnShow()
- {
- super.OnShow();
- m_GameTab.Focus();
- Refresh();
- }
-
- override void Update(float timeslice)
- {
- super.Update(timeslice);
-
- if (m_ModalLock)
- {
- m_ModalLock = false;
- #ifdef PLATFORM_CONSOLE
- UpdateControlsElements();
- #endif
- return;
- }
-
- if (g_Game.GetUIManager().IsDialogVisible())
- {
- return;
- }
-
- if (GetUApi().GetInputByID(UAUITabLeft).LocalPress())
- {
- m_Tabber.PreviousTab();
- }
- else if (GetUApi().GetInputByID(UAUITabRight).LocalPress())
- {
- m_Tabber.NextTab();
- }
- else if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
- {
- if (m_CanApplyOrReset)
- {
- Apply();
- }
- }
- else if (GetUApi().GetInputByID(UAUICredits).LocalPress())
- {
- if (m_CanApplyOrReset)
- {
- ResetCurrentTab();
- }
-
- }
- else if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
- {
- PerformSetToDefaults();
- }
- else if (GetUApi().GetInputByID(UAUIBack).LocalPress())
- {
- Back();
- }
- }
-
- //Coloring functions (Until WidgetStyles are useful)
- void ColorHighlight(Widget w)
- {
- if ((w.GetFlags() & WidgetFlags.IGNOREPOINTER) == WidgetFlags.IGNOREPOINTER)
- {
- return;
- }
- if (w.IsInherited(ButtonWidget))
- {
- ButtonWidget button = ButtonWidget.Cast(w);
- button.SetTextColor(ARGB(255, 200, 0, 0));
- }
-
- w.SetColor(ARGB(255, 0, 0, 0));
-
- TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
- TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
- TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
- ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
- Widget option = Widget.Cast(w.FindAnyWidget(w.GetName() + "_option_wrapper"));
- Widget option_label = w.FindAnyWidget("option_label");
-
- if (text1)
- {
- text1.SetColor(ARGB(255, 255, 0, 0));
- }
-
- if (text2)
- {
- text2.SetColor(ARGB(255, 255, 0, 0));
- }
-
- if (text3)
- {
- text3.SetColor(ARGB(255, 255, 0, 0));
- w.SetAlpha(1);
- }
-
- if (image)
- {
- image.SetColor(ARGB(255, 200, 0, 0));
- }
-
- if (option)
- {
- option.SetColor(ARGB(255, 255, 0, 0));
- }
-
- if (option_label)
- {
- option_label.SetColor(ARGB(255, 255, 0, 0));
- }
- }
-
- void ColorNormal(Widget w)
- {
- if ((w.GetFlags() & WidgetFlags.IGNOREPOINTER) == WidgetFlags.IGNOREPOINTER)
- {
- return;
- }
-
- if (w.IsInherited(ButtonWidget))
- {
- ButtonWidget button = ButtonWidget.Cast(w);
- button.SetTextColor(ARGB(255, 255, 255, 255));
- }
-
- TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
- TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
- TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
- ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
- Widget option = w.FindAnyWidget(w.GetName() + "_option_wrapper");
- Widget option_label = w.FindAnyWidget("option_label");
-
- if (text1)
- {
- text1.SetColor(ARGB(255, 255, 255, 255));
- }
-
- if (text2)
- {
- text2.SetColor(ARGB(255, 255, 255, 255));
- }
-
- if (text3)
- {
- text3.SetColor(ARGB(255, 255, 255, 255));
- w.SetAlpha(0);
- }
-
- if (image)
- {
- image.SetColor(ARGB(255, 255, 255, 255));
- }
-
- if (option)
- {
- option.SetColor(ARGB(150, 255, 255, 255));
- }
-
- if (option_label)
- {
- option_label.SetColor(ARGB(255, 255, 255, 255));
- }
- }
-
- void ColorDisable(Widget w)
- {
- #ifdef PLATFORM_WINDOWS
- SetFocus(null);
- #endif
-
- if (w)
- {
- ButtonWidget button = ButtonWidget.Cast(w);
- if (button)
- {
- button.SetTextColor(ColorManager.COLOR_DISABLED_TEXT);
- }
- }
- }
-
- protected void UpdateControlsElements()
- {
- #ifdef PLATFORM_CONSOLE
- RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
- string text = "";
- if (g_Game.GetUIManager().IsDialogVisible() || g_Game.GetUIManager().IsDialogQueued())
- {
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#dialog_confirm", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
-
- }
- else
- {
- if (m_CanToggle)
- {
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#dialog_change", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
- }
- if (m_CanApplyOrReset)
- {
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Apply_ApplyText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
- }
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "#menu_default", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
- if (m_CanApplyOrReset)
- {
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICredits", "#menu_undo", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
- }
- }
- text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Back_BackText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
- toolbar_text.SetText(text);
-
- RichTextWidget toolbar_b2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon0"));
- RichTextWidget toolbar_x2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ApplyIcon0"));
- RichTextWidget toolbar_y2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ResetIcon0"));
- RichTextWidget toolbar_def2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("DefaultIcon0"));
- toolbar_b2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER));
- toolbar_x2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "", EUAINPUT_DEVICE_CONTROLLER));
- toolbar_y2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICredits", "", EUAINPUT_DEVICE_CONTROLLER));
- toolbar_def2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "", EUAINPUT_DEVICE_CONTROLLER));
- #endif
- }
-
- protected void UpdateControlsElementVisibility()
- {
- bool toolbarShow = false;
- #ifdef PLATFORM_CONSOLE
- toolbarShow = !GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
- #endif
-
- layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
- layoutRoot.FindAnyWidget("play_panel_root").Show(!toolbarShow);
- }
- }
|