mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Merge pull request #26733 from frenzibyte/fix-results-f-rank
Fix results screen not handling F ranks properly
This commit is contained in:
commit
80fc21f645
@ -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();
|
||||
@ -57,8 +62,17 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
if (beatmapInfo != null)
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
||||
});
|
||||
|
||||
AddToggleStep("toggle legacy classic skin", v =>
|
||||
{
|
||||
if (skins != null)
|
||||
skins.CurrentSkinInfo.Value = v ? skins.DefaultClassicSkin.SkinInfo : skins.CurrentSkinInfo.Default;
|
||||
});
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() => skins.CurrentSkinInfo.SetDefault());
|
||||
|
||||
[Test]
|
||||
public void TestScaling()
|
||||
{
|
||||
@ -132,6 +146,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<RankBadge>().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<RankBadge>().All(b => !b.IsPresent));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShowHideStatisticsViaOutsideClick()
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -259,10 +260,15 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
||||
if (isFailedSDueToMisses)
|
||||
AddInternal(failedSRankText = new RankText(ScoreRank.S));
|
||||
|
||||
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[]
|
||||
{
|
||||
rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)),
|
||||
rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", applauseSampleName)),
|
||||
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")),
|
||||
@ -351,24 +357,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();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user