mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Add missing TestMultiplayerClient coverage
This commit is contained in:
parent
5fe46a73cb
commit
f80692f342
@ -125,6 +125,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
private void updateRoomStateIfRequired()
|
private void updateRoomStateIfRequired()
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
Debug.Assert(Room != null);
|
||||||
|
Debug.Assert(APIRoom != null);
|
||||||
|
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
@ -132,13 +133,28 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
case MultiplayerRoomState.Open:
|
case MultiplayerRoomState.Open:
|
||||||
// If there are no remaining ready users or the host is not ready, stop any existing countdown.
|
// If there are no remaining ready users or the host is not ready, stop any existing countdown.
|
||||||
// Todo: When we have an "automatic start" mode, this should also start a new countdown if any users _are_ ready.
|
|
||||||
// Todo: This doesn't yet support non-match-start countdowns.
|
// Todo: This doesn't yet support non-match-start countdowns.
|
||||||
bool shouldStopCountdown = Room.Users.All(u => u.State != MultiplayerUserState.Ready);
|
if (Room.Settings.AutoStartDuration != TimeSpan.Zero)
|
||||||
shouldStopCountdown |= Room.Host?.State != MultiplayerUserState.Ready && Room.Host?.State != MultiplayerUserState.Spectating;
|
{
|
||||||
|
bool shouldHaveCountdown = !APIRoom.Playlist.GetCurrentItem()!.Expired && Room.Users.Any(u => u.State == MultiplayerUserState.Ready);
|
||||||
|
|
||||||
|
if (shouldHaveCountdown)
|
||||||
|
{
|
||||||
|
if (Room.Countdown == null)
|
||||||
|
startCountdown(new MatchStartCountdown { TimeRemaining = Room.Settings.AutoStartDuration }, StartMatch);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stopCountdown();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool shouldStopCountdown = Room.Users.All(u => u.State != MultiplayerUserState.Ready);
|
||||||
|
shouldStopCountdown |= Room.Host?.State != MultiplayerUserState.Ready && Room.Host?.State != MultiplayerUserState.Spectating;
|
||||||
|
|
||||||
|
if (shouldStopCountdown)
|
||||||
|
stopCountdown();
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldStopCountdown)
|
|
||||||
stopCountdown();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MultiplayerRoomState.WaitingForLoad:
|
case MultiplayerRoomState.WaitingForLoad:
|
||||||
|
Loading…
Reference in New Issue
Block a user