mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Also add team score display to multiplayer spectator screen
This commit is contained in:
@ -9,6 +9,7 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Rulesets.Osu.Scoring;
|
using osu.Game.Rulesets.Osu.Scoring;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate;
|
using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Multiplayer
|
namespace osu.Game.Tests.Visual.Multiplayer
|
||||||
{
|
{
|
||||||
@ -31,7 +32,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
};
|
};
|
||||||
|
|
||||||
foreach (var (userId, _) in clocks)
|
foreach (var (userId, _) in clocks)
|
||||||
|
{
|
||||||
SpectatorClient.StartPlay(userId, 0);
|
SpectatorClient.StartPlay(userId, 0);
|
||||||
|
OnlinePlayDependencies.Client.AddUser(new User { Id = userId });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("create leaderboard", () =>
|
AddStep("create leaderboard", () =>
|
||||||
|
@ -8,10 +8,12 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate;
|
using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Tests.Beatmaps.IO;
|
using osu.Game.Tests.Beatmaps.IO;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Multiplayer
|
namespace osu.Game.Tests.Visual.Multiplayer
|
||||||
{
|
{
|
||||||
@ -49,6 +51,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
Client.CurrentMatchPlayingUserIds.Add(PLAYER_1_ID);
|
Client.CurrentMatchPlayingUserIds.Add(PLAYER_1_ID);
|
||||||
Client.CurrentMatchPlayingUserIds.Add(PLAYER_2_ID);
|
Client.CurrentMatchPlayingUserIds.Add(PLAYER_2_ID);
|
||||||
|
|
||||||
|
OnlinePlayDependencies.Client.AddUser(new User { Id = PLAYER_1_ID });
|
||||||
|
OnlinePlayDependencies.Client.AddUser(new User { Id = PLAYER_2_ID });
|
||||||
|
|
||||||
playingUserIds.Add(PLAYER_1_ID);
|
playingUserIds.Add(PLAYER_1_ID);
|
||||||
playingUserIds.Add(PLAYER_2_ID);
|
playingUserIds.Add(PLAYER_2_ID);
|
||||||
});
|
});
|
||||||
@ -76,6 +82,41 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddWaitStep("wait a bit", 20);
|
AddWaitStep("wait a bit", 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestTeamDisplay()
|
||||||
|
{
|
||||||
|
AddStep("start players", () =>
|
||||||
|
{
|
||||||
|
Client.CurrentMatchPlayingUserIds.Add(PLAYER_1_ID);
|
||||||
|
Client.CurrentMatchPlayingUserIds.Add(PLAYER_2_ID);
|
||||||
|
|
||||||
|
var player1 = OnlinePlayDependencies.Client.AddUser(new User { Id = PLAYER_1_ID });
|
||||||
|
player1.MatchState = new TeamVersusUserState
|
||||||
|
{
|
||||||
|
TeamID = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
var player2 = OnlinePlayDependencies.Client.AddUser(new User { Id = PLAYER_2_ID });
|
||||||
|
player2.MatchState = new TeamVersusUserState
|
||||||
|
{
|
||||||
|
TeamID = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
SpectatorClient.StartPlay(PLAYER_1_ID, importedBeatmapId);
|
||||||
|
SpectatorClient.StartPlay(PLAYER_2_ID, importedBeatmapId);
|
||||||
|
|
||||||
|
playingUserIds.Add(PLAYER_1_ID);
|
||||||
|
playingUserIds.Add(PLAYER_2_ID);
|
||||||
|
});
|
||||||
|
|
||||||
|
loadSpectateScreen();
|
||||||
|
|
||||||
|
sendFrames(PLAYER_1_ID, 1000);
|
||||||
|
sendFrames(PLAYER_2_ID, 1000);
|
||||||
|
|
||||||
|
AddWaitStep("wait a bit", 20);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestTimeDoesNotProgressWhileAllPlayersPaused()
|
public void TestTimeDoesNotProgressWhileAllPlayersPaused()
|
||||||
{
|
{
|
||||||
@ -265,6 +306,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
foreach (int id in userIds)
|
foreach (int id in userIds)
|
||||||
{
|
{
|
||||||
Client.CurrentMatchPlayingUserIds.Add(id);
|
Client.CurrentMatchPlayingUserIds.Add(id);
|
||||||
|
OnlinePlayDependencies.Client.AddUser(new User { Id = id });
|
||||||
|
|
||||||
SpectatorClient.StartPlay(id, beatmapId ?? importedBeatmapId);
|
SpectatorClient.StartPlay(id, beatmapId ?? importedBeatmapId);
|
||||||
playingUserIds.Add(id);
|
playingUserIds.Add(id);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Online.Spectator;
|
using osu.Game.Online.Spectator;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osu.Game.Screens.Spectate;
|
using osu.Game.Screens.Spectate;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||||
@ -59,6 +60,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Container leaderboardContainer;
|
Container leaderboardContainer;
|
||||||
|
Container scoreDisplayContainer;
|
||||||
|
|
||||||
masterClockContainer = new MasterGameplayClockContainer(Beatmap.Value, 0);
|
masterClockContainer = new MasterGameplayClockContainer(Beatmap.Value, 0);
|
||||||
|
|
||||||
InternalChildren = new[]
|
InternalChildren = new[]
|
||||||
@ -67,20 +70,36 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
masterClockContainer.WithChild(new GridContainer
|
masterClockContainer.WithChild(new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ColumnDimensions = new[]
|
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
|
||||||
{
|
|
||||||
new Dimension(GridSizeMode.AutoSize)
|
|
||||||
},
|
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
leaderboardContainer = new Container
|
scoreDisplayContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.X
|
AutoSizeAxes = Axes.Y
|
||||||
},
|
},
|
||||||
grid = new PlayerGrid { RelativeSizeAxes = Axes.Both }
|
},
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
new GridContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
leaderboardContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
AutoSizeAxes = Axes.X
|
||||||
|
},
|
||||||
|
grid = new PlayerGrid { RelativeSizeAxes = Axes.Both }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -108,6 +127,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
leaderboard.AddClock(instance.UserId, instance.GameplayClock);
|
leaderboard.AddClock(instance.UserId, instance.GameplayClock);
|
||||||
|
|
||||||
leaderboardContainer.Add(leaderboard);
|
leaderboardContainer.Add(leaderboard);
|
||||||
|
|
||||||
|
if (leaderboard.TeamScores.Count >= 2)
|
||||||
|
{
|
||||||
|
LoadComponentAsync(new MatchScoreDisplay
|
||||||
|
{
|
||||||
|
Team1Score = { BindTarget = leaderboard.TeamScores.First().Value },
|
||||||
|
Team2Score = { BindTarget = leaderboard.TeamScores.Last().Value },
|
||||||
|
}, scoreDisplayContainer.Add);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user