1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-17 18:13:18 +08:00
Files
osu-lazer/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs
T
Bartłomiej Dach 8cc2af4060 Fix gameplay leaderboard not always being expanded in gameplay leaderboard
I'd have preferred a `get; init;` property but tests were also attached
at the hip to the public bindable. Without some extra composition this
is the best that I can do.
2025-05-07 12:09:26 +02:00

59 lines
2.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 System.Linq;
using osu.Framework.Graphics;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
using osu.Game.Screens.OnlinePlay.Multiplayer;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Select.Leaderboards;
namespace osu.Game.Tests.Visual.Multiplayer
{
public partial class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerGameplayLeaderboardTestScene
{
private int team;
protected override MultiplayerRoomUser CreateUser(int userId)
{
var user = base.CreateUser(userId);
user.MatchState = new TeamVersusUserState
{
TeamID = team++ % 2
};
return user;
}
protected override MultiplayerLeaderboardProvider CreateLeaderboardProvider() =>
new MultiplayerLeaderboardProvider(MultiplayerUsers.ToArray())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("Add external display components", () =>
{
LoadComponentAsync(new MatchScoreDisplay
{
Team1Score = { BindTarget = LeaderboardProvider!.TeamScores[0] },
Team2Score = { BindTarget = LeaderboardProvider.TeamScores[1] }
}, Add);
LoadComponentAsync(new GameplayMatchScoreDisplay
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Team1Score = { BindTarget = LeaderboardProvider.TeamScores[0] },
Team2Score = { BindTarget = LeaderboardProvider.TeamScores[1] },
Expanded = { BindTarget = Leaderboard!.ForceExpand },
}, Add);
});
}
}
}