1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 21:25:36 +08:00

allow skinned 'applause' sample to override results screen sfx

This commit is contained in:
Jamie Taylor 2021-06-03 15:31:34 +09:00
parent 582360d0c8
commit 054de675ff
No known key found for this signature in database
GPG Key ID: 2ACFA8B6370B8C8C

View File

@ -116,12 +116,14 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
private DrawableSample swooshUpSound; private DrawableSample swooshUpSound;
private DrawableSample rankImpactSound; private DrawableSample rankImpactSound;
private DrawableSample rankApplauseSound; private DrawableSample rankApplauseSound;
private DrawableSample legacySkinApplauseSound;
private Bindable<double> tickPlaybackRate = new Bindable<double>(); private Bindable<double> tickPlaybackRate = new Bindable<double>();
private double lastTickPlaybackTime; private double lastTickPlaybackTime;
private bool isTicking; private bool isTicking;
private readonly bool sfxEnabled; private readonly bool sfxEnabled;
private bool legacySkin => legacySkinApplauseSound != null;
public AccuracyCircle(ScoreInfo score, bool sfxEnabled = false) public AccuracyCircle(ScoreInfo score, bool sfxEnabled = false)
{ {
@ -251,6 +253,15 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
}; };
if (sfxEnabled) if (sfxEnabled)
{
Drawable legacySkinApplause = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.Applause));
if (legacySkinApplause != null)
{
AddInternal(legacySkinApplause);
legacySkinApplauseSound = legacySkinApplause as DrawableSample;
}
else
{ {
tickPlaybackRate = new Bindable<double>(sfx_score_tick_debounce_rate_start); tickPlaybackRate = new Bindable<double>(sfx_score_tick_debounce_rate_start);
@ -300,6 +311,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
}); });
} }
} }
}
private ScoreRank getRank(ScoreRank rank) private ScoreRank getRank(ScoreRank rank)
{ {
@ -329,7 +341,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint); this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint);
if (sfxEnabled) if (sfxEnabled && !legacySkin)
{ {
this.Delay(sfx_swoosh_pre_delay).Schedule(() => this.Delay(sfx_swoosh_pre_delay).Schedule(() =>
{ {
@ -347,7 +359,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING);
if (sfxEnabled) if (sfxEnabled && !legacySkin)
{ {
Schedule(() => Schedule(() =>
{ {
@ -370,7 +382,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
{ {
badge.Appear(); badge.Appear();
if (sfxEnabled) if (sfxEnabled && !legacySkin)
{ {
Schedule(() => Schedule(() =>
{ {
@ -389,6 +401,10 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
if (!sfxEnabled) return; if (!sfxEnabled) return;
legacySkinApplauseSound?.Play();
if (legacySkin) return;
Schedule(() => Schedule(() =>
{ {
isTicking = false; isTicking = false;