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

Store user country on databased scores

This commit is contained in:
Salman Ahmed 2022-07-16 06:30:25 +03:00
parent 4968859e69
commit 4e7156cee8
5 changed files with 20 additions and 5 deletions

View File

@ -60,8 +60,9 @@ namespace osu.Game.Database
/// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo.
/// 15 2022-07-13 Added LastPlayed to BeatmapInfo.
/// 16 2022-07-15 Removed HasReplay from ScoreInfo.
/// 17 2022-07-16 Added Country to RealmUser.
/// </summary>
private const int schema_version = 16;
private const int schema_version = 17;
/// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Game.Database;
using osu.Game.Users;
@ -17,6 +15,16 @@ namespace osu.Game.Models
public string Username { get; set; } = string.Empty;
[Ignored]
public Country Country
{
get => Enum.TryParse(CountryString, out Country country) ? country : default;
set => CountryString = value.ToString();
}
[MapTo(nameof(Country))]
public string CountryString { get; set; } = default(Country).ToString();
public bool IsBot => false;
public bool Equals(RealmUser other)

View File

@ -58,6 +58,7 @@ namespace osu.Game.Rulesets.Mods
public class ModCreatedUser : IUser
{
public int OnlineID => APIUser.SYSTEM_USER_ID;
public Country Country => default;
public bool IsBot => true;
public string Username { get; set; } = string.Empty;

View File

@ -85,8 +85,9 @@ namespace osu.Game.Scoring
{
get => user ??= new APIUser
{
Username = RealmUser.Username,
Id = RealmUser.OnlineID,
Username = RealmUser.Username,
Country = RealmUser.Country,
};
set
{
@ -95,7 +96,8 @@ namespace osu.Game.Scoring
RealmUser = new RealmUser
{
OnlineID = user.OnlineID,
Username = user.Username
Username = user.Username,
Country = user.Country,
};
}
}
@ -135,6 +137,7 @@ namespace osu.Game.Scoring
{
OnlineID = RealmUser.OnlineID,
Username = RealmUser.Username,
Country = RealmUser.Country,
};
return clone;

View File

@ -10,6 +10,8 @@ namespace osu.Game.Users
{
string Username { get; }
Country Country { get; }
bool IsBot { get; }
bool IEquatable<IUser>.Equals(IUser? other)