1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 19:32:55 +08:00

Update usages of APIUser to RealmUser

This commit is contained in:
Dean Herbert 2021-11-22 15:52:55 +09:00
parent 213d89b479
commit fda529de26
6 changed files with 25 additions and 15 deletions

View File

@ -3,7 +3,7 @@
using NUnit.Framework; using NUnit.Framework;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Models;
namespace osu.Game.Tests.Beatmaps namespace osu.Game.Tests.Beatmaps
{ {
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Beatmaps
{ {
Artist = "artist", Artist = "artist",
Title = "title", Title = "title",
Author = new APIUser { Username = "creator" } Author = new RealmUser { Username = "creator" }
} }
}; };
@ -50,7 +50,7 @@ namespace osu.Game.Tests.Beatmaps
{ {
Artist = "artist", Artist = "artist",
Title = "title", Title = "title",
Author = new APIUser { Username = "creator" } Author = new RealmUser { Username = "creator" }
}, },
DifficultyName = "difficulty" DifficultyName = "difficulty"
}; };

View File

@ -17,7 +17,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Models;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
@ -305,7 +305,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
Metadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Artist = "Artist", Artist = "Artist",
Author = new APIUser { Username = "Creator name here" }, Author = new RealmUser { Username = "Creator name here" },
Title = "Long title used to check background colour", Title = "Long title used to check background colour",
}, },
BeatmapSet = new BeatmapSetInfo() BeatmapSet = new BeatmapSetInfo()

View File

@ -12,7 +12,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Models;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.Ranking
[Test] [Test]
public void TestMapWithKnownMapper() public void TestMapWithKnownMapper()
{ {
var author = new APIUser { Username = "mapper_name" }; var author = new RealmUser { Username = "mapper_name" };
AddStep("show example score", () => showPanel(TestResources.CreateTestScoreInfo(createTestBeatmap(author)))); AddStep("show example score", () => showPanel(TestResources.CreateTestScoreInfo(createTestBeatmap(author))));
} }
@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.Ranking
{ {
AddStep("show excess mods score", () => AddStep("show excess mods score", () =>
{ {
var author = new APIUser { Username = "mapper_name" }; var author = new RealmUser { Username = "mapper_name" };
var score = TestResources.CreateTestScoreInfo(createTestBeatmap(author)); var score = TestResources.CreateTestScoreInfo(createTestBeatmap(author));
score.Mods = score.BeatmapInfo.Ruleset.CreateInstance().CreateAllMods().ToArray(); score.Mods = score.BeatmapInfo.Ruleset.CreateInstance().CreateAllMods().ToArray();
@ -57,7 +57,7 @@ namespace osu.Game.Tests.Visual.Ranking
[Test] [Test]
public void TestMapWithUnknownMapper() public void TestMapWithUnknownMapper()
{ {
AddStep("show example score", () => showPanel(TestResources.CreateTestScoreInfo(createTestBeatmap(new APIUser())))); AddStep("show example score", () => showPanel(TestResources.CreateTestScoreInfo(createTestBeatmap(new RealmUser()))));
AddAssert("mapped by text not present", () => AddAssert("mapped by text not present", () =>
this.ChildrenOfType<OsuSpriteText>().All(spriteText => !containsAny(spriteText.Text.ToString(), "mapped", "by"))); this.ChildrenOfType<OsuSpriteText>().All(spriteText => !containsAny(spriteText.Text.ToString(), "mapped", "by")));
@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual.Ranking
var ruleset = new OsuRuleset(); var ruleset = new OsuRuleset();
var mods = new Mod[] { ruleset.GetAutoplayMod() }; var mods = new Mod[] { ruleset.GetAutoplayMod() };
var beatmap = createTestBeatmap(new APIUser()); var beatmap = createTestBeatmap(new RealmUser());
var score = TestResources.CreateTestScoreInfo(beatmap); var score = TestResources.CreateTestScoreInfo(beatmap);
@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Ranking
private void showPanel(ScoreInfo score) => private void showPanel(ScoreInfo score) =>
Child = new ExpandedPanelMiddleContentContainer(score); Child = new ExpandedPanelMiddleContentContainer(score);
private BeatmapInfo createTestBeatmap([NotNull] APIUser author) private BeatmapInfo createTestBeatmap([NotNull] RealmUser author)
{ {
var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0)).BeatmapInfo; var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0)).BeatmapInfo;

View File

@ -17,6 +17,7 @@ using osu.Game.Beatmaps;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Models;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards; using osu.Game.Online.Leaderboards;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -65,7 +66,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{ {
Title = "TestSong", Title = "TestSong",
Artist = "TestArtist", Artist = "TestArtist",
Author = new APIUser Author = new RealmUser
{ {
Username = "TestAuthor" Username = "TestAuthor"
}, },

View File

@ -18,6 +18,7 @@ using osu.Framework.Testing;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.IO; using osu.Game.IO;
using osu.Game.IO.Archives; using osu.Game.IO.Archives;
using osu.Game.Models;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
@ -73,7 +74,11 @@ namespace osu.Game.Beatmaps
{ {
var metadata = new BeatmapMetadata var metadata = new BeatmapMetadata
{ {
Author = user, Author = new RealmUser
{
OnlineID = user.OnlineID,
Username = user.Username,
}
}; };
var set = new BeatmapSetInfo var set = new BeatmapSetInfo

View File

@ -7,6 +7,7 @@ using Newtonsoft.Json;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.Models;
#nullable enable #nullable enable
@ -123,8 +124,11 @@ namespace osu.Game.Online.API.Requests.Responses
TitleUnicode = TitleUnicode, TitleUnicode = TitleUnicode,
Artist = Artist, Artist = Artist,
ArtistUnicode = ArtistUnicode, ArtistUnicode = ArtistUnicode,
AuthorID = AuthorID, Author = new RealmUser
Author = Author, {
OnlineID = Author.OnlineID,
Username = Author.Username
},
Source = Source, Source = Source,
Tags = Tags, Tags = Tags,
}; };