mirror of
https://github.com/ppy/osu.git
synced 2026-05-17 14:53:19 +08:00
ac620ee375
- [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>
80 lines
3.5 KiB
C#
80 lines
3.5 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;
|
|
using System.Linq;
|
|
using NUnit.Framework;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Extensions;
|
|
using osu.Framework.Testing;
|
|
using osu.Game.Online.Matchmaking;
|
|
using osu.Game.Online.Multiplayer;
|
|
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
|
|
using osu.Game.Online.Rooms;
|
|
using osu.Game.Screens.OnlinePlay.Matchmaking.Intro;
|
|
using osu.Game.Screens.OnlinePlay.Matchmaking.Queue;
|
|
using osu.Game.Tests.Visual.Multiplayer;
|
|
|
|
namespace osu.Game.Tests.Visual.Matchmaking
|
|
{
|
|
public partial class TestSceneMatchmakingQueueScreen : MultiplayerTestScene
|
|
{
|
|
[Cached]
|
|
private readonly QueueController controller = new QueueController();
|
|
|
|
private ScreenQueue? queueScreen => Stack.CurrentScreen as ScreenQueue;
|
|
|
|
[SetUpSteps]
|
|
public override void SetUpSteps()
|
|
{
|
|
base.SetUpSteps();
|
|
|
|
AddStep("join room", () => JoinRoom(CreateDefaultRoom(MatchType.Matchmaking)));
|
|
WaitForJoined();
|
|
|
|
AddStep("load screen", () => LoadScreen(new ScreenIntro(MatchmakingPoolType.QuickPlay)));
|
|
AddUntilStep("wait for queue screen", () => queueScreen?.IsLoaded == true);
|
|
|
|
AddStep("send status update", () =>
|
|
{
|
|
int userId1 = Random.Shared.Next(1, 11);
|
|
int userId2 = Random.Shared.GetItems(Enumerable.Range(1, 10).Except([userId1]).ToArray(), 1).Single();
|
|
|
|
MultiplayerClient.MatchmakingLobbyStatusChanged(new MatchmakingLobbyStatus
|
|
{
|
|
UsersInQueue = Enumerable.Range(1, 10).ToArray(),
|
|
RatingDistribution = Enumerable.Range(0, 24).Select(i => (400 + i * 100, (int)Math.Round(generateCount(400 + i * 100, 1600, 400, 7200)))).ToArray(),
|
|
UserRating = Random.Shared.Next(400, 2800),
|
|
RecentMatches = Enumerable.Range(1, 10).Select(_ => (MatchRoomState)new RankedPlayRoomState
|
|
{
|
|
Users =
|
|
{
|
|
{ userId1, new RankedPlayUserInfo { Rating = 0, Life = Random.Shared.Next(0, 1_000_001), RoundsWon = Random.Shared.Next(0, 4) } },
|
|
{ userId2, new RankedPlayUserInfo { Rating = 0, Life = Random.Shared.Next(0, 1_000_001), RoundsWon = Random.Shared.Next(0, 4) } },
|
|
}
|
|
}).ToArray()
|
|
}).WaitSafely();
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void TestBasic()
|
|
{
|
|
AddStep("change state to idle", () => queueScreen!.SetState(ScreenQueue.MatchmakingScreenState.Idle));
|
|
|
|
AddStep("change state to queueing", () => queueScreen!.SetState(ScreenQueue.MatchmakingScreenState.Queueing));
|
|
|
|
AddStep("change state to found match", () => queueScreen!.SetState(ScreenQueue.MatchmakingScreenState.PendingAccept));
|
|
|
|
AddStep("change state to waiting for room", () => queueScreen!.SetState(ScreenQueue.MatchmakingScreenState.AcceptedWaitingForRoom));
|
|
|
|
AddStep("change state to in room", () => queueScreen!.SetState(ScreenQueue.MatchmakingScreenState.InRoom));
|
|
}
|
|
|
|
private static double generateCount(double x, double mean, double stdDev, double amplitude)
|
|
{
|
|
return amplitude * Math.Exp(-Math.Pow(x - mean, 2) / (2 * Math.Pow(stdDev, 2))) + Random.Shared.Next(300);
|
|
}
|
|
}
|
|
}
|