mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 18:27:26 +08:00
Merge branch 'master' into fix-endless-tests
This commit is contained in:
commit
167213d3eb
@ -81,6 +81,9 @@ namespace osu.Game.Online.Chat
|
|||||||
if (user == null)
|
if (user == null)
|
||||||
throw new ArgumentNullException(nameof(user));
|
throw new ArgumentNullException(nameof(user));
|
||||||
|
|
||||||
|
if (user.Id == api.LocalUser.Value.Id)
|
||||||
|
return;
|
||||||
|
|
||||||
CurrentChannel.Value = JoinedChannels.FirstOrDefault(c => c.Type == ChannelType.PM && c.Users.Count == 1 && c.Users.Any(u => u.Id == user.Id))
|
CurrentChannel.Value = JoinedChannels.FirstOrDefault(c => c.Type == ChannelType.PM && c.Users.Count == 1 && c.Users.Any(u => u.Id == user.Id))
|
||||||
?? new Channel(user);
|
?? new Channel(user);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -14,6 +15,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -201,6 +203,9 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
private Action startChatAction;
|
private Action startChatAction;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
public MessageSender(User sender)
|
public MessageSender(User sender)
|
||||||
{
|
{
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
@ -213,11 +218,21 @@ namespace osu.Game.Overlays.Chat
|
|||||||
startChatAction = () => chatManager?.OpenPrivateChannel(sender);
|
startChatAction = () => chatManager?.OpenPrivateChannel(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuItem[] ContextMenuItems => new MenuItem[]
|
public MenuItem[] ContextMenuItems
|
||||||
{
|
{
|
||||||
new OsuMenuItem("View Profile", MenuItemType.Highlighted, Action),
|
get
|
||||||
new OsuMenuItem("Start Chat", MenuItemType.Standard, startChatAction),
|
{
|
||||||
};
|
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 =
|
private static readonly Color4[] username_colours =
|
||||||
|
Loading…
Reference in New Issue
Block a user