mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 20:32:54 +08:00
Fix finished-play state not handled correctly
This commit is contained in:
parent
d7a98097a1
commit
1b4be61ed1
@ -96,31 +96,31 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
public void ChangeUserState(int userId, MultiplayerUserState newState)
|
public void ChangeUserState(int userId, MultiplayerUserState newState)
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
Debug.Assert(Room != null);
|
||||||
|
|
||||||
((IMultiplayerClient)this).UserStateChanged(userId, newState);
|
((IMultiplayerClient)this).UserStateChanged(userId, newState);
|
||||||
|
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
switch (newState)
|
switch (Room.State)
|
||||||
{
|
{
|
||||||
case MultiplayerUserState.Loaded:
|
case MultiplayerRoomState.WaitingForLoad:
|
||||||
if (Room.Users.All(u => u.State != MultiplayerUserState.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))
|
foreach (var u in Room.Users.Where(u => u.State == MultiplayerUserState.Loaded))
|
||||||
ChangeUserState(u.UserID, MultiplayerUserState.Playing);
|
ChangeUserState(u.UserID, MultiplayerUserState.Playing);
|
||||||
|
|
||||||
((IMultiplayerClient)this).MatchStarted();
|
((IMultiplayerClient)this).MatchStarted();
|
||||||
|
|
||||||
|
ChangeRoomState(MultiplayerRoomState.Playing);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MultiplayerUserState.FinishedPlay:
|
case MultiplayerRoomState.Playing:
|
||||||
if (Room.Users.All(u => u.State != MultiplayerUserState.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))
|
foreach (var u in Room.Users.Where(u => u.State == MultiplayerUserState.FinishedPlay))
|
||||||
ChangeUserState(u.UserID, MultiplayerUserState.Results);
|
ChangeUserState(u.UserID, MultiplayerUserState.Results);
|
||||||
|
ChangeRoomState(MultiplayerRoomState.Open);
|
||||||
|
|
||||||
((IMultiplayerClient)this).ResultsReady();
|
((IMultiplayerClient)this).ResultsReady();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user