diff --git a/OpenRA.Game/Settings.cs b/OpenRA.Game/Settings.cs index d183863b4a..5d8dc48167 100644 --- a/OpenRA.Game/Settings.cs +++ b/OpenRA.Game/Settings.cs @@ -36,7 +36,8 @@ namespace OpenRA [Flags] public enum TextNotificationPoolFilters { - None = 0 + None = 0, + Feedback = 1 } public enum WorldViewport { Native, Close, Medium, Far } @@ -272,7 +273,7 @@ namespace OpenRA [Desc("Allow mods to enable the Discord service that can interact with a local Discord client.")] public bool EnableDiscordService = true; - public TextNotificationPoolFilters TextNotificationPoolFilters = TextNotificationPoolFilters.None; + public TextNotificationPoolFilters TextNotificationPoolFilters = TextNotificationPoolFilters.Feedback; } public class Settings diff --git a/OpenRA.Game/TextNotificationsManager.cs b/OpenRA.Game/TextNotificationsManager.cs index 220d7d453e..b25f7ed15e 100644 --- a/OpenRA.Game/TextNotificationsManager.cs +++ b/OpenRA.Game/TextNotificationsManager.cs @@ -61,10 +61,12 @@ namespace OpenRA static bool IsPoolEnabled(TextNotificationPool pool) { + var filters = Game.Settings.Game.TextNotificationPoolFilters; + return pool == TextNotificationPool.Chat || pool == TextNotificationPool.System || pool == TextNotificationPool.Mission || - pool == TextNotificationPool.Feedback; + (pool == TextNotificationPool.Feedback && filters.HasFlag(TextNotificationPoolFilters.Feedback)); } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs index 390fc03bc9..2d3f2ec5ff 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs @@ -106,6 +106,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic battlefieldCameraDropDown.OnMouseDown = _ => ShowBattlefieldCameraDropdown(battlefieldCameraDropDown, viewportSizes, ds); battlefieldCameraDropDown.GetText = () => battlefieldCameraLabel.Update(ds.ViewportDistance); + BindTextNotificationPoolFilterSettings(panel, gs); + // Update vsync immediately var vsyncCheckbox = panel.Get("VSYNC_CHECKBOX"); var vsyncOnClick = vsyncCheckbox.OnClick; @@ -211,8 +213,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var ds = Game.Settings.Graphics; var ps = Game.Settings.Player; + var gs = Game.Settings.Game; var dds = new GraphicSettings(); var dps = new PlayerSettings(); + var dgs = new GameSettings(); return () => { ds.CapFramerate = dds.CapFramerate; @@ -235,6 +239,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic ps.Color = dps.Color; ps.Name = dps.Name; + + gs.TextNotificationPoolFilters = dgs.TextNotificationPoolFilters; }; } @@ -260,6 +266,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem); } + public static void BindTextNotificationPoolFilterSettings(Widget panel, GameSettings gs) + { + Action toggleFilterFlag = f => + { + gs.TextNotificationPoolFilters ^= f; + Game.Settings.Save(); + }; + + var feedbackCheckbox = panel.GetOrNull("UI_FEEDBACK_CHECKBOX"); + if (feedbackCheckbox != null) + { + feedbackCheckbox.IsChecked = () => gs.TextNotificationPoolFilters.HasFlag(TextNotificationPoolFilters.Feedback); + feedbackCheckbox.OnClick = () => toggleFilterFlag(TextNotificationPoolFilters.Feedback); + } + } + static void ShowStatusBarsDropdown(DropDownButtonWidget dropdown, GameSettings s) { var options = new Dictionary() diff --git a/mods/cnc/chrome/settings-display.yaml b/mods/cnc/chrome/settings-display.yaml index 125d8ab7b7..1d39d97c1c 100644 --- a/mods/cnc/chrome/settings-display.yaml +++ b/mods/cnc/chrome/settings-display.yaml @@ -109,6 +109,13 @@ Container@DISPLAY_PANEL: Height: 20 Font: Regular Text: Player Stance Colors + Checkbox@UI_FEEDBACK_CHECKBOX: + X: 15 + Y: 163 + Width: 200 + Height: 20 + Font: Regular + Text: UI Feedback in Chat Label@VIDEO_TITLE: Y: 190 Width: PARENT_RIGHT diff --git a/mods/common/chrome/settings-display.yaml b/mods/common/chrome/settings-display.yaml index bb16fadab8..400ca7138f 100644 --- a/mods/common/chrome/settings-display.yaml +++ b/mods/common/chrome/settings-display.yaml @@ -110,6 +110,13 @@ Container@DISPLAY_PANEL: Height: 20 Font: Regular Text: Pause Menu Background + Checkbox@UI_FEEDBACK_CHECKBOX: + X: 15 + Y: 163 + Width: 200 + Height: 20 + Font: Regular + Text: UI Feedback in Chat Label@VIDEO_TITLE: Y: 190 Width: PARENT_RIGHT