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