From 2ccd0e3692d66b9b1dcf29daa666a09a459d2fde Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 27 Jan 2024 01:45:22 +0300 Subject: [PATCH 1/8] Add visual and failing test cases --- .../Visual/Ranking/TestSceneResultsScreen.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs index 866e20d063..dbbfac75f7 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs @@ -26,8 +26,10 @@ using osu.Game.Scoring; using osu.Game.Screens; using osu.Game.Screens.Play; using osu.Game.Screens.Ranking; +using osu.Game.Screens.Ranking.Expanded.Accuracy; using osu.Game.Screens.Ranking.Expanded.Statistics; using osu.Game.Screens.Ranking.Statistics; +using osu.Game.Skinning; using osu.Game.Tests.Resources; using osuTK; using osuTK.Input; @@ -44,6 +46,9 @@ namespace osu.Game.Tests.Visual.Ranking [Resolved] private RealmAccess realm { get; set; } + [Resolved] + private SkinManager skins { get; set; } + protected override void LoadComplete() { base.LoadComplete(); @@ -59,6 +64,9 @@ namespace osu.Game.Tests.Visual.Ranking }); } + [SetUp] + public void SetUp() => Schedule(() => skins.CurrentSkinInfo.SetDefault()); + [Test] public void TestScaling() { @@ -132,6 +140,46 @@ namespace osu.Game.Tests.Visual.Ranking AddAssert("retry overlay present", () => screen.RetryOverlay != null); } + [Test] + public void TestResultsWithFailingRank() + { + TestResultsScreen screen = null; + + loadResultsScreen(() => + { + var score = TestResources.CreateTestScoreInfo(); + + score.OnlineID = onlineScoreID++; + score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents(); + score.Rank = ScoreRank.F; + return screen = createResultsScreen(score); + }); + AddUntilStep("wait for loaded", () => screen.IsLoaded); + AddAssert("retry overlay present", () => screen.RetryOverlay != null); + AddAssert("no badges displayed", () => this.ChildrenOfType().All(b => !b.IsPresent)); + } + + [Test] + public void TestResultsWithFailingRankOnLegacySkin() + { + TestResultsScreen screen = null; + + AddStep("set legacy skin", () => skins.CurrentSkinInfo.Value = skins.DefaultClassicSkin.SkinInfo); + + loadResultsScreen(() => + { + var score = TestResources.CreateTestScoreInfo(); + + score.OnlineID = onlineScoreID++; + score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents(); + score.Rank = ScoreRank.F; + return screen = createResultsScreen(score); + }); + AddUntilStep("wait for loaded", () => screen.IsLoaded); + AddAssert("retry overlay present", () => screen.RetryOverlay != null); + AddAssert("no badges displayed", () => this.ChildrenOfType().All(b => !b.IsPresent)); + } + [Test] public void TestShowHideStatisticsViaOutsideClick() { From 47f0b860186c720619b24df1ab0581bafb80b1a1 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 27 Jan 2024 01:46:12 +0300 Subject: [PATCH 2/8] Fix results screen showing other rank badges on F rank --- .../Expanded/Accuracy/AccuracyCircle.cs | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 0aff98df2b..8cec79ad90 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -351,24 +351,28 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy int badgeNum = 0; - foreach (var badge in badges) + if (score.Rank != ScoreRank.F) { - if (badge.Accuracy > score.Accuracy) - continue; - - using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(accuracyX - virtual_ss_percentage, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION)) + foreach (var badge in badges) { - badge.Appear(); + if (badge.Accuracy > score.Accuracy) + continue; - if (withFlair) + using (BeginDelayedSequence( + inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(accuracyX - virtual_ss_percentage, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION)) { - Schedule(() => - { - var dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound; + badge.Appear(); - dink.FrequencyTo(1 + badgeNum++ * 0.05); - dink.Play(); - }); + if (withFlair) + { + Schedule(() => + { + var dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound; + + dink.FrequencyTo(1 + badgeNum++ * 0.05); + dink.Play(); + }); + } } } } From d25262944ecd3a6a2d595b7ffc65c9cbb058e1f6 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 27 Jan 2024 01:46:43 +0300 Subject: [PATCH 3/8] Force results screen to play default D rank applause sound on fail (regardless of skin) --- .../Expanded/Accuracy/AccuracyCircle.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 8cec79ad90..60c35e6203 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -10,6 +10,7 @@ using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; @@ -98,6 +99,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private PoolableSkinnableSample swooshUpSound; private PoolableSkinnableSample rankImpactSound; private PoolableSkinnableSample rankApplauseSound; + private DrawableSample rankFailSound; private readonly Bindable tickPlaybackRate = new Bindable(); @@ -133,7 +135,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } [BackgroundDependencyLoader] - private void load() + private void load(AudioManager audio) { InternalChildren = new Drawable[] { @@ -267,6 +269,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")), badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")), swooshUpSound = new PoolableSkinnableSample(new SampleInfo(@"Results/swoosh-up")), + rankFailSound = new DrawableSample(audio.Samples.Get(results_applause_d_sound)), }); } } @@ -396,8 +399,16 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { Schedule(() => { - rankApplauseSound.VolumeTo(applause_volume); - rankApplauseSound.Play(); + if (score.Rank != ScoreRank.F) + { + rankApplauseSound.VolumeTo(applause_volume); + rankApplauseSound.Play(); + } + else + { + rankFailSound.VolumeTo(applause_volume); + rankFailSound.Play(); + } }); } } @@ -440,6 +451,8 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } } + private const string results_applause_d_sound = @"Results/applause-d"; + private string applauseSampleName { get @@ -448,7 +461,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { default: case ScoreRank.D: - return @"Results/applause-d"; + return results_applause_d_sound; case ScoreRank.C: return @"Results/applause-c"; From 5bbaeb6836cd9280f7e09d946192ba9e3ad69ddf Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 1 Feb 2024 16:08:33 +0300 Subject: [PATCH 4/8] Play legacy applause sound only when rank is B or higher --- .../Expanded/Accuracy/AccuracyCircle.cs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 60c35e6203..5de5ceb2a8 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -10,7 +10,6 @@ using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; @@ -86,6 +85,9 @@ 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; @@ -99,7 +101,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private PoolableSkinnableSample swooshUpSound; private PoolableSkinnableSample rankImpactSound; private PoolableSkinnableSample rankApplauseSound; - private DrawableSample rankFailSound; + private PoolableSkinnableSample rankLegacyApplauseSound; private readonly Bindable tickPlaybackRate = new Bindable(); @@ -264,12 +266,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy AddRangeInternal(new Drawable[] { rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)), - rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", applauseSampleName)), + rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(applauseSampleName)), + rankLegacyApplauseSound = new PoolableSkinnableSample(new SampleInfo("applause")), 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")), swooshUpSound = new PoolableSkinnableSample(new SampleInfo(@"Results/swoosh-up")), - rankFailSound = new DrawableSample(audio.Samples.Get(results_applause_d_sound)), }); } } @@ -399,15 +401,19 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { Schedule(() => { - if (score.Rank != ScoreRank.F) + if (skins.CurrentSkin.Value is LegacySkin) { - rankApplauseSound.VolumeTo(applause_volume); - rankApplauseSound.Play(); + // only play legacy "applause" sound if score rank is B or higher. + if (score.Rank >= ScoreRank.B) + { + rankLegacyApplauseSound.VolumeTo(applause_volume); + rankLegacyApplauseSound.Play(); + } } else { - rankFailSound.VolumeTo(applause_volume); - rankFailSound.Play(); + rankApplauseSound.VolumeTo(applause_volume); + rankApplauseSound.Play(); } }); } @@ -451,8 +457,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } } - private const string results_applause_d_sound = @"Results/applause-d"; - private string applauseSampleName { get @@ -461,7 +465,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { default: case ScoreRank.D: - return results_applause_d_sound; + return @"Results/applause-d"; case ScoreRank.C: return @"Results/applause-c"; From 6ab8960fdc630d4110734d206bd15c417b76d0f5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 1 Feb 2024 16:08:48 +0300 Subject: [PATCH 5/8] Add step for toggling skins in results screen test scene --- osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs index 122149be44..2bda242de2 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs @@ -62,6 +62,12 @@ namespace osu.Game.Tests.Visual.Ranking if (beatmapInfo != null) Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo); }); + + AddToggleStep("toggle skin", v => + { + if (skins != null) + skins.CurrentSkinInfo.Value = v ? skins.DefaultClassicSkin.SkinInfo : skins.CurrentSkinInfo.Default; + }); } [SetUp] From 4dbcb41dd1e8d46e2bdee4acc9c6f858f979dd79 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 2 Feb 2024 00:44:51 +0300 Subject: [PATCH 6/8] Remove unused parameter --- osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 5de5ceb2a8..e5ba9500ee 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -137,7 +137,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load() { InternalChildren = new Drawable[] { From 44a594ba05325bf28197c3727ef5813b36e4ad61 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 5 Feb 2024 01:03:04 +0300 Subject: [PATCH 7/8] 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(); }); } } From 989e46c791de8261a970901fc8732b087d254a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 5 Feb 2024 13:05:28 +0100 Subject: [PATCH 8/8] Use better test step name --- osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs index 2bda242de2..3f2b71b320 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs @@ -63,7 +63,7 @@ namespace osu.Game.Tests.Visual.Ranking Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo); }); - AddToggleStep("toggle skin", v => + AddToggleStep("toggle legacy classic skin", v => { if (skins != null) skins.CurrentSkinInfo.Value = v ? skins.DefaultClassicSkin.SkinInfo : skins.CurrentSkinInfo.Default;