diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index b123d50a4e..a73fafcffd 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -161,7 +161,7 @@ namespace osu.Game.Screens.Menu { Padding = new MarginPadding { Left = WEDGE_WIDTH } }); - buttonsMulti.Add(new MainMenuButton("quick play", @"button-default-select", FontAwesome.Solid.Bolt, new Color4(94, 63, 186, 255), onMatchmaking, Key.Q)); + buttonsMulti.Add(new MainMenuButton("quick play", @"button-daily-select", FontAwesome.Solid.Bolt, new Color4(94, 63, 186, 255), onMatchmaking, Key.Q)); buttonsMulti.ForEach(b => b.VisibleState = ButtonSystemState.Multi); buttonsEdit.Add(new MainMenuButton(EditorStrings.BeatmapEditor.ToLower(), @"button-default-select", OsuIcon.Beatmap, new Color4(238, 170, 0, 255), (_, _) => OnEditBeatmap?.Invoke(), Key.B, diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.StageSegment.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.StageSegment.cs index 301cac1437..7e3b7d4468 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.StageSegment.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.StageSegment.cs @@ -39,8 +39,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match private DateTimeOffset countdownEndTime; private SpriteIcon arrow = null!; - private Sample? countdownTickSample; - private double? lastSamplePlayback; + private Sample? segmentStartedSample; private Container mainContent = null!; @@ -120,7 +119,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match }; Alpha = 0.5f; - countdownTickSample = audio.Samples.Get(@"Multiplayer/countdown-tick"); + segmentStartedSample = audio.Samples.Get(@"Multiplayer/Matchmaking/stage-segment"); } protected override void LoadComplete() @@ -156,15 +155,6 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match } progressBar.Width = (float)Math.Clamp(elapsed.TotalMilliseconds / total.TotalMilliseconds, 0, 1); - - int secondsRemaining = Math.Max(0, (int)Math.Ceiling((total.TotalMilliseconds - elapsed.TotalMilliseconds) / 1000)); - - if (total.TotalMilliseconds - elapsed.TotalMilliseconds <= 3000 - && lastSamplePlayback != secondsRemaining) - { - countdownTickSample?.Play(); - lastSamplePlayback = secondsRemaining; - } } private void onMatchRoomStateChanged(MatchRoomState? state) => Scheduler.Add(() => @@ -213,6 +203,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match arrow.FadeIn(500, Easing.OutQuint); this.FadeIn(200); + + segmentStartedSample?.Play(); }); private void onCountdownStopped(MultiplayerCountdown countdown) => Scheduler.Add(() => diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.StatusText.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.StatusText.cs index 8d94df11e4..33692ffe03 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.StatusText.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.StatusText.cs @@ -65,8 +65,11 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match if (text.Text == string.Empty || (lastSamplePlayback != null && Time.Current - lastSamplePlayback < OsuGameBase.SAMPLE_DEBOUNCE_TIME)) return; - textChangedSample?.Play(); - lastSamplePlayback = Time.Current; + if (matchmakingState.Stage is MatchmakingStage.WaitingForClientsJoin or MatchmakingStage.WaitingForClientsBeatmapDownload) + { + textChangedSample?.Play(); + lastSamplePlayback = Time.Current; + } LocalisableString textForStatus = getTextForStatus(matchmakingState.Stage); diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.cs index e383df71c9..9bb1fe1397 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/StageDisplay.cs @@ -3,6 +3,8 @@ using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -138,8 +140,15 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match private Circle innerCircle = null!; private CircularProgress progress = null!; + private Sample? swishSample; + private Sample? swooshSample; + private Sample? roundUpSample; + private SampleChannel? swishChannel; + private SampleChannel? swooshChannel; + private SampleChannel? roundUpChannel; + [BackgroundDependencyLoader] - private void load(OverlayColourProvider colours) + private void load(OverlayColourProvider colours, AudioManager audio) { Size = new Vector2(76); @@ -210,6 +219,10 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match Text = $"{round_count}" }, }; + + swishSample = audio.Samples.Get(@"UI/overlay-pop-in"); + swooshSample = audio.Samples.Get(@"UI/overlay-big-pop-out"); + roundUpSample = audio.Samples.Get(@"Multiplayer/Matchmaking/round-up"); } private int round; @@ -231,11 +244,39 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match .MoveToY(0, 500, Easing.InQuart) .ScaleTo(1, 500, Easing.InQuart); + swishChannel = swishSample?.GetChannel(); + + if (swishChannel != null) + { + swishChannel.Balance.Value = -OsuGameBase.SFX_STEREO_STRENGTH; + swishChannel?.Play(); + } + + Scheduler.AddDelayed(() => + { + swooshChannel = swooshSample?.GetChannel(); + + if (swooshChannel == null) return; + + swooshChannel.Balance.Value = -OsuGameBase.SFX_STEREO_STRENGTH; + swooshChannel?.Play(); + }, 1250); + Scheduler.AddDelayed(() => { progress.ProgressTo((float)round / round_count, 500, Easing.InOutQuart); + Scheduler.AddDelayed(() => { + roundUpChannel = roundUpSample?.GetChannel(); + + if (roundUpChannel != null) + { + roundUpChannel.Balance.Value = -OsuGameBase.SFX_STEREO_STRENGTH; + roundUpChannel.Frequency.Value = 1f + round * 0.05f; + roundUpChannel?.Play(); + } + innerCircle .FadeTo(1, 250, Easing.OutQuint) .Then() diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/ScreenQueue.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/ScreenQueue.cs index 501a46d4c4..8eaa280794 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/ScreenQueue.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/ScreenQueue.cs @@ -18,6 +18,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Screens; +using osu.Framework.Threading; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -71,6 +72,9 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Queue [Resolved] private IBindable ruleset { get; set; } = null!; + [Resolved] + private MusicController musicController { get; set; } = null!; + private readonly IBindable currentState = new Bindable(); private readonly Bindable availablePools = new Bindable(); @@ -78,8 +82,13 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Queue private CancellationTokenSource userLookupCancellation = new CancellationTokenSource(); + private Sample? enqueueSample; + private Sample? waitingLoopSample; private Sample? matchFoundSample; + private SampleChannel? waitingLoopChannel; + private ScheduledDelegate? startLoopPlaybackDelegate; + protected override void LoadComplete() { base.LoadComplete(); @@ -155,6 +164,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Queue [BackgroundDependencyLoader] private void load(AudioManager audio) { + enqueueSample = audio.Samples.Get(@"Multiplayer/Matchmaking/enqueue"); + waitingLoopSample = audio.Samples.Get(@"Multiplayer/Matchmaking/waiting-loop"); matchFoundSample = audio.Samples.Get(@"Multiplayer/Matchmaking/match-found"); } @@ -247,6 +258,9 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Queue mainContent.FadeInFromZero(500, Easing.OutQuint); mainContent.Clear(); + startLoopPlaybackDelegate?.Cancel(); + stopWaitingLoopPlayback(); + switch (newState) { case MatchmakingScreenState.Idle: @@ -334,6 +348,9 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Queue sendToBackgroundButton.Enabled.Value = true; sendToBackgroundButton.TooltipText = "You will receive a notification when your game is ready. Make sure to watch out for it!"; }, 5000); + + enqueueSample?.Play(); + startLoopPlaybackDelegate = Scheduler.AddDelayed(startWaitingLoopPlayback, 2000); break; case MatchmakingScreenState.PendingAccept: @@ -369,6 +386,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Queue } }; matchFoundSample?.Play(); + musicController.DuckMomentarily(1250); break; case MatchmakingScreenState.AcceptedWaitingForRoom: @@ -394,6 +412,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Queue }, } }; + + startWaitingLoopPlayback(); break; case MatchmakingScreenState.InRoom: @@ -430,6 +450,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Queue { base.Dispose(isDisposing); + stopWaitingLoopPlayback(); + if (client.IsNotNull()) client.MatchmakingLobbyStatusChanged -= onMatchmakingLobbyStatusChanged; } @@ -443,6 +465,24 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Queue InRoom } + private void startWaitingLoopPlayback() + { + stopWaitingLoopPlayback(); + + waitingLoopChannel = waitingLoopSample?.GetChannel(); + if (waitingLoopChannel == null) + return; + + waitingLoopChannel.Looping = true; + waitingLoopChannel?.Play(); + } + + private void stopWaitingLoopPlayback() + { + waitingLoopChannel?.Stop(); + waitingLoopChannel?.Dispose(); + } + private partial class BeginQueueingButton : SelectionButton { public readonly IBindable SelectedPool = new Bindable(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6457d1cccd..ea0ce9a92c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ - +