mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Merge branch 'master' into activity-on-multiplayer-screens
This commit is contained in:
@ -553,7 +553,7 @@ namespace osu.Game.Online.Chat
|
||||
if (channel.LastMessageId == channel.LastReadId)
|
||||
return;
|
||||
|
||||
var message = channel.Messages.LastOrDefault();
|
||||
var message = channel.Messages.FindLast(msg => !(msg is LocalMessage));
|
||||
|
||||
if (message == null)
|
||||
return;
|
||||
|
@ -43,7 +43,8 @@ namespace osu.Game.Online.Chat
|
||||
RegexOptions.IgnoreCase);
|
||||
|
||||
// 00:00:000 (1,2,3) - test
|
||||
private static readonly Regex time_regex = new Regex(@"\d\d:\d\d:\d\d\d? [^-]*");
|
||||
// regex from https://github.com/ppy/osu-web/blob/651a9bac2b60d031edd7e33b8073a469bf11edaa/resources/assets/coffee/_classes/beatmap-discussion-helper.coffee#L10
|
||||
private static readonly Regex time_regex = new Regex(@"\b(((\d{2,}):([0-5]\d)[:.](\d{3}))(\s\((?:\d+[,|])*\d+\))?)");
|
||||
|
||||
// #osu
|
||||
private static readonly Regex channel_regex = new Regex(@"(#[a-zA-Z]+[a-zA-Z0-9]+)");
|
||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Chat;
|
||||
@ -22,7 +23,7 @@ namespace osu.Game.Online.Chat
|
||||
{
|
||||
public readonly Bindable<Channel> Channel = new Bindable<Channel>();
|
||||
|
||||
private readonly FocusedTextBox textbox;
|
||||
protected readonly ChatTextBox Textbox;
|
||||
|
||||
protected ChannelManager ChannelManager;
|
||||
|
||||
@ -30,6 +31,8 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
private readonly bool postingTextbox;
|
||||
|
||||
protected readonly Box Background;
|
||||
|
||||
private const float textbox_height = 30;
|
||||
|
||||
/// <summary>
|
||||
@ -44,7 +47,7 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
Background = new Box
|
||||
{
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.8f,
|
||||
@ -54,7 +57,7 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
if (postingTextbox)
|
||||
{
|
||||
AddInternal(textbox = new FocusedTextBox
|
||||
AddInternal(Textbox = new ChatTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = textbox_height,
|
||||
@ -65,7 +68,7 @@ namespace osu.Game.Online.Chat
|
||||
Origin = Anchor.BottomLeft,
|
||||
});
|
||||
|
||||
textbox.OnCommit += postMessage;
|
||||
Textbox.OnCommit += postMessage;
|
||||
}
|
||||
|
||||
Channel.BindValueChanged(channelChanged);
|
||||
@ -82,7 +85,7 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
private void postMessage(TextBox sender, bool newtext)
|
||||
{
|
||||
var text = textbox.Text.Trim();
|
||||
var text = Textbox.Text.Trim();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
return;
|
||||
@ -92,7 +95,7 @@ namespace osu.Game.Online.Chat
|
||||
else
|
||||
ChannelManager?.PostMessage(text, target: Channel.Value);
|
||||
|
||||
textbox.Text = string.Empty;
|
||||
Textbox.Text = string.Empty;
|
||||
}
|
||||
|
||||
protected virtual ChatLine CreateMessage(Message message) => new StandAloneMessage(message);
|
||||
@ -110,6 +113,25 @@ namespace osu.Game.Online.Chat
|
||||
AddInternal(drawableChannel);
|
||||
}
|
||||
|
||||
public class ChatTextBox : FocusedTextBox
|
||||
{
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
BackgroundUnfocused = new Color4(10, 10, 10, 10);
|
||||
BackgroundFocused = new Color4(10, 10, 10, 255);
|
||||
}
|
||||
|
||||
protected override void OnFocusLost(FocusLostEvent e)
|
||||
{
|
||||
base.OnFocusLost(e);
|
||||
FocusLost?.Invoke();
|
||||
}
|
||||
|
||||
public Action FocusLost;
|
||||
}
|
||||
|
||||
public class StandAloneDrawableChannel : DrawableChannel
|
||||
{
|
||||
public Func<Message, ChatLine> CreateChatLineAction;
|
||||
|
Reference in New Issue
Block a user