Add support for starting/stopping countdowns

This commit is contained in:
Dan Balasescu
2022-03-17 19:26:42 +09:00
parent 3b938865a1
commit 72843a6797
5 changed files with 354 additions and 39 deletions

View File

@ -16,6 +16,7 @@ using osu.Framework.Logging;
using osu.Game.Database;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Multiplayer.Countdown;
using osu.Game.Online.Rooms;
using osu.Game.Online.Rooms.RoomStatuses;
using osu.Game.Rulesets;
@ -534,7 +535,24 @@ namespace osu.Game.Online.Multiplayer
public Task MatchEvent(MatchServerEvent e)
{
// not used by any match types just yet.
if (Room == null)
return Task.CompletedTask;
Scheduler.Add(() =>
{
if (Room == null)
return;
switch (e)
{
case CountdownChangedEvent countdownChangedEvent:
Room.Countdown = countdownChangedEvent.Countdown;
break;
}
RoomUpdated?.Invoke();
}, false);
return Task.CompletedTask;
}