1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 02:29:53 +08:00
Files
osu-lazer/osu.Game/Tests/Visual/TestUserLookupCache.cs
T
Dan Balasescu ac620ee375 Add additional information to the matchmaking queue screen (#37229)
- [x] Depends on https://github.com/ppy/osu/pull/37226
- [x] Depends on https://github.com/ppy/osu-server-spectator/pull/464

This adds two new components to the queue screen:
- A listing of the most recently completed matches (global).
- A rank distribution graph.

It looks something like this (fake data / test scene):

<img width="1669" height="1005" alt="image"
src="https://github.com/user-attachments/assets/caa57119-4267-4c6e-9898-2f414de865bf"
/>

It's completely dev-design(TM), but I used Lichess as inspiration for
the graph, and the original design document as inspiration for the
panels.

As for the history, because these are _completed_ matches one of the
player life points will always be 0, but I've designed it so as to
possibly support showing ongoing matches too in the future. It's only
supported for ranked play right now, though there is no reason we
couldn't track quick play rooms too (it's just... I'm not sure how to
design the panels for quick play).

---------

Co-authored-by: Dean Herbert <pe@ppy.sh>
2026-04-14 10:54:54 +09:00

33 lines
1.3 KiB
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using System.Threading.Tasks;
using osu.Game.Database;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Tests.Visual
{
public partial class TestUserLookupCache : UserLookupCache
{
/// <summary>
/// A special user ID which <see cref="ComputeValueAsync"/> would return a <see langword="null"/> <see cref="APIUser"/> for.
/// As a simulation to what a regular <see cref="UserLookupCache"/> would return in the case of failing to fetch the user.
/// </summary>
public const int UNRESOLVED_USER_ID = -1;
protected override Task<APIUser?> ComputeValueAsync(int lookup, CancellationToken token = default)
{
if (lookup == UNRESOLVED_USER_ID)
return Task.FromResult<APIUser?>(null);
return Task.FromResult<APIUser?>(new APIUser
{
Id = lookup,
Username = $"User {lookup}",
CoverUrl = "https://assets.ppy.sh/user-cover-presets/1/df28696b58541a9e67f6755918951d542d93bdf1da41720fcca2fd2c1ea8cf51.jpeg"
});
}
}
}