mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 17:17:24 +08:00
Move beatmap/difficulty change sample playback to outside of debounce
This commit is contained in:
parent
8d0f5b0d82
commit
5f462b6441
@ -435,6 +435,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
||||||
|
private BeatmapInfo beatmapInfoPrevious;
|
||||||
private BeatmapInfo beatmapInfoNoDebounce;
|
private BeatmapInfo beatmapInfoNoDebounce;
|
||||||
private RulesetInfo rulesetNoDebounce;
|
private RulesetInfo rulesetNoDebounce;
|
||||||
|
|
||||||
@ -477,6 +478,19 @@ namespace osu.Game.Screens.Select
|
|||||||
else
|
else
|
||||||
selectionChangedDebounce = Scheduler.AddDelayed(run, 200);
|
selectionChangedDebounce = Scheduler.AddDelayed(run, 200);
|
||||||
|
|
||||||
|
if (beatmap != beatmapInfoPrevious)
|
||||||
|
{
|
||||||
|
if (beatmap != null && beatmapInfoPrevious != null)
|
||||||
|
{
|
||||||
|
if (beatmap.BeatmapSetInfoID == beatmapInfoPrevious.BeatmapSetInfoID)
|
||||||
|
sampleChangeDifficulty.Play();
|
||||||
|
else
|
||||||
|
sampleChangeBeatmap.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
beatmapInfoPrevious = beatmap;
|
||||||
|
}
|
||||||
|
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
// clear pending task immediately to track any potential nested debounce operation.
|
// clear pending task immediately to track any potential nested debounce operation.
|
||||||
@ -508,18 +522,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (!EqualityComparer<BeatmapInfo>.Default.Equals(beatmap, Beatmap.Value.BeatmapInfo))
|
if (!EqualityComparer<BeatmapInfo>.Default.Equals(beatmap, Beatmap.Value.BeatmapInfo))
|
||||||
{
|
{
|
||||||
Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\"");
|
Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\"");
|
||||||
|
|
||||||
int? lastSetID = Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
|
||||||
|
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap);
|
||||||
|
|
||||||
if (beatmap != null)
|
|
||||||
{
|
|
||||||
if (beatmap.BeatmapSetInfoID == lastSetID)
|
|
||||||
sampleChangeDifficulty.Play();
|
|
||||||
else
|
|
||||||
sampleChangeBeatmap.Play();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.IsCurrentScreen())
|
if (this.IsCurrentScreen())
|
||||||
|
Loading…
Reference in New Issue
Block a user