diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index 4d3e3b1943..98426e5b7d 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -98,6 +98,14 @@ public partial class StandAloneChatDisplay : CompositeDrawable private const float text_box_height = 30; + public readonly Bindable ChatPacingInterval = new BindableInt + { + MinValue = 100, + MaxValue = 2500, + Default = 1250, + Value = 1250 + }; + [Resolved(CanBeNull = true)] // not sure if it actually can be null private ChatTimerHandler? chatTimerHandler { get; set; } @@ -167,7 +175,7 @@ private void processMessageQueue() { (string text, var target) = messageQueue.Dequeue(); sendMessageAndLog(text, target); - Scheduler.AddDelayed(processMessageQueue, 1250); + Scheduler.AddDelayed(processMessageQueue, ChatPacingInterval.Value); return; } } @@ -179,7 +187,7 @@ private void processMessageQueue() (string text, Channel target) = botMessageQueue.Dequeue(); string message = $@"[FakeBanchoBot]: {text}"; sendMessageAndLog(message, target); - Scheduler.AddDelayed(processMessageQueue, 1250); + Scheduler.AddDelayed(processMessageQueue, ChatPacingInterval.Value); return; } } @@ -818,6 +826,16 @@ protected override bool OnKeyDown(KeyDownEvent e) return base.OnKeyDown(e); } + protected override bool CanAddCharacter(char character) + { + if (character != '\n') + return base.CanAddCharacter(character); + + // special-case newline char to send a message instead + Commit(); + return false; + } + protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index 280310a6d1..841fb3a25e 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -518,7 +518,9 @@ private void load() RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), // chat OverlineHeader - new Dimension(), // chat + new Dimension(), // chat, + new Dimension(GridSizeMode.AutoSize), // chat send delay slider + new Dimension(GridSizeMode.Absolute, row_padding), new Dimension(GridSizeMode.AutoSize), // beatmap queue OverlineHeader new Dimension(GridSizeMode.AutoSize), // add item button new Dimension(GridSizeMode.Absolute, row_padding), @@ -530,6 +532,11 @@ private void load() { new Drawable[] { new OverlinedHeader("Chat") }, new Drawable[] { chatDisplay = new MatchChatDisplay(room) { RelativeSizeAxes = Axes.Both } }, + new Drawable[] + { + new SettingsSlider { LabelText = @"Chat message send interval (setting too low can cause messages to be dropped!!!!)", Current = chatDisplay.ChatPacingInterval, } + }, + null, new Drawable[] { new OverlinedHeader("Beatmap queue") }, new Drawable[] { new AddItemButton { RelativeSizeAxes = Axes.X, Height = 40, Text = "Add item", Action = () => ShowSongSelect() }, }, null,