mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 14:42:56 +08:00
Merge pull request #31742 from smoogipoo/fix-results-persistent-sounds
Fix results screen sounds persisting after exit
This commit is contained in:
commit
b9f840c32e
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -91,6 +90,9 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|||||||
|
|
||||||
private readonly ScoreInfo score;
|
private readonly ScoreInfo score;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private ResultsScreen? resultsScreen { get; set; }
|
||||||
|
|
||||||
private CircularProgress accuracyCircle = null!;
|
private CircularProgress accuracyCircle = null!;
|
||||||
private GradedCircles gradedCircles = null!;
|
private GradedCircles gradedCircles = null!;
|
||||||
private Container<RankBadge> badges = null!;
|
private Container<RankBadge> badges = null!;
|
||||||
@ -101,7 +103,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|||||||
private PoolableSkinnableSample? badgeMaxSound;
|
private PoolableSkinnableSample? badgeMaxSound;
|
||||||
private PoolableSkinnableSample? swooshUpSound;
|
private PoolableSkinnableSample? swooshUpSound;
|
||||||
private PoolableSkinnableSample? rankImpactSound;
|
private PoolableSkinnableSample? rankImpactSound;
|
||||||
private PoolableSkinnableSample? rankApplauseSound;
|
|
||||||
|
|
||||||
private readonly Bindable<double> tickPlaybackRate = new Bindable<double>();
|
private readonly Bindable<double> tickPlaybackRate = new Bindable<double>();
|
||||||
|
|
||||||
@ -197,15 +198,9 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|||||||
|
|
||||||
if (withFlair)
|
if (withFlair)
|
||||||
{
|
{
|
||||||
var applauseSamples = new List<string> { applauseSampleName };
|
|
||||||
if (score.Rank >= ScoreRank.B)
|
|
||||||
// when rank is B or higher, play legacy applause sample on legacy skins.
|
|
||||||
applauseSamples.Insert(0, @"applause");
|
|
||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)),
|
rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)),
|
||||||
rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(applauseSamples.ToArray())),
|
|
||||||
scoreTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/score-tick")),
|
scoreTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/score-tick")),
|
||||||
badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")),
|
badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")),
|
||||||
badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")),
|
badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")),
|
||||||
@ -333,16 +328,9 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|||||||
});
|
});
|
||||||
|
|
||||||
const double applause_pre_delay = 545f;
|
const double applause_pre_delay = 545f;
|
||||||
const double applause_volume = 0.8f;
|
|
||||||
|
|
||||||
using (BeginDelayedSequence(applause_pre_delay))
|
using (BeginDelayedSequence(applause_pre_delay))
|
||||||
{
|
Schedule(() => resultsScreen?.PlayApplause(score.Rank));
|
||||||
Schedule(() =>
|
|
||||||
{
|
|
||||||
rankApplauseSound!.VolumeTo(applause_volume);
|
|
||||||
rankApplauseSound!.Play();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,34 +372,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string applauseSampleName
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
switch (score.Rank)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case ScoreRank.D:
|
|
||||||
return @"Results/applause-d";
|
|
||||||
|
|
||||||
case ScoreRank.C:
|
|
||||||
return @"Results/applause-c";
|
|
||||||
|
|
||||||
case ScoreRank.B:
|
|
||||||
return @"Results/applause-b";
|
|
||||||
|
|
||||||
case ScoreRank.A:
|
|
||||||
return @"Results/applause-a";
|
|
||||||
|
|
||||||
case ScoreRank.S:
|
|
||||||
case ScoreRank.SH:
|
|
||||||
case ScoreRank.X:
|
|
||||||
case ScoreRank.XH:
|
|
||||||
return @"Results/applause-s";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string impactSampleName
|
private string impactSampleName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -17,6 +17,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Audio;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -29,10 +30,12 @@ using osu.Game.Scoring;
|
|||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Ranking.Expanded.Accuracy;
|
using osu.Game.Screens.Ranking.Expanded.Accuracy;
|
||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Ranking
|
namespace osu.Game.Screens.Ranking
|
||||||
{
|
{
|
||||||
|
[Cached]
|
||||||
public abstract partial class ResultsScreen : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>
|
public abstract partial class ResultsScreen : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
protected const float BACKGROUND_BLUR = 20;
|
protected const float BACKGROUND_BLUR = 20;
|
||||||
@ -263,6 +266,64 @@ namespace osu.Game.Screens.Ranking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Applause
|
||||||
|
|
||||||
|
private PoolableSkinnableSample? rankApplauseSound;
|
||||||
|
|
||||||
|
public void PlayApplause(ScoreRank rank)
|
||||||
|
{
|
||||||
|
const double applause_volume = 0.8f;
|
||||||
|
|
||||||
|
if (!this.IsCurrentScreen())
|
||||||
|
return;
|
||||||
|
|
||||||
|
rankApplauseSound?.Dispose();
|
||||||
|
|
||||||
|
var applauseSamples = new List<string>();
|
||||||
|
|
||||||
|
if (rank >= ScoreRank.B)
|
||||||
|
// when rank is B or higher, play legacy applause sample on legacy skins.
|
||||||
|
applauseSamples.Insert(0, @"applause");
|
||||||
|
|
||||||
|
switch (rank)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case ScoreRank.D:
|
||||||
|
applauseSamples.Add(@"Results/applause-d");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ScoreRank.C:
|
||||||
|
applauseSamples.Add(@"Results/applause-c");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ScoreRank.B:
|
||||||
|
applauseSamples.Add(@"Results/applause-b");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ScoreRank.A:
|
||||||
|
applauseSamples.Add(@"Results/applause-a");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ScoreRank.S:
|
||||||
|
case ScoreRank.SH:
|
||||||
|
case ScoreRank.X:
|
||||||
|
case ScoreRank.XH:
|
||||||
|
applauseSamples.Add(@"Results/applause-s");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadComponentAsync(rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(applauseSamples.ToArray())), s =>
|
||||||
|
{
|
||||||
|
if (!this.IsCurrentScreen() || s != rankApplauseSound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
rankApplauseSound.VolumeTo(applause_volume);
|
||||||
|
rankApplauseSound.Play();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a fetch/refresh of scores to be displayed.
|
/// Performs a fetch/refresh of scores to be displayed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -330,6 +391,8 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
if (!skipExitTransition)
|
if (!skipExitTransition)
|
||||||
this.FadeOut(100);
|
this.FadeOut(100);
|
||||||
|
|
||||||
|
rankApplauseSound?.Stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user