1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:17:51 +08:00

Merge pull request #24134 from peppy/skin-retry-sound

Add support for skinnable "retry" sound
This commit is contained in:
Bartłomiej Dach 2023-07-08 15:24:26 +02:00 committed by GitHub
commit 84138849cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 14 deletions

View File

@ -11,8 +11,6 @@ using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
@ -114,8 +112,6 @@ namespace osu.Game.Screens.Play
private Ruleset ruleset;
private Sample sampleRestart;
public BreakOverlay BreakOverlay;
/// <summary>
@ -195,7 +191,7 @@ namespace osu.Game.Screens.Play
}
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game, CancellationToken cancellationToken)
private void load(OsuConfigManager config, OsuGameBase game, CancellationToken cancellationToken)
{
var gameplayMods = Mods.Value.Select(m => m.DeepClone()).ToArray();
@ -213,8 +209,6 @@ namespace osu.Game.Screens.Play
if (playableBeatmap == null)
return;
sampleRestart = audio.Samples.Get(@"Gameplay/restart");
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
if (game != null)
@ -295,14 +289,17 @@ namespace osu.Game.Screens.Play
if (Configuration.AllowRestart)
{
rulesetSkinProvider.Add(new HotkeyRetryOverlay
rulesetSkinProvider.AddRange(new Drawable[]
{
Action = () =>
new HotkeyRetryOverlay
{
if (!this.IsCurrentScreen()) return;
Action = () =>
{
if (!this.IsCurrentScreen()) return;
fadeOut(true);
Restart(true);
fadeOut(true);
Restart(true);
},
},
});
}
@ -673,7 +670,6 @@ namespace osu.Game.Screens.Play
// stopping here is to ensure music doesn't become audible after exiting back to PlayerLoader.
musicController.Stop();
sampleRestart?.Play();
RestartRequested?.Invoke(quickRestart);
PerformExit(false);

View File

@ -15,6 +15,7 @@ using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using osu.Framework.Screens;
using osu.Framework.Threading;
using osu.Game.Audio;
using osu.Game.Audio.Effects;
using osu.Game.Configuration;
using osu.Game.Graphics;
@ -25,6 +26,7 @@ using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play.PlayerSettings;
using osu.Game.Skinning;
using osu.Game.Users;
using osu.Game.Utils;
using osuTK;
@ -76,6 +78,8 @@ namespace osu.Game.Screens.Play
private AudioFilter lowPassFilter = null!;
private AudioFilter highPassFilter = null!;
private SkinnableSound sampleRestart = null!;
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
@ -199,7 +203,8 @@ namespace osu.Game.Screens.Play
},
idleTracker = new IdleTracker(750),
lowPassFilter = new AudioFilter(audio.TrackMixer),
highPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass)
highPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass),
sampleRestart = new SkinnableSound(new SampleInfo(@"Gameplay/restart", @"pause-retry-click"))
};
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
@ -265,6 +270,8 @@ namespace osu.Game.Screens.Play
playerConsumed = false;
cancelLoad();
sampleRestart.Play();
contentIn();
}