Allow the player to toggle the display of UI Feedback chat pool

This commit is contained in:
Ivaylo Draganov
2020-02-29 22:37:27 +02:00
committed by Paul Chote
parent 6af354ff99
commit 2ea6bfba7b
5 changed files with 42 additions and 3 deletions

View File

@@ -36,7 +36,8 @@ namespace OpenRA
[Flags] [Flags]
public enum TextNotificationPoolFilters public enum TextNotificationPoolFilters
{ {
None = 0 None = 0,
Feedback = 1
} }
public enum WorldViewport { Native, Close, Medium, Far } 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.")] [Desc("Allow mods to enable the Discord service that can interact with a local Discord client.")]
public bool EnableDiscordService = true; public bool EnableDiscordService = true;
public TextNotificationPoolFilters TextNotificationPoolFilters = TextNotificationPoolFilters.None; public TextNotificationPoolFilters TextNotificationPoolFilters = TextNotificationPoolFilters.Feedback;
} }
public class Settings public class Settings

View File

@@ -61,10 +61,12 @@ namespace OpenRA
static bool IsPoolEnabled(TextNotificationPool pool) static bool IsPoolEnabled(TextNotificationPool pool)
{ {
var filters = Game.Settings.Game.TextNotificationPoolFilters;
return pool == TextNotificationPool.Chat || return pool == TextNotificationPool.Chat ||
pool == TextNotificationPool.System || pool == TextNotificationPool.System ||
pool == TextNotificationPool.Mission || pool == TextNotificationPool.Mission ||
pool == TextNotificationPool.Feedback; (pool == TextNotificationPool.Feedback && filters.HasFlag(TextNotificationPoolFilters.Feedback));
} }
} }
} }

View File

@@ -106,6 +106,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
battlefieldCameraDropDown.OnMouseDown = _ => ShowBattlefieldCameraDropdown(battlefieldCameraDropDown, viewportSizes, ds); battlefieldCameraDropDown.OnMouseDown = _ => ShowBattlefieldCameraDropdown(battlefieldCameraDropDown, viewportSizes, ds);
battlefieldCameraDropDown.GetText = () => battlefieldCameraLabel.Update(ds.ViewportDistance); battlefieldCameraDropDown.GetText = () => battlefieldCameraLabel.Update(ds.ViewportDistance);
BindTextNotificationPoolFilterSettings(panel, gs);
// Update vsync immediately // Update vsync immediately
var vsyncCheckbox = panel.Get<CheckboxWidget>("VSYNC_CHECKBOX"); var vsyncCheckbox = panel.Get<CheckboxWidget>("VSYNC_CHECKBOX");
var vsyncOnClick = vsyncCheckbox.OnClick; var vsyncOnClick = vsyncCheckbox.OnClick;
@@ -211,8 +213,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{ {
var ds = Game.Settings.Graphics; var ds = Game.Settings.Graphics;
var ps = Game.Settings.Player; var ps = Game.Settings.Player;
var gs = Game.Settings.Game;
var dds = new GraphicSettings(); var dds = new GraphicSettings();
var dps = new PlayerSettings(); var dps = new PlayerSettings();
var dgs = new GameSettings();
return () => return () =>
{ {
ds.CapFramerate = dds.CapFramerate; ds.CapFramerate = dds.CapFramerate;
@@ -235,6 +239,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ps.Color = dps.Color; ps.Color = dps.Color;
ps.Name = dps.Name; 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); dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
} }
public static void BindTextNotificationPoolFilterSettings(Widget panel, GameSettings gs)
{
Action<TextNotificationPoolFilters> toggleFilterFlag = f =>
{
gs.TextNotificationPoolFilters ^= f;
Game.Settings.Save();
};
var feedbackCheckbox = panel.GetOrNull<CheckboxWidget>("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) static void ShowStatusBarsDropdown(DropDownButtonWidget dropdown, GameSettings s)
{ {
var options = new Dictionary<string, StatusBarsType>() var options = new Dictionary<string, StatusBarsType>()

View File

@@ -109,6 +109,13 @@ Container@DISPLAY_PANEL:
Height: 20 Height: 20
Font: Regular Font: Regular
Text: Player Stance Colors 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: Label@VIDEO_TITLE:
Y: 190 Y: 190
Width: PARENT_RIGHT Width: PARENT_RIGHT

View File

@@ -110,6 +110,13 @@ Container@DISPLAY_PANEL:
Height: 20 Height: 20
Font: Regular Font: Regular
Text: Pause Menu Background 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: Label@VIDEO_TITLE:
Y: 190 Y: 190
Width: PARENT_RIGHT Width: PARENT_RIGHT