1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 01:32:55 +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)
{ {
@ -252,52 +254,62 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
if (sfxEnabled) if (sfxEnabled)
{ {
tickPlaybackRate = new Bindable<double>(sfx_score_tick_debounce_rate_start); Drawable legacySkinApplause = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.Applause));
switch (score.Rank) if (legacySkinApplause != null)
{ {
case ScoreRank.D: AddInternal(legacySkinApplause);
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_D)) as DrawableSample; legacySkinApplauseSound = legacySkinApplause as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_D)) as DrawableSample;
break;
case ScoreRank.C:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_C)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_C)) as DrawableSample;
break;
case ScoreRank.B:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_B)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_B)) as DrawableSample;
break;
case ScoreRank.A:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_A)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_A)) as DrawableSample;
break;
case ScoreRank.S:
case ScoreRank.SH:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_S)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_S)) as DrawableSample;
break;
case ScoreRank.X:
case ScoreRank.XH:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_SS)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_SS)) as DrawableSample;
break;
} }
else
AddRangeInternal(new Drawable[]
{ {
rankImpactSound, tickPlaybackRate = new Bindable<double>(sfx_score_tick_debounce_rate_start);
rankApplauseSound,
scoreTickSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultScoreTick)) as DrawableSample, switch (score.Rank)
badgeTickSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultBadgeTick)) as DrawableSample, {
badgeMaxSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultBadgeTickMax)) as DrawableSample, case ScoreRank.D:
swooshUpSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultSwooshUp)) as DrawableSample rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_D)) as DrawableSample;
}); rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_D)) as DrawableSample;
break;
case ScoreRank.C:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_C)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_C)) as DrawableSample;
break;
case ScoreRank.B:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_B)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_B)) as DrawableSample;
break;
case ScoreRank.A:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_A)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_A)) as DrawableSample;
break;
case ScoreRank.S:
case ScoreRank.SH:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_S)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_S)) as DrawableSample;
break;
case ScoreRank.X:
case ScoreRank.XH:
rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultRank_SS)) as DrawableSample;
rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultApplause_SS)) as DrawableSample;
break;
}
AddRangeInternal(new Drawable[]
{
rankImpactSound,
rankApplauseSound,
scoreTickSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultScoreTick)) as DrawableSample,
badgeTickSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultBadgeTick)) as DrawableSample,
badgeMaxSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultBadgeTickMax)) as DrawableSample,
swooshUpSound = skin.GetDrawableComponent(new GameplaySkinComponent<GameplaySkinSamples>(GameplaySkinSamples.ResultSwooshUp)) as DrawableSample
});
}
} }
} }
@ -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;