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

Merge pull request #17520 from smoogipoo/fix-countdown-refresh

Fix countdown timer not refreshing on new countdown
This commit is contained in:
Dean Herbert 2022-03-30 22:58:26 +09:00 committed by GitHub
commit 0020102810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,17 +36,18 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
} }
private MultiplayerCountdown countdown; private MultiplayerCountdown countdown;
private DateTimeOffset countdownReceivedTime; private DateTimeOffset countdownChangeTime;
private ScheduledDelegate countdownUpdateDelegate; private ScheduledDelegate countdownUpdateDelegate;
private void onRoomUpdated() => Scheduler.AddOnce(() => private void onRoomUpdated() => Scheduler.AddOnce(() =>
{ {
if (countdown == null && room?.Countdown != null) if (countdown != room?.Countdown)
countdownReceivedTime = DateTimeOffset.Now; {
countdown = room?.Countdown;
countdownChangeTime = DateTimeOffset.Now;
}
countdown = room?.Countdown; if (countdown != null)
if (room?.Countdown != null)
countdownUpdateDelegate ??= Scheduler.AddDelayed(updateButtonText, 100, true); countdownUpdateDelegate ??= Scheduler.AddDelayed(updateButtonText, 100, true);
else else
{ {
@ -74,7 +75,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
if (countdown != null) if (countdown != null)
{ {
TimeSpan timeElapsed = DateTimeOffset.Now - countdownReceivedTime; TimeSpan timeElapsed = DateTimeOffset.Now - countdownChangeTime;
TimeSpan countdownRemaining; TimeSpan countdownRemaining;
if (timeElapsed > countdown.TimeRemaining) if (timeElapsed > countdown.TimeRemaining)