1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-26 15:10:31 +08:00
Files
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneUserProfileMatchmakingStatsDisplay.cs
T
Dan Balasescu 93b7c3324d Add matchmaking profile badge (#37241)
Using the same styling as osu!web + daily challenge.

<img width="1920" height="1034" alt="Screenshot_20260409-164600"
src="https://github.com/user-attachments/assets/97e2270e-af9f-478d-b2d6-c9fb8be16720"
/>

---------

Co-authored-by: Dean Herbert <pe@ppy.sh>
2026-04-09 19:25:21 +09:00

90 lines
3.0 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 osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Overlays.Profile;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Rulesets.Osu;
using osuTK;
namespace osu.Game.Tests.Visual.Online
{
public partial class TestSceneUserProfileMatchmakingStatsDisplay : OsuManualInputManagerTestScene
{
[Cached]
private readonly Bindable<UserProfileData?> userProfileData = new Bindable<UserProfileData?>(new UserProfileData(new APIUser(), new OsuRuleset().RulesetInfo));
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
[SetUpSteps]
public void SetUpSteps()
{
AddStep("create", () =>
{
Clear();
Add(new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background2,
});
Add(new MatchmakingStatsDisplay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(1f),
User = { BindTarget = userProfileData },
});
});
AddStep("set stats", () => userProfileData.Value = new UserProfileData(new APIUser
{
MatchmakingStatistics =
[
new APIUserMatchmakingStatistics
{
Plays = 10,
FirstPlacements = 8,
Rank = 1000,
Rating = 2000,
TotalPoints = 500,
Pool =
{
Name = "Active Pool"
}
},
new APIUserMatchmakingStatistics
{
Plays = 5,
FirstPlacements = 4,
Rank = 500,
Rating = 1000,
TotalPoints = 250,
Pool =
{
Name = "Inactive Pool"
}
},
new APIUserMatchmakingStatistics
{
Rating = 1500,
IsRatingProvisional = true,
Pool =
{
Name = "Provisional"
}
}
]
}, new OsuRuleset().RulesetInfo));
AddStep("clear stats", () => userProfileData.Value = null);
}
}
}