1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 19:43:22 +08:00

Add helper IsHost property to Client

This commit is contained in:
Bartłomiej Dach 2020-12-30 16:29:19 +01:00
parent 59f2017a13
commit dd87478690

View File

@ -70,6 +70,18 @@ namespace osu.Game.Online.Multiplayer
/// </summary>
public MultiplayerRoomUser? LocalUser => Room?.Users.SingleOrDefault(u => u.User?.Id == api.LocalUser.Value.Id);
/// <summary>
/// Whether the <see cref="LocalUser"/> is the host in <see cref="Room"/>.
/// </summary>
public bool IsHost
{
get
{
var localUser = LocalUser;
return localUser != null && Room?.Host != null && localUser.Equals(Room.Host);
}
}
[Resolved]
private UserLookupCache userLookupCache { get; set; } = null!;