Download scripts/5_Mission/DayZ/GUI/NewUI/Options/OptionsMenu.c from FelonieZ/DayZ_Scripts: direct link, hf CLI and curl.
- Browser
- Download file 19.2 kB
-
https://huggingface.co/datasets/FelonieZ/DayZ_Scripts/resolve/main/scripts/5_Mission/DayZ/GUI/NewUI/Options/OptionsMenu.c
- Command line
-
hf download hf://datasets/FelonieZ/DayZ_Scripts/scripts/5_Mission/DayZ/GUI/NewUI/Options/OptionsMenu.c
-
curl -L -o OptionsMenu.c https://huggingface.co/datasets/FelonieZ/DayZ_Scripts/resolve/main/scripts/5_Mission/DayZ/GUI/NewUI/Options/OptionsMenu.c
19.2 kB
| 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(); | |
| layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/xbox/options_menu.layout", null); | |
| layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/ps/options_menu.layout", null); | |
| layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/options/pc/options_menu.layout", null); | |
| 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); | |
| m_ControlsTab = new OptionsMenuControls(layoutRoot.FindAnyWidget("Tab_2"), m_Details, m_Options, this); | |
| 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); | |
| 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); | |
| version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")"; | |
| version = "#main_menu_version" + " " + version; | |
| m_Version.SetText(version); | |
| SetFocus(layoutRoot); | |
| ToggleFocus(); | |
| 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() | |
| { | |
| UpdateControlsElementVisibility(); | |
| } | |
| protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType) | |
| { | |
| UpdateControlsElementVisibility(); | |
| } | |
| 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: | |
| { | |
| m_ControlsTab.Focus(); | |
| m_VideoTab.Focus(); | |
| break; | |
| } | |
| case 3: | |
| { | |
| m_ControlsTab.Focus(); | |
| break; | |
| } | |
| } | |
| m_ActiveTabIdx = tab; | |
| } | |
| void Apply() | |
| { | |
| m_ControlsTab.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; | |
| UpdateControlsElements(); | |
| UpdateControlsElementVisibility(); | |
| IngameHud hud; | |
| if (GetGame().GetMission() && Class.CastTo(hud,GetGame().GetMission().GetHud())) | |
| { | |
| hud.ShowQuickBar(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer()); | |
| } | |
| 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); | |
| UpdateControlsElements(); | |
| } | |
| 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); | |
| UpdateControlsElements(); | |
| } | |
| } | |
| else | |
| { | |
| ResetCurrentTab(); | |
| } | |
| m_Tabber.SetCanSwitch(!changed); | |
| } | |
| bool IsAnyTabChanged() | |
| { | |
| bool changed = (m_Options.IsChanged() || m_GameTab.IsChanged() || m_SoundsTab.IsChanged() || m_ControlsTab.IsChanged()); | |
| changed |= m_VideoTab.IsChanged(); | |
| 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; | |
| UpdateControlsElements(); | |
| UpdateControlsElementVisibility(); | |
| m_Tabber.AlignTabbers(); | |
| } | |
| //resets it all | |
| void Reset() | |
| { | |
| m_Options.Revert(); | |
| m_GameTab.Revert(); | |
| m_SoundsTab.Revert(); | |
| m_ControlsTab.Revert(); | |
| m_VideoTab.Revert(); | |
| 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; | |
| UpdateControlsElements(); | |
| UpdateControlsElementVisibility(); | |
| } | |
| 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: | |
| { | |
| m_ControlsTab.Revert(); | |
| m_VideoTab.Revert(); | |
| break; | |
| } | |
| case 3: | |
| { | |
| m_ControlsTab.Revert(); | |
| 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; | |
| UpdateControlsElements(); | |
| UpdateControlsElementVisibility(); | |
| 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: | |
| m_ControlsTab.SetToDefaults(); | |
| m_VideoTab.SetToDefaults(); | |
| break; | |
| case 3: | |
| m_ControlsTab.SetToDefaults(); | |
| break; | |
| } | |
| if (GetGame().GetInput().IsEnabledMouseAndKeyboard()) | |
| { | |
| m_Reset.ClearFlags(WidgetFlags.IGNOREPOINTER); | |
| ColorNormal(m_Reset); | |
| m_Apply.ClearFlags(WidgetFlags.IGNOREPOINTER); | |
| ColorNormal(m_Apply); | |
| } | |
| m_CanApplyOrReset = true; | |
| UpdateControlsElements(); | |
| UpdateControlsElementVisibility(); | |
| } | |
| void SliderFocus() | |
| { | |
| m_CanToggle = false; | |
| UpdateControlsElements(); | |
| } | |
| void ToggleFocus() | |
| { | |
| m_CanToggle = true; | |
| UpdateControlsElements(); | |
| } | |
| //! 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); | |
| m_VideoTab.ToggleDependentOptions(mode,state); | |
| } | |
| 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); | |
| if (m_VideoTab) | |
| m_VideoTab.SetOptions(m_Options); | |
| } | |
| void ReloadVideoOptions() | |
| { | |
| if (m_VideoTab) | |
| m_VideoTab.SetOptions(m_Options); | |
| } | |
| 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); | |
| version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")"; | |
| version = "#main_menu_version" + " " + version; | |
| m_Version.SetText(version); | |
| UpdateControlsElements(); | |
| UpdateControlsElementVisibility(); | |
| } | |
| override void OnShow() | |
| { | |
| super.OnShow(); | |
| m_GameTab.Focus(); | |
| Refresh(); | |
| } | |
| override void Update(float timeslice) | |
| { | |
| super.Update(timeslice); | |
| if (m_ModalLock) | |
| { | |
| m_ModalLock = false; | |
| UpdateControlsElements(); | |
| 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) | |
| { | |
| SetFocus(null); | |
| if (w) | |
| { | |
| ButtonWidget button = ButtonWidget.Cast(w); | |
| if (button) | |
| { | |
| button.SetTextColor(ColorManager.COLOR_DISABLED_TEXT); | |
| } | |
| } | |
| } | |
| protected void UpdateControlsElements() | |
| { | |
| 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)); | |
| } | |
| protected void UpdateControlsElementVisibility() | |
| { | |
| bool toolbarShow = false; | |
| toolbarShow = !GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER; | |
| layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow); | |
| layoutRoot.FindAnyWidget("play_panel_root").Show(!toolbarShow); | |
| } | |
| } | |