mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 16:13:20 +08:00
Tidy up base implementation
This commit is contained in:
parent
b52f070fdb
commit
6a61fd95eb
@ -28,10 +28,15 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
public abstract class MultiplayerGameplayLeaderboardTestScene : OsuTestScene
|
public abstract class MultiplayerGameplayLeaderboardTestScene : OsuTestScene
|
||||||
{
|
{
|
||||||
protected readonly BindableList<MultiplayerRoomUser> MultiplayerUsers = new BindableList<MultiplayerRoomUser>();
|
protected readonly BindableList<MultiplayerRoomUser> MultiplayerUsers = new BindableList<MultiplayerRoomUser>();
|
||||||
private readonly BindableList<int> multiplayerUserIds = new BindableList<int>();
|
|
||||||
|
|
||||||
protected MultiplayerGameplayLeaderboard Leaderboard { get; private set; }
|
protected MultiplayerGameplayLeaderboard Leaderboard { get; private set; }
|
||||||
|
|
||||||
|
protected virtual MultiplayerRoomUser CreateUser(int userId) => new MultiplayerRoomUser(userId);
|
||||||
|
|
||||||
|
protected abstract MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor);
|
||||||
|
|
||||||
|
private readonly BindableList<int> multiplayerUserIds = new BindableList<int>();
|
||||||
|
|
||||||
private OsuConfigManager config;
|
private OsuConfigManager config;
|
||||||
|
|
||||||
private readonly Mock<SpectatorClient> spectatorClient = new Mock<SpectatorClient>();
|
private readonly Mock<SpectatorClient> spectatorClient = new Mock<SpectatorClient>();
|
||||||
@ -81,7 +86,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser
|
AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser
|
||||||
{
|
{
|
||||||
Username = "local",
|
Id = 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("populate users", () =>
|
AddStep("populate users", () =>
|
||||||
@ -95,25 +100,19 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
Leaderboard?.Expire();
|
Leaderboard?.Expire();
|
||||||
|
|
||||||
OsuScoreProcessor scoreProcessor;
|
|
||||||
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
|
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
|
||||||
|
|
||||||
var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value);
|
var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value);
|
||||||
|
OsuScoreProcessor scoreProcessor = new OsuScoreProcessor();
|
||||||
Child = scoreProcessor = new OsuScoreProcessor();
|
|
||||||
|
|
||||||
scoreProcessor.ApplyBeatmap(playableBeatmap);
|
scoreProcessor.ApplyBeatmap(playableBeatmap);
|
||||||
|
|
||||||
|
Child = scoreProcessor;
|
||||||
|
|
||||||
LoadComponentAsync(Leaderboard = CreateLeaderboard(scoreProcessor), Add);
|
LoadComponentAsync(Leaderboard = CreateLeaderboard(scoreProcessor), Add);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for load", () => Leaderboard.IsLoaded);
|
AddUntilStep("wait for load", () => Leaderboard.IsLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual MultiplayerRoomUser CreateUser(int i) => new MultiplayerRoomUser(i);
|
|
||||||
|
|
||||||
protected abstract MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor);
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestScoreUpdates()
|
public void TestScoreUpdates()
|
||||||
{
|
{
|
||||||
|
@ -14,9 +14,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
public class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerGameplayLeaderboardTestScene
|
public class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerGameplayLeaderboardTestScene
|
||||||
{
|
{
|
||||||
protected override MultiplayerRoomUser CreateUser(int i)
|
protected override MultiplayerRoomUser CreateUser(int userId)
|
||||||
{
|
{
|
||||||
var user = base.CreateUser(i);
|
var user = base.CreateUser(userId);
|
||||||
user.MatchState = new TeamVersusUserState
|
user.MatchState = new TeamVersusUserState
|
||||||
{
|
{
|
||||||
TeamID = RNG.Next(0, 2)
|
TeamID = RNG.Next(0, 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user