1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 18:19:54 +08:00

Merge pull request #35185 from nekodex/matchmaking-more-sfx

Yet more matchmaking SFX work
This commit is contained in:
Dean Herbert
2025-10-06 18:04:22 +09:00
committed by GitHub
Unverified
6 changed files with 93 additions and 17 deletions
+1 -1
View File
@@ -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,
@@ -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(() =>
@@ -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);
@@ -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()
@@ -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<RulesetInfo> ruleset { get; set; } = null!;
[Resolved]
private MusicController musicController { get; set; } = null!;
private readonly IBindable<MatchmakingScreenState> currentState = new Bindable<MatchmakingScreenState>();
private readonly Bindable<MatchmakingPool[]> availablePools = new Bindable<MatchmakingPool[]>();
@@ -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<MatchmakingPool?> SelectedPool = new Bindable<MatchmakingPool?>();
+1 -1
View File
@@ -36,7 +36,7 @@
</PackageReference>
<PackageReference Include="Realm" Version="20.1.0" />
<PackageReference Include="ppy.osu.Framework" Version="2025.930.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2025.1001.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2025.1006.0" />
<PackageReference Include="Sentry" Version="5.1.1" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
<PackageReference Include="SharpCompress" Version="0.39.0" />