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:
Salman Ahmed 2022-06-18 01:46:37 +03:00
parent b977ce7995
commit 60903be566
4 changed files with 11 additions and 12 deletions

View File

@ -30,13 +30,13 @@ namespace osu.Game.Tournament.Tests.Components
private readonly TournamentPlayer redPlayer = new TournamentPlayer private readonly TournamentPlayer redPlayer = new TournamentPlayer
{ {
Username = "BanchoBot", Username = "BanchoBot",
Id = 3, OnlineID = 3,
}; };
private readonly TournamentPlayer bluePlayer = new TournamentPlayer private readonly TournamentPlayer bluePlayer = new TournamentPlayer
{ {
Username = "Zallius", Username = "Zallius",
Id = 4, OnlineID = 4,
}; };
[Cached] [Cached]

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using osu.Game.Database; using Newtonsoft.Json;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users; using osu.Game.Users;
@ -14,7 +14,8 @@ namespace osu.Game.Tournament.Models
[Serializable] [Serializable]
public class TournamentPlayer : IUser public class TournamentPlayer : IUser
{ {
public int Id { get; set; } [JsonProperty(@"id")]
public int OnlineID { get; set; }
public string Username { get; set; } = string.Empty; public string Username { get; set; } = string.Empty;
@ -37,7 +38,7 @@ namespace osu.Game.Tournament.Models
{ {
var user = new APIUser var user = new APIUser
{ {
Id = Id, Id = OnlineID,
Username = Username, Username = Username,
Country = Country, Country = Country,
CoverUrl = CoverUrl, CoverUrl = CoverUrl,
@ -52,8 +53,6 @@ namespace osu.Game.Tournament.Models
return user; return user;
} }
int IHasOnlineID<int>.OnlineID => Id;
bool IUser.IsBot => false; bool IUser.IsBot => false;
} }
} }

View File

@ -280,10 +280,10 @@ namespace osu.Game.Tournament.Screens.Editors
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
playerId.Value = player.Id; playerId.Value = player.OnlineID;
playerId.BindValueChanged(id => playerId.BindValueChanged(id =>
{ {
player.Id = id.NewValue ?? 0; player.OnlineID = id.NewValue ?? 0;
if (id.NewValue != id.OldValue) if (id.NewValue != id.OldValue)
player.Username = string.Empty; player.Username = string.Empty;

View File

@ -258,7 +258,7 @@ namespace osu.Game.Tournament
public void PopulatePlayer(TournamentPlayer player, Action success = null, Action failure = null, bool immediate = false) 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) if (immediate)
{ {
@ -270,7 +270,7 @@ namespace osu.Game.Tournament
req.Success += res => { populate(); }; req.Success += res => { populate(); };
req.Failure += _ => req.Failure += _ =>
{ {
player.Id = 1; player.OnlineID = 1;
failure?.Invoke(); failure?.Invoke();
}; };
@ -284,7 +284,7 @@ namespace osu.Game.Tournament
if (res == null) if (res == null)
return; return;
player.Id = res.Id; player.OnlineID = res.Id;
player.Username = res.Username; player.Username = res.Username;
player.CoverUrl = res.CoverUrl; player.CoverUrl = res.CoverUrl;