From 4c47996130de73ed0d4f87be47c4e65c064111ed Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 18 Jun 2022 02:33:26 +0300 Subject: [PATCH] `TournamentPlayer` -> `TournamentUser` --- .../TestSceneDrawableTournamentTeam.cs | 14 ++++++------ .../TestSceneTournamentMatchChatDisplay.cs | 14 ++++++------ .../TournamentTestScene.cs | 20 ++++++++--------- .../Components/DrawableTeamWithPlayers.cs | 2 +- osu.Game.Tournament/Models/TournamentTeam.cs | 2 +- ...{TournamentPlayer.cs => TournamentUser.cs} | 6 ++--- .../Screens/Editors/TeamEditorScreen.cs | 22 +++++++++---------- osu.Game.Tournament/TournamentGameBase.cs | 16 +++++++------- 8 files changed, 48 insertions(+), 48 deletions(-) rename osu.Game.Tournament/Models/{TournamentPlayer.cs => TournamentUser.cs} (89%) diff --git a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs index 3cf65b1990..4ea7e8008a 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs @@ -25,13 +25,13 @@ namespace osu.Game.Tournament.Tests.Components FullName = { Value = "Australia" }, Players = { - new TournamentPlayer { Username = "ASecretBox" }, - new TournamentPlayer { Username = "Dereban" }, - new TournamentPlayer { Username = "mReKk" }, - new TournamentPlayer { Username = "uyghti" }, - new TournamentPlayer { Username = "Parkes" }, - new TournamentPlayer { Username = "Shiroha" }, - new TournamentPlayer { Username = "Jordan The Bear" }, + new TournamentUser { Username = "ASecretBox" }, + new TournamentUser { Username = "Dereban" }, + new TournamentUser { Username = "mReKk" }, + new TournamentUser { Username = "uyghti" }, + new TournamentUser { Username = "Parkes" }, + new TournamentUser { Username = "Shiroha" }, + new TournamentUser { Username = "Jordan The Bear" }, } }; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs index a95ae4b8ba..eb8b0dfbe6 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs @@ -27,13 +27,13 @@ namespace osu.Game.Tournament.Tests.Components Colour = "f2ca34" }; - private readonly TournamentPlayer redPlayer = new TournamentPlayer + private readonly TournamentUser redUser = new TournamentUser { Username = "BanchoBot", OnlineID = 3, }; - private readonly TournamentPlayer bluePlayer = new TournamentPlayer + private readonly TournamentUser blueUser = new TournamentUser { Username = "Zallius", OnlineID = 4, @@ -59,11 +59,11 @@ namespace osu.Game.Tournament.Tests.Components { Team1 = { - Value = new TournamentTeam { Players = new BindableList { redPlayer } } + Value = new TournamentTeam { Players = new BindableList { redUser } } }, Team2 = { - Value = new TournamentTeam { Players = new BindableList { bluePlayer } } + Value = new TournamentTeam { Players = new BindableList { blueUser } } } }; @@ -82,19 +82,19 @@ namespace osu.Game.Tournament.Tests.Components AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId()) { - Sender = redPlayer.ToUser(), + Sender = redUser.ToAPIUser(), Content = "I am team red." })); AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId()) { - Sender = redPlayer.ToUser(), + Sender = redUser.ToAPIUser(), Content = "I plan to win!" })); AddStep("message from team blue", () => testChannel.AddNewMessages(new Message(nextMessageId()) { - Sender = bluePlayer.ToUser(), + Sender = blueUser.ToAPIUser(), Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand." })); diff --git a/osu.Game.Tournament.Tests/TournamentTestScene.cs b/osu.Game.Tournament.Tests/TournamentTestScene.cs index 47ab3023e4..ea7d6e7827 100644 --- a/osu.Game.Tournament.Tests/TournamentTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentTestScene.cs @@ -121,11 +121,11 @@ namespace osu.Game.Tournament.Tests }, Players = { - new TournamentPlayer { Username = "Hello", Rank = 12 }, - new TournamentPlayer { Username = "Hello", Rank = 16 }, - new TournamentPlayer { Username = "Hello", Rank = 20 }, - new TournamentPlayer { Username = "Hello", Rank = 24 }, - new TournamentPlayer { Username = "Hello", Rank = 30 }, + new TournamentUser { Username = "Hello", Rank = 12 }, + new TournamentUser { Username = "Hello", Rank = 16 }, + new TournamentUser { Username = "Hello", Rank = 20 }, + new TournamentUser { Username = "Hello", Rank = 24 }, + new TournamentUser { Username = "Hello", Rank = 30 }, } } }, @@ -138,11 +138,11 @@ namespace osu.Game.Tournament.Tests FullName = { Value = "United States" }, Players = { - new TournamentPlayer { Username = "Hello" }, - new TournamentPlayer { Username = "Hello" }, - new TournamentPlayer { Username = "Hello" }, - new TournamentPlayer { Username = "Hello" }, - new TournamentPlayer { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, } } }, diff --git a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs index fd62c53741..0bb35d534c 100644 --- a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs +++ b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs @@ -55,7 +55,7 @@ namespace osu.Game.Tournament.Components }, }; - TournamentSpriteText createPlayerText(TournamentPlayer p) => + TournamentSpriteText createPlayerText(TournamentUser p) => new TournamentSpriteText { Text = p.Username, diff --git a/osu.Game.Tournament/Models/TournamentTeam.cs b/osu.Game.Tournament/Models/TournamentTeam.cs index 420b47da66..9dbe23b4b3 100644 --- a/osu.Game.Tournament/Models/TournamentTeam.cs +++ b/osu.Game.Tournament/Models/TournamentTeam.cs @@ -58,7 +58,7 @@ namespace osu.Game.Tournament.Models }; [JsonProperty] - public BindableList Players { get; set; } = new BindableList(); + public BindableList Players { get; set; } = new BindableList(); public TournamentTeam() { diff --git a/osu.Game.Tournament/Models/TournamentPlayer.cs b/osu.Game.Tournament/Models/TournamentUser.cs similarity index 89% rename from osu.Game.Tournament/Models/TournamentPlayer.cs rename to osu.Game.Tournament/Models/TournamentUser.cs index 976936ab07..80e58538e5 100644 --- a/osu.Game.Tournament/Models/TournamentPlayer.cs +++ b/osu.Game.Tournament/Models/TournamentUser.cs @@ -9,10 +9,10 @@ using osu.Game.Users; namespace osu.Game.Tournament.Models { /// - /// A tournament player, containing simple information about the player. + /// A tournament player user, containing simple information about the player. /// [Serializable] - public class TournamentPlayer : IUser + public class TournamentUser : IUser { [JsonProperty(@"id")] public int OnlineID { get; set; } @@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Models /// public string CoverUrl { get; set; } = string.Empty; - public APIUser ToUser() + public APIUser ToAPIUser() { var user = new APIUser { diff --git a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index f29c45c949..11db37c8b7 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -201,14 +201,14 @@ namespace osu.Game.Tournament.Screens.Editors public void CreateNew() { - var player = new TournamentPlayer(); + var player = new TournamentUser(); team.Players.Add(player); flow.Add(new PlayerRow(team, player)); } public class PlayerRow : CompositeDrawable { - private readonly TournamentPlayer player; + private readonly TournamentUser user; [Resolved] protected IAPIProvider API { get; private set; } @@ -220,9 +220,9 @@ namespace osu.Game.Tournament.Screens.Editors private readonly Container drawableContainer; - public PlayerRow(TournamentTeam team, TournamentPlayer player) + public PlayerRow(TournamentTeam team, TournamentUser user) { - this.player = player; + this.user = user; Margin = new MarginPadding(10); @@ -271,7 +271,7 @@ namespace osu.Game.Tournament.Screens.Editors Action = () => { Expire(); - team.Players.Remove(player); + team.Players.Remove(user); }, } }; @@ -280,27 +280,27 @@ namespace osu.Game.Tournament.Screens.Editors [BackgroundDependencyLoader] private void load() { - playerId.Value = player.OnlineID; + playerId.Value = user.OnlineID; playerId.BindValueChanged(id => { - player.OnlineID = id.NewValue ?? 0; + user.OnlineID = id.NewValue ?? 0; if (id.NewValue != id.OldValue) - player.Username = string.Empty; + user.Username = string.Empty; - if (!string.IsNullOrEmpty(player.Username)) + if (!string.IsNullOrEmpty(user.Username)) { updatePanel(); return; } - game.PopulatePlayer(player, updatePanel, updatePanel); + game.PopulatePlayer(user, updatePanel, updatePanel); }, true); } private void updatePanel() { - drawableContainer.Child = new UserGridPanel(player.ToUser()) { Width = 300 }; + drawableContainer.Child = new UserGridPanel(user.ToAPIUser()) { Width = 300 }; } } } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index f53e36a61e..a8d4abc5f4 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -256,9 +256,9 @@ namespace osu.Game.Tournament private void updateLoadProgressMessage(string s) => Schedule(() => initialisationText.Text = s); - public void PopulatePlayer(TournamentPlayer player, Action success = null, Action failure = null, bool immediate = false) + public void PopulatePlayer(TournamentUser user, Action success = null, Action failure = null, bool immediate = false) { - var req = new GetUserRequest(player.OnlineID, ladder.Ruleset.Value); + var req = new GetUserRequest(user.OnlineID, ladder.Ruleset.Value); if (immediate) { @@ -270,7 +270,7 @@ namespace osu.Game.Tournament req.Success += res => { populate(); }; req.Failure += _ => { - player.OnlineID = 1; + user.OnlineID = 1; failure?.Invoke(); }; @@ -284,12 +284,12 @@ namespace osu.Game.Tournament if (res == null) return; - player.OnlineID = res.Id; + user.OnlineID = res.Id; - player.Username = res.Username; - player.CoverUrl = res.CoverUrl; - player.Country = res.Country; - player.Rank = res.Statistics?.GlobalRank; + user.Username = res.Username; + user.CoverUrl = res.CoverUrl; + user.Country = res.Country; + user.Rank = res.Statistics?.GlobalRank; success?.Invoke(); }