From 44a594ba05325bf28197c3727ef5813b36e4ad61 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 5 Feb 2024 01:03:04 +0300 Subject: [PATCH] Simplify playback logic --- .../Expanded/Accuracy/AccuracyCircle.cs | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index e5ba9500ee..d209c305fa 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -4,6 +4,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -85,9 +86,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy /// public static readonly Easing ACCURACY_TRANSFORM_EASING = Easing.OutPow10; - [Resolved] - private SkinManager skins { get; set; } - private readonly ScoreInfo score; private CircularProgress accuracyCircle; @@ -101,7 +99,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private PoolableSkinnableSample swooshUpSound; private PoolableSkinnableSample rankImpactSound; private PoolableSkinnableSample rankApplauseSound; - private PoolableSkinnableSample rankLegacyApplauseSound; private readonly Bindable tickPlaybackRate = new Bindable(); @@ -263,11 +260,15 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (isFailedSDueToMisses) AddInternal(failedSRankText = new RankText(ScoreRank.S)); + var applauseSamples = new List { 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[] { rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)), - rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(applauseSampleName)), - rankLegacyApplauseSound = new PoolableSkinnableSample(new SampleInfo("applause")), + rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(applauseSamples.ToArray())), scoreTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/score-tick")), badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")), badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")), @@ -401,20 +402,8 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { Schedule(() => { - if (skins.CurrentSkin.Value is LegacySkin) - { - // only play legacy "applause" sound if score rank is B or higher. - if (score.Rank >= ScoreRank.B) - { - rankLegacyApplauseSound.VolumeTo(applause_volume); - rankLegacyApplauseSound.Play(); - } - } - else - { - rankApplauseSound.VolumeTo(applause_volume); - rankApplauseSound.Play(); - } + rankApplauseSound.VolumeTo(applause_volume); + rankApplauseSound.Play(); }); } }