mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:03:08 +08:00
Merge pull request #19372 from frenzibyte/more-unprocessed-pp-handling
Update more places to support displaying unprocessed PP placeholder
This commit is contained in:
commit
3c12b357e6
@ -141,6 +141,19 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddUntilStep("best score not displayed", () => scoresContainer.ChildrenOfType<DrawableTopScore>().Count() == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUnprocessedPP()
|
||||
{
|
||||
AddStep("Load scores with unprocessed PP", () =>
|
||||
{
|
||||
var allScores = createScores();
|
||||
allScores.Scores[0].PP = null;
|
||||
allScores.UserScore = createUserBest();
|
||||
allScores.UserScore.Score.PP = null;
|
||||
scoresContainer.Scores = allScores;
|
||||
});
|
||||
}
|
||||
|
||||
private int onlineID = 1;
|
||||
|
||||
private APIScoresCollection createScores()
|
||||
@ -210,7 +223,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
new APIMod { Acronym = new OsuModHidden().Acronym },
|
||||
},
|
||||
Rank = ScoreRank.B,
|
||||
PP = null,
|
||||
PP = 180,
|
||||
MaxCombo = 1234,
|
||||
TotalScore = 12345678,
|
||||
Accuracy = 0.9854,
|
||||
|
@ -7,6 +7,7 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
@ -99,6 +100,23 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Accuracy = 0.55879
|
||||
};
|
||||
|
||||
var unprocessedPPScore = new SoloScoreInfo
|
||||
{
|
||||
Rank = ScoreRank.B,
|
||||
Beatmap = new APIBeatmap
|
||||
{
|
||||
BeatmapSet = new APIBeatmapSet
|
||||
{
|
||||
Title = "C18H27NO3(extend)",
|
||||
Artist = "Team Grimoire",
|
||||
},
|
||||
DifficultyName = "[4K] Cataclysmic Hypernova",
|
||||
Status = BeatmapOnlineStatus.Ranked,
|
||||
},
|
||||
EndedAt = DateTimeOffset.Now,
|
||||
Accuracy = 0.55879
|
||||
};
|
||||
|
||||
Add(new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
@ -112,6 +130,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(firstScore)),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(secondScore)),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileScore(noPPScore)),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileScore(unprocessedPPScore)),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(firstScore, 0.97)),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(secondScore, 0.85)),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(thirdScore, 0.66)),
|
||||
|
@ -23,8 +23,8 @@ using osuTK.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osu.Game.Scoring.Drawables;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
@ -182,7 +182,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
if (score.PP != null)
|
||||
content.Add(new StatisticText(score.PP, format: @"N0"));
|
||||
else
|
||||
content.Add(new ProcessingPPIcon());
|
||||
content.Add(new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(text_size) });
|
||||
}
|
||||
|
||||
content.Add(new ScoreboardTime(score.Date, text_size)
|
||||
@ -247,18 +247,5 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
Colour = colours.GreenLight;
|
||||
}
|
||||
}
|
||||
|
||||
private class ProcessingPPIcon : SpriteIcon, IHasTooltip
|
||||
{
|
||||
public LocalisableString TooltipText => ScoresStrings.StatusProcessing;
|
||||
|
||||
public ProcessingPPIcon()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
Size = new Vector2(text_size);
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,14 +12,17 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Scoring.Drawables;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
@ -121,7 +124,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
maxComboColumn.Text = value.MaxCombo.ToLocalisableString(@"0\x");
|
||||
|
||||
ppColumn.Alpha = value.BeatmapInfo.Status.GrantsPerformancePoints() ? 1 : 0;
|
||||
ppColumn.Text = value.PP?.ToLocalisableString(@"N0") ?? default;
|
||||
|
||||
if (value.PP is double pp)
|
||||
ppColumn.Text = pp.ToLocalisableString(@"N0");
|
||||
else
|
||||
ppColumn.Drawable = new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(smallFont.Size) };
|
||||
|
||||
statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn);
|
||||
modsColumn.Mods = value.Mods;
|
||||
@ -197,30 +204,48 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
}
|
||||
}
|
||||
|
||||
private class TextColumn : InfoColumn
|
||||
private class TextColumn : InfoColumn, IHasCurrentValue<string>
|
||||
{
|
||||
private readonly SpriteText text;
|
||||
|
||||
public TextColumn(LocalisableString title, FontUsage font, float? minWidth = null)
|
||||
: this(title, new OsuSpriteText { Font = font }, minWidth)
|
||||
{
|
||||
}
|
||||
|
||||
private TextColumn(LocalisableString title, SpriteText text, float? minWidth = null)
|
||||
: base(title, text, minWidth)
|
||||
{
|
||||
this.text = text;
|
||||
}
|
||||
private readonly OsuTextFlowContainer text;
|
||||
|
||||
public LocalisableString Text
|
||||
{
|
||||
set => text.Text = value;
|
||||
}
|
||||
|
||||
public Drawable Drawable
|
||||
{
|
||||
set
|
||||
{
|
||||
text.Clear();
|
||||
text.AddArbitraryDrawable(value);
|
||||
}
|
||||
}
|
||||
|
||||
private Bindable<string> current;
|
||||
|
||||
public Bindable<string> Current
|
||||
{
|
||||
get => text.Current;
|
||||
set => text.Current = value;
|
||||
get => current;
|
||||
set
|
||||
{
|
||||
text.Clear();
|
||||
text.AddText(value.Value, t => t.Current = current = value);
|
||||
}
|
||||
}
|
||||
|
||||
public TextColumn(LocalisableString title, FontUsage font, float? minWidth = null)
|
||||
: this(title, new OsuTextFlowContainer(t => t.Font = font)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both
|
||||
}, minWidth)
|
||||
{
|
||||
}
|
||||
|
||||
private TextColumn(LocalisableString title, OsuTextFlowContainer text, float? minWidth = null)
|
||||
: base(title, text, minWidth)
|
||||
{
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Scoring.Drawables;
|
||||
using osu.Game.Utils;
|
||||
using osuTK;
|
||||
|
||||
@ -218,39 +219,42 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
|
||||
private Drawable createDrawablePerformance()
|
||||
{
|
||||
if (Score.PP.HasValue)
|
||||
if (!Score.PP.HasValue)
|
||||
{
|
||||
return new FillFlowContainer
|
||||
if (Score.Beatmap?.Status.GrantsPerformancePoints() == true)
|
||||
return new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(16), Colour = colourProvider.Highlight1 };
|
||||
|
||||
return new OsuSpriteText
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
Text = $"{Score.PP:0}",
|
||||
Colour = colourProvider.Highlight1
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||
Text = "pp",
|
||||
Colour = colourProvider.Light3
|
||||
}
|
||||
}
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
Text = "-",
|
||||
Colour = colourProvider.Highlight1
|
||||
};
|
||||
}
|
||||
|
||||
return new OsuSpriteText
|
||||
return new FillFlowContainer
|
||||
{
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
Text = "-",
|
||||
Colour = colourProvider.Highlight1
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
Text = $"{Score.PP:0}",
|
||||
Colour = colourProvider.Highlight1
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||
Text = "pp",
|
||||
Colour = colourProvider.Light3
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -42,12 +42,11 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
CreateDrawableAccuracy(),
|
||||
new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 50,
|
||||
Size = new Vector2(50, 14),
|
||||
Child = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
||||
Text = $"{Score.PP * weight:0}pp",
|
||||
Text = Score.PP.HasValue ? $"{Score.PP * weight:0}pp" : string.Empty,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
|
||||
namespace osu.Game.Scoring.Drawables
|
||||
{
|
||||
/// <summary>
|
||||
/// A placeholder used in PP columns for scores with unprocessed PP value.
|
||||
/// </summary>
|
||||
public class UnprocessedPerformancePointsPlaceholder : SpriteIcon, IHasTooltip
|
||||
{
|
||||
public LocalisableString TooltipText => ScoresStrings.StatusProcessing;
|
||||
|
||||
public UnprocessedPerformancePointsPlaceholder()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user