mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +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;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
|
using osu.Game.Screens.Ranking.Expanded.Accuracy;
|
||||||
using osu.Game.Screens.Ranking.Expanded.Statistics;
|
using osu.Game.Screens.Ranking.Expanded.Statistics;
|
||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -44,6 +46,9 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RealmAccess realm { get; set; }
|
private RealmAccess realm { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private SkinManager skins { get; set; }
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -57,8 +62,17 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
if (beatmapInfo != null)
|
if (beatmapInfo != null)
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
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]
|
[Test]
|
||||||
public void TestScaling()
|
public void TestScaling()
|
||||||
{
|
{
|
||||||
@ -132,6 +146,46 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
|
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]
|
[Test]
|
||||||
public void TestShowHideStatisticsViaOutsideClick()
|
public void TestShowHideStatisticsViaOutsideClick()
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -259,10 +260,15 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|||||||
if (isFailedSDueToMisses)
|
if (isFailedSDueToMisses)
|
||||||
AddInternal(failedSRankText = new RankText(ScoreRank.S));
|
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[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)),
|
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")),
|
scoreTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/score-tick")),
|
||||||
badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")),
|
badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")),
|
||||||
badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")),
|
badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")),
|
||||||
@ -351,24 +357,28 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|||||||
|
|
||||||
int badgeNum = 0;
|
int badgeNum = 0;
|
||||||
|
|
||||||
foreach (var badge in badges)
|
if (score.Rank != ScoreRank.F)
|
||||||
{
|
{
|
||||||
if (badge.Accuracy > score.Accuracy)
|
foreach (var badge in badges)
|
||||||
continue;
|
|
||||||
|
|
||||||
using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(accuracyX - virtual_ss_percentage, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION))
|
|
||||||
{
|
{
|
||||||
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(() =>
|
badge.Appear();
|
||||||
{
|
|
||||||
var dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound;
|
|
||||||
|
|
||||||
dink.FrequencyTo(1 + badgeNum++ * 0.05);
|
if (withFlair)
|
||||||
dink.Play();
|
{
|
||||||
});
|
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