1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-21 23:51:01 +08:00

Merge pull request #27877 from bdach/fix-faded-pp-on-stable-scores

Fix stable scores showing with faded out pp display due to classic mod presence
This commit is contained in:
Dean Herbert
2024-04-15 18:21:21 +08:00
committed by GitHub
Unverified
2 changed files with 28 additions and 1 deletions
@@ -104,6 +104,21 @@ namespace osu.Game.Tests.Visual.Ranking
});
}
[Test]
public void TestPPNotShownAsProvisionalIfClassicModIsPresentDueToLegacyScore()
{
AddStep("show example score", () =>
{
var score = TestResources.CreateTestScoreInfo(createTestBeatmap(new RealmUser()));
score.PP = 400;
score.Mods = score.Mods.Append(new OsuModClassic()).ToArray();
score.IsLegacyScore = true;
showPanel(score);
});
AddAssert("pp display faded out", () => this.ChildrenOfType<PerformanceStatistic>().Single().Alpha == 1);
}
[Test]
public void TestWithDefaultDate()
{
@@ -4,6 +4,7 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -17,6 +18,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Scoring;
using osu.Game.Localisation;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Screens.Ranking.Expanded.Statistics
{
@@ -74,7 +76,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
Alpha = 0.5f;
TooltipText = ResultsScreenStrings.NoPPForUnrankedBeatmaps;
}
else if (scoreInfo.Mods.Any(m => !m.Ranked))
else if (hasUnrankedMods(scoreInfo))
{
Alpha = 0.5f;
TooltipText = ResultsScreenStrings.NoPPForUnrankedMods;
@@ -87,6 +89,16 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
}
}
private static bool hasUnrankedMods(ScoreInfo scoreInfo)
{
IEnumerable<Mod> modsToCheck = scoreInfo.Mods;
if (scoreInfo.IsLegacyScore)
modsToCheck = modsToCheck.Where(m => m is not ModClassic);
return modsToCheck.Any(m => !m.Ranked);
}
public override void Appear()
{
base.Appear();