mirror of
https://github.com/ppy/osu.git
synced 2026-05-18 23:50:42 +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>
70 lines
2.2 KiB
C#
70 lines
2.2 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.Collections.Generic;
|
|
using NUnit.Framework;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Game.Overlays;
|
|
using osu.Game.Screens.OnlinePlay.Matchmaking.Queue;
|
|
using osuTK;
|
|
|
|
namespace osu.Game.Tests.Visual.Matchmaking
|
|
{
|
|
public partial class TestSceneRatingDistributionGraph : OsuTestScene
|
|
{
|
|
[Cached]
|
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Plum);
|
|
|
|
private RatingDistributionGraph graph = null!;
|
|
|
|
[SetUp]
|
|
public void Setup() => Schedule(() =>
|
|
{
|
|
Child = graph = new RatingDistributionGraph
|
|
{
|
|
Anchor = Anchor.Centre,
|
|
Origin = Anchor.Centre,
|
|
RelativeSizeAxes = Axes.Both,
|
|
Size = new Vector2(0.5f, 0.25f)
|
|
};
|
|
});
|
|
|
|
[Test]
|
|
public void TestRandomData()
|
|
{
|
|
AddStep("set random data", () =>
|
|
{
|
|
List<(int x, int y)> values = new List<(int x, int y)>();
|
|
for (int i = 400; i <= 2800; i += 100)
|
|
values.Add((i, (int)Math.Round(generateCount(i, 1600, 400, 7200))));
|
|
graph.SetData(values.ToArray(), Random.Shared.Next(400, 2800));
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void TestNoUserRating()
|
|
{
|
|
AddStep("set data", () =>
|
|
{
|
|
List<(int x, int y)> values = new List<(int x, int y)>();
|
|
for (int i = 400; i <= 2800; i += 100)
|
|
values.Add((i, (int)Math.Round(generateCount(i, 1600, 400, 7200))));
|
|
graph.SetData(values.ToArray(), null);
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void TestNoData()
|
|
{
|
|
AddStep("set empty data", () => graph.SetData([], null));
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|