1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 07:22:54 +08:00

Fix finished-play state not handled correctly

This commit is contained in:
smoogipoo 2021-10-22 21:16:10 +09:00
parent d7a98097a1
commit 1b4be61ed1

View File

@ -96,31 +96,31 @@ namespace osu.Game.Tests.Visual.Multiplayer
public void ChangeUserState(int userId, MultiplayerUserState newState)
{
Debug.Assert(Room != null);
((IMultiplayerClient)this).UserStateChanged(userId, newState);
Schedule(() =>
{
switch (newState)
switch (Room.State)
{
case MultiplayerUserState.Loaded:
case MultiplayerRoomState.WaitingForLoad:
if (Room.Users.All(u => u.State != MultiplayerUserState.WaitingForLoad))
{
ChangeRoomState(MultiplayerRoomState.Playing);
foreach (var u in Room.Users.Where(u => u.State == MultiplayerUserState.Loaded))
ChangeUserState(u.UserID, MultiplayerUserState.Playing);
((IMultiplayerClient)this).MatchStarted();
ChangeRoomState(MultiplayerRoomState.Playing);
}
break;
case MultiplayerUserState.FinishedPlay:
case MultiplayerRoomState.Playing:
if (Room.Users.All(u => u.State != MultiplayerUserState.Playing))
{
ChangeRoomState(MultiplayerRoomState.Open);
foreach (var u in Room.Users.Where(u => u.State == MultiplayerUserState.FinishedPlay))
ChangeUserState(u.UserID, MultiplayerUserState.Results);
ChangeRoomState(MultiplayerRoomState.Open);
((IMultiplayerClient)this).ResultsReady();
}