mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Add lightweight TournamentPlayer
model
This commit is contained in:
parent
4bc26dbb48
commit
f3793c8809
59
osu.Game.Tournament/Models/TournamentPlayer.cs
Normal file
59
osu.Game.Tournament/Models/TournamentPlayer.cs
Normal file
@ -0,0 +1,59 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Tournament.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A tournament player, containing simple information about the player.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TournamentPlayer : IUser
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Username { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The player's country.
|
||||
/// </summary>
|
||||
public Country? Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The player's global rank, or null if not available.
|
||||
/// </summary>
|
||||
public int? Rank { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A URL to the player's profile cover.
|
||||
/// </summary>
|
||||
public string CoverUrl { get; set; } = string.Empty;
|
||||
|
||||
public APIUser ToUser()
|
||||
{
|
||||
var user = new APIUser
|
||||
{
|
||||
Id = Id,
|
||||
Username = Username,
|
||||
Country = Country,
|
||||
CoverUrl = CoverUrl,
|
||||
};
|
||||
|
||||
user.Statistics = new UserStatistics
|
||||
{
|
||||
User = user,
|
||||
GlobalRank = Rank
|
||||
};
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
int IHasOnlineID<int>.OnlineID => Id;
|
||||
|
||||
bool IUser.IsBot => false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user