Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions osu.Game/Online/Chat/StandAloneChatDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ public partial class StandAloneChatDisplay : CompositeDrawable

private const float text_box_height = 30;

public readonly Bindable<int> 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; }

Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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<int> { 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,
Expand Down