mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Add ability to easily mention users in chat by right clicking username
This commit is contained in:
parent
9415de5cf3
commit
97bd76efc6
@ -19,6 +19,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString HeaderDescription => new TranslatableString(getKey(@"header_description"), @"join the real-time discussion");
|
||||
|
||||
/// <summary>
|
||||
/// "Mention"
|
||||
/// </summary>
|
||||
public static LocalisableString MentionUser => new TranslatableString(getKey(@"mention_user"), @"Mention");
|
||||
|
||||
private static string getKey(string key) => $"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ namespace osu.Game.Online.Chat
|
||||
/// </summary>
|
||||
public partial class StandAloneChatDisplay : CompositeDrawable
|
||||
{
|
||||
[Cached]
|
||||
public readonly Bindable<Channel> Channel = new Bindable<Channel>();
|
||||
|
||||
protected readonly ChatTextBox TextBox;
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -24,6 +25,7 @@ using osu.Game.Online.Chat;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using ChatStrings = osu.Game.Localisation.ChatStrings;
|
||||
|
||||
namespace osu.Game.Overlays.Chat
|
||||
{
|
||||
@ -65,6 +67,9 @@ namespace osu.Game.Overlays.Chat
|
||||
[Resolved(canBeNull: true)]
|
||||
private UserProfileOverlay? profileOverlay { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private Bindable<Channel>? currentChannel { get; set; }
|
||||
|
||||
private readonly APIUser user;
|
||||
private readonly OsuSpriteText drawableText;
|
||||
|
||||
@ -156,6 +161,14 @@ namespace osu.Game.Overlays.Chat
|
||||
if (!user.Equals(api.LocalUser.Value))
|
||||
items.Add(new OsuMenuItem(UsersStrings.CardSendMessage, MenuItemType.Standard, openUserChannel));
|
||||
|
||||
if (currentChannel != null)
|
||||
{
|
||||
items.Add(new OsuMenuItem(ChatStrings.MentionUser, MenuItemType.Standard, () =>
|
||||
{
|
||||
currentChannel.Value.TextBoxMessage.Value += $"@{user.Username}";
|
||||
}));
|
||||
}
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user