1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 05:57:52 +08:00
osu-lazer/osu.Game.Tournament/Models/TournamentUser.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.5 KiB
C#
Raw Normal View History

// 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 Newtonsoft.Json;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users;
namespace osu.Game.Tournament.Models
{
/// <summary>
2022-06-18 07:33:26 +08:00
/// A tournament player user, containing simple information about the player.
/// </summary>
[Serializable]
2022-06-18 07:33:26 +08:00
public class TournamentUser : IUser
{
[JsonProperty(@"id")]
public int OnlineID { get; set; }
public string Username { get; set; } = string.Empty;
/// <summary>
/// The player's country.
/// </summary>
[JsonProperty("country_code")]
2022-07-18 13:40:34 +08:00
public CountryCode CountryCode { 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;
2022-06-18 07:33:26 +08:00
public APIUser ToAPIUser()
{
var user = new APIUser
{
Id = OnlineID,
Username = Username,
2022-07-18 13:40:34 +08:00
CountryCode = CountryCode,
CoverUrl = CoverUrl,
};
user.Statistics = new UserStatistics
{
User = user,
GlobalRank = Rank
};
return user;
}
bool IUser.IsBot => false;
}
}