mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:07:38 +08:00
don't create "Start Chat" option when the sender is the local user
This commit is contained in:
parent
4e6d7137aa
commit
516575a132
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -14,6 +15,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
@ -201,6 +203,9 @@ namespace osu.Game.Overlays.Chat
|
||||
|
||||
private Action startChatAction;
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
public MessageSender(User sender)
|
||||
{
|
||||
this.sender = sender;
|
||||
@ -213,11 +218,21 @@ namespace osu.Game.Overlays.Chat
|
||||
startChatAction = () => chatManager?.OpenPrivateChannel(sender);
|
||||
}
|
||||
|
||||
public MenuItem[] ContextMenuItems => new MenuItem[]
|
||||
public MenuItem[] ContextMenuItems
|
||||
{
|
||||
new OsuMenuItem("View Profile", MenuItemType.Highlighted, Action),
|
||||
new OsuMenuItem("Start Chat", MenuItemType.Standard, startChatAction),
|
||||
};
|
||||
get
|
||||
{
|
||||
List<MenuItem> items = new List<MenuItem>
|
||||
{
|
||||
new OsuMenuItem("View Profile", MenuItemType.Highlighted, Action)
|
||||
};
|
||||
|
||||
if (sender.Id != api.LocalUser.Value.Id)
|
||||
items.Add(new OsuMenuItem("Start Chat", MenuItemType.Standard, startChatAction));
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Color4[] username_colours =
|
||||
|
Loading…
Reference in New Issue
Block a user