Add an option to disable chat in replays

This commit is contained in:
Gustas
2022-06-16 16:37:14 +03:00
committed by teinarss
parent 8a98ad51fd
commit a03e794140
9 changed files with 51 additions and 15 deletions

View File

@@ -265,7 +265,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (!IsNotificationEligible(notification))
return;
chatOverlayDisplay?.AddNotification(notification);
if (!IsNotificationMuted(notification))
chatOverlayDisplay?.AddNotification(notification);
// HACK: Force disable the chat notification sound for the in-menu chat dialog
// This works around our inability to disable the sounds for the in-game dialog when it is hidden
@@ -282,7 +283,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (scrolledToBottom)
chatScrollPanel.ScrollToBottom(smooth: true);
if (!suppressSound)
if (!suppressSound && !IsNotificationMuted(notification))
Game.Sound.PlayNotification(modRules, null, "Sounds", chatLineSound, null);
}
@@ -325,5 +326,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
base.Dispose(disposing);
}
bool IsNotificationMuted(TextNotification notification)
{
return Game.Settings.Game.HideReplayChat && world.IsReplay && notification.ClientId != TextNotificationsManager.SystemClientId;
}
}
}

View File

@@ -55,6 +55,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
repetitions++;
lineToDisplay = new TextNotification(
notification.Pool,
notification.ClientId,
notification.Prefix,
$"{notification.Text} ({repetitions + 1})",
notification.PrefixColor,

View File

@@ -74,6 +74,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (panel.GetOrNull<CheckboxWidget>("PAUSE_SHELLMAP_CHECKBOX") != null)
SettingsUtils.BindCheckboxPref(panel, "PAUSE_SHELLMAP_CHECKBOX", gs, "PauseShellmap");
SettingsUtils.BindCheckboxPref(panel, "HIDE_REPLAY_CHAT_CHECKBOX", gs, "HideReplayChat");
var windowModeDropdown = panel.Get<DropDownButtonWidget>("MODE_DROPDOWN");
windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, ds, scrollPanel);
windowModeDropdown.GetText = () => ds.Mode == WindowMode.Windowed ?