mirror of
https://github.com/ppy/osu
synced 2025-01-11 00:29:30 +00:00
Use a local lookup cache for better usernames
This commit is contained in:
parent
09d0ceb766
commit
c1ba0f4642
@ -9,12 +9,14 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Online.Spectator;
|
||||
using osu.Game.Replays.Legacy;
|
||||
using osu.Game.Rulesets.Osu.Scoring;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Tests.Visual.Online;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
@ -23,6 +25,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[Cached(typeof(SpectatorStreamingClient))]
|
||||
private TestMultiplayerStreaming streamingClient = new TestMultiplayerStreaming(16);
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private UserLookupCache lookupCache = new TestSceneCurrentlyPlayingDisplay.TestUserLookupCache();
|
||||
|
||||
// used just to show beatmap card for the time being.
|
||||
protected override bool UseOnlineAPI => true;
|
||||
|
||||
@ -35,6 +40,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
streamingClient,
|
||||
lookupCache,
|
||||
scoreProcessor = new OsuScoreProcessor(),
|
||||
new MultiplayerGameplayLeaderboard(scoreProcessor)
|
||||
{
|
||||
|
@ -69,8 +69,34 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
internal class TestUserLookupCache : UserLookupCache
|
||||
{
|
||||
private static readonly string[] usernames =
|
||||
{
|
||||
"fieryrage",
|
||||
"Kerensa",
|
||||
"MillhioreF",
|
||||
"Player01",
|
||||
"smoogipoo",
|
||||
"Ephemeral",
|
||||
"BTMC",
|
||||
"Cilvery",
|
||||
"m980",
|
||||
"HappyStick",
|
||||
"LittleEndu",
|
||||
"frenzibyte",
|
||||
"Zallius",
|
||||
"BanchoBot",
|
||||
"rocketminer210",
|
||||
"pishifat"
|
||||
};
|
||||
|
||||
private int id;
|
||||
|
||||
protected override Task<User> ComputeValueAsync(int lookup, CancellationToken token = default)
|
||||
=> Task.FromResult(new User { Username = "peppy", Id = 2 });
|
||||
=> Task.FromResult(new User
|
||||
{
|
||||
Id = id++,
|
||||
Username = usernames[id % usernames.Length],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user