From 209de886ce3677482a57066efe76d312bc8813ce Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 24 Mar 2022 20:13:58 +0900 Subject: [PATCH] Add method to stop countdown --- .../Tests/Visual/Multiplayer/TestMultiplayerClient.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 16da64c61e..ef5936198b 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Multiplayer shouldStopCountdown |= Room.Host?.State != MultiplayerUserState.Ready && Room.Host?.State != MultiplayerUserState.Spectating; if (shouldStopCountdown) - countdownStopSource?.Cancel(); + stopCountdown(); break; case MultiplayerRoomState.WaitingForLoad: @@ -319,10 +319,7 @@ namespace osu.Game.Tests.Visual.Multiplayer break; case StopCountdownRequest _: - countdownStopSource?.Cancel(); - - Room.Countdown = null; - await MatchEvent(new CountdownChangedEvent { Countdown = Room.Countdown }); + stopCountdown(); break; case ChangeTeamRequest changeTeam: @@ -348,7 +345,7 @@ namespace osu.Game.Tests.Visual.Multiplayer Debug.Assert(Room != null); 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. // 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() { Debug.Assert(Room != null);