1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 10:23:03 +08:00

Add method to stop countdown

This commit is contained in:
Dan Balasescu 2022-03-24 20:13:58 +09:00
parent ea9de0199d
commit 209de886ce

View File

@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
shouldStopCountdown |= Room.Host?.State != MultiplayerUserState.Ready && Room.Host?.State != MultiplayerUserState.Spectating; shouldStopCountdown |= Room.Host?.State != MultiplayerUserState.Ready && Room.Host?.State != MultiplayerUserState.Spectating;
if (shouldStopCountdown) if (shouldStopCountdown)
countdownStopSource?.Cancel(); stopCountdown();
break; break;
case MultiplayerRoomState.WaitingForLoad: case MultiplayerRoomState.WaitingForLoad:
@ -319,10 +319,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
break; break;
case StopCountdownRequest _: case StopCountdownRequest _:
countdownStopSource?.Cancel(); stopCountdown();
Room.Countdown = null;
await MatchEvent(new CountdownChangedEvent { Countdown = Room.Countdown });
break; break;
case ChangeTeamRequest changeTeam: case ChangeTeamRequest changeTeam:
@ -348,7 +345,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
Debug.Assert(Room != null); Debug.Assert(Room != null);
Debug.Assert(ThreadSafety.IsUpdateThread); Debug.Assert(ThreadSafety.IsUpdateThread);
countdownStopSource?.Cancel(); stopCountdown();
// Note that this will leak CTSs, however this is a test method and we haven't noticed foregoing disposal of non-linked CTSs to be detrimental. // Note that this will leak CTSs, however this is a test method and we haven't noticed foregoing disposal of non-linked CTSs to be detrimental.
// If necessary, this can be moved into the final schedule below, and the class-level fields be nulled out accordingly. // If necessary, this can be moved into the final schedule below, and the class-level fields be nulled out accordingly.
@ -397,6 +394,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
} }
} }
private void stopCountdown() => countdownStopSource?.Cancel();
public override Task StartMatch() public override Task StartMatch()
{ {
Debug.Assert(Room != null); Debug.Assert(Room != null);