mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
Store user country on databased scores
This commit is contained in:
parent
4968859e69
commit
4e7156cee8
@ -60,8 +60,9 @@ namespace osu.Game.Database
|
|||||||
/// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo.
|
/// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo.
|
||||||
/// 15 2022-07-13 Added LastPlayed to BeatmapInfo.
|
/// 15 2022-07-13 Added LastPlayed to BeatmapInfo.
|
||||||
/// 16 2022-07-15 Removed HasReplay from ScoreInfo.
|
/// 16 2022-07-15 Removed HasReplay from ScoreInfo.
|
||||||
|
/// 17 2022-07-16 Added Country to RealmUser.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int schema_version = 16;
|
private const int schema_version = 17;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -17,6 +15,16 @@ namespace osu.Game.Models
|
|||||||
|
|
||||||
public string Username { get; set; } = string.Empty;
|
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 IsBot => false;
|
||||||
|
|
||||||
public bool Equals(RealmUser other)
|
public bool Equals(RealmUser other)
|
||||||
|
@ -58,6 +58,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public class ModCreatedUser : IUser
|
public class ModCreatedUser : IUser
|
||||||
{
|
{
|
||||||
public int OnlineID => APIUser.SYSTEM_USER_ID;
|
public int OnlineID => APIUser.SYSTEM_USER_ID;
|
||||||
|
public Country Country => default;
|
||||||
public bool IsBot => true;
|
public bool IsBot => true;
|
||||||
|
|
||||||
public string Username { get; set; } = string.Empty;
|
public string Username { get; set; } = string.Empty;
|
||||||
|
@ -85,8 +85,9 @@ namespace osu.Game.Scoring
|
|||||||
{
|
{
|
||||||
get => user ??= new APIUser
|
get => user ??= new APIUser
|
||||||
{
|
{
|
||||||
Username = RealmUser.Username,
|
|
||||||
Id = RealmUser.OnlineID,
|
Id = RealmUser.OnlineID,
|
||||||
|
Username = RealmUser.Username,
|
||||||
|
Country = RealmUser.Country,
|
||||||
};
|
};
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@ -95,7 +96,8 @@ namespace osu.Game.Scoring
|
|||||||
RealmUser = new RealmUser
|
RealmUser = new RealmUser
|
||||||
{
|
{
|
||||||
OnlineID = user.OnlineID,
|
OnlineID = user.OnlineID,
|
||||||
Username = user.Username
|
Username = user.Username,
|
||||||
|
Country = user.Country,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,6 +137,7 @@ namespace osu.Game.Scoring
|
|||||||
{
|
{
|
||||||
OnlineID = RealmUser.OnlineID,
|
OnlineID = RealmUser.OnlineID,
|
||||||
Username = RealmUser.Username,
|
Username = RealmUser.Username,
|
||||||
|
Country = RealmUser.Country,
|
||||||
};
|
};
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
|
@ -10,6 +10,8 @@ namespace osu.Game.Users
|
|||||||
{
|
{
|
||||||
string Username { get; }
|
string Username { get; }
|
||||||
|
|
||||||
|
Country Country { get; }
|
||||||
|
|
||||||
bool IsBot { get; }
|
bool IsBot { get; }
|
||||||
|
|
||||||
bool IEquatable<IUser>.Equals(IUser? other)
|
bool IEquatable<IUser>.Equals(IUser? other)
|
||||||
|
Loading…
Reference in New Issue
Block a user