2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2021-08-09 15:50:25 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Graphics;
|
2021-08-12 10:08:52 +08:00
|
|
|
|
using osu.Game.Online.Multiplayer;
|
2021-08-09 15:50:25 +08:00
|
|
|
|
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
2021-08-09 17:13:28 +08:00
|
|
|
|
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
2021-08-09 15:50:25 +08:00
|
|
|
|
using osu.Game.Screens.Play.HUD;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Multiplayer
|
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerGameplayLeaderboardTestScene
|
2021-08-09 15:50:25 +08:00
|
|
|
|
{
|
2022-04-12 10:46:21 +08:00
|
|
|
|
private int team;
|
|
|
|
|
|
2022-04-11 18:19:45 +08:00
|
|
|
|
protected override MultiplayerRoomUser CreateUser(int userId)
|
2021-08-09 15:50:25 +08:00
|
|
|
|
{
|
2022-04-11 18:19:45 +08:00
|
|
|
|
var user = base.CreateUser(userId);
|
2022-04-11 18:15:57 +08:00
|
|
|
|
user.MatchState = new TeamVersusUserState
|
|
|
|
|
{
|
2022-04-12 10:46:21 +08:00
|
|
|
|
TeamID = team++ % 2
|
2022-04-11 18:15:57 +08:00
|
|
|
|
};
|
|
|
|
|
return user;
|
2021-08-09 15:50:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-30 18:18:38 +08:00
|
|
|
|
protected override MultiplayerGameplayLeaderboard CreateLeaderboard() =>
|
|
|
|
|
new MultiplayerGameplayLeaderboard(MultiplayerUsers.ToArray())
|
2022-04-11 18:15:57 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
};
|
2021-08-09 15:50:25 +08:00
|
|
|
|
|
|
|
|
|
public override void SetUpSteps()
|
|
|
|
|
{
|
2021-10-27 19:56:03 +08:00
|
|
|
|
base.SetUpSteps();
|
|
|
|
|
|
2022-04-11 18:15:57 +08:00
|
|
|
|
AddStep("Add external display components", () =>
|
2021-08-09 15:50:25 +08:00
|
|
|
|
{
|
2022-04-11 18:15:57 +08:00
|
|
|
|
LoadComponentAsync(new MatchScoreDisplay
|
2021-08-09 15:50:25 +08:00
|
|
|
|
{
|
2022-04-11 18:15:57 +08:00
|
|
|
|
Team1Score = { BindTarget = Leaderboard.TeamScores[0] },
|
|
|
|
|
Team2Score = { BindTarget = Leaderboard.TeamScores[1] }
|
|
|
|
|
}, Add);
|
2021-08-09 15:50:25 +08:00
|
|
|
|
|
2022-04-11 18:15:57 +08:00
|
|
|
|
LoadComponentAsync(new GameplayMatchScoreDisplay
|
2021-08-09 15:50:25 +08:00
|
|
|
|
{
|
2022-04-11 18:15:57 +08:00
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
Team1Score = { BindTarget = Leaderboard.TeamScores[0] },
|
2022-04-12 09:49:57 +08:00
|
|
|
|
Team2Score = { BindTarget = Leaderboard.TeamScores[1] },
|
|
|
|
|
Expanded = { BindTarget = Leaderboard.Expanded },
|
2022-04-11 18:15:57 +08:00
|
|
|
|
}, Add);
|
2021-08-09 17:13:28 +08:00
|
|
|
|
});
|
2021-08-09 15:50:25 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|