mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:28:00 +08:00
Standardise naming for online ID
Rather than continuing with `ID` or `Id`, this should follow the new standards and use `OnlineID` instead. Only updating this since it's a newly introduced class.
This commit is contained in:
parent
b977ce7995
commit
60903be566
@ -30,13 +30,13 @@ namespace osu.Game.Tournament.Tests.Components
|
||||
private readonly TournamentPlayer redPlayer = new TournamentPlayer
|
||||
{
|
||||
Username = "BanchoBot",
|
||||
Id = 3,
|
||||
OnlineID = 3,
|
||||
};
|
||||
|
||||
private readonly TournamentPlayer bluePlayer = new TournamentPlayer
|
||||
{
|
||||
Username = "Zallius",
|
||||
Id = 4,
|
||||
OnlineID = 4,
|
||||
};
|
||||
|
||||
[Cached]
|
||||
|
@ -2,7 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Database;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
|
||||
@ -14,7 +14,8 @@ namespace osu.Game.Tournament.Models
|
||||
[Serializable]
|
||||
public class TournamentPlayer : IUser
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[JsonProperty(@"id")]
|
||||
public int OnlineID { get; set; }
|
||||
|
||||
public string Username { get; set; } = string.Empty;
|
||||
|
||||
@ -37,7 +38,7 @@ namespace osu.Game.Tournament.Models
|
||||
{
|
||||
var user = new APIUser
|
||||
{
|
||||
Id = Id,
|
||||
Id = OnlineID,
|
||||
Username = Username,
|
||||
Country = Country,
|
||||
CoverUrl = CoverUrl,
|
||||
@ -52,8 +53,6 @@ namespace osu.Game.Tournament.Models
|
||||
return user;
|
||||
}
|
||||
|
||||
int IHasOnlineID<int>.OnlineID => Id;
|
||||
|
||||
bool IUser.IsBot => false;
|
||||
}
|
||||
}
|
||||
|
@ -280,10 +280,10 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
playerId.Value = player.Id;
|
||||
playerId.Value = player.OnlineID;
|
||||
playerId.BindValueChanged(id =>
|
||||
{
|
||||
player.Id = id.NewValue ?? 0;
|
||||
player.OnlineID = id.NewValue ?? 0;
|
||||
|
||||
if (id.NewValue != id.OldValue)
|
||||
player.Username = string.Empty;
|
||||
|
@ -258,7 +258,7 @@ namespace osu.Game.Tournament
|
||||
|
||||
public void PopulatePlayer(TournamentPlayer player, Action success = null, Action failure = null, bool immediate = false)
|
||||
{
|
||||
var req = new GetUserRequest(player.Id, ladder.Ruleset.Value);
|
||||
var req = new GetUserRequest(player.OnlineID, ladder.Ruleset.Value);
|
||||
|
||||
if (immediate)
|
||||
{
|
||||
@ -270,7 +270,7 @@ namespace osu.Game.Tournament
|
||||
req.Success += res => { populate(); };
|
||||
req.Failure += _ =>
|
||||
{
|
||||
player.Id = 1;
|
||||
player.OnlineID = 1;
|
||||
failure?.Invoke();
|
||||
};
|
||||
|
||||
@ -284,7 +284,7 @@ namespace osu.Game.Tournament
|
||||
if (res == null)
|
||||
return;
|
||||
|
||||
player.Id = res.Id;
|
||||
player.OnlineID = res.Id;
|
||||
|
||||
player.Username = res.Username;
|
||||
player.CoverUrl = res.CoverUrl;
|
||||
|
Loading…
Reference in New Issue
Block a user