1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Make results panels aware of whether they are a local score that has just been set

This commit is contained in:
Dean Herbert 2020-10-29 16:11:25 +09:00
parent c0960e60cb
commit 71e373ff51
7 changed files with 18 additions and 10 deletions

View File

@ -120,7 +120,7 @@ namespace osu.Game.Tests.Visual.Ranking
} }
} }
}, },
new AccuracyCircle(score) new AccuracyCircle(score, false)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -103,7 +103,7 @@ namespace osu.Game.Tests.Visual.Ranking
private void addPanelStep(ScoreInfo score, PanelState state = PanelState.Expanded) => AddStep("add panel", () => private void addPanelStep(ScoreInfo score, PanelState state = PanelState.Expanded) => AddStep("add panel", () =>
{ {
Child = panel = new ScorePanel(score) Child = panel = new ScorePanel(score, true)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -78,7 +78,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
private Container<RankBadge> badges; private Container<RankBadge> badges;
private RankText rankText; private RankText rankText;
public AccuracyCircle(ScoreInfo score) public AccuracyCircle(ScoreInfo score, bool withFlair)
{ {
this.score = score; this.score = score;
} }

View File

@ -29,6 +29,8 @@ namespace osu.Game.Screens.Ranking.Expanded
private const float padding = 10; private const float padding = 10;
private readonly ScoreInfo score; private readonly ScoreInfo score;
private readonly bool withFlair;
private readonly List<StatisticDisplay> statisticDisplays = new List<StatisticDisplay>(); private readonly List<StatisticDisplay> statisticDisplays = new List<StatisticDisplay>();
private FillFlowContainer starAndModDisplay; private FillFlowContainer starAndModDisplay;
@ -41,9 +43,11 @@ namespace osu.Game.Screens.Ranking.Expanded
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>. /// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
/// </summary> /// </summary>
/// <param name="score">The score to display.</param> /// <param name="score">The score to display.</param>
public ExpandedPanelMiddleContent(ScoreInfo score) /// <param name="withFlair">Whether to add flair for a new score being set.</param>
public ExpandedPanelMiddleContent(ScoreInfo score, bool withFlair = false)
{ {
this.score = score; this.score = score;
this.withFlair = withFlair;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Masking = true; Masking = true;
@ -116,7 +120,7 @@ namespace osu.Game.Screens.Ranking.Expanded
Margin = new MarginPadding { Top = 40 }, Margin = new MarginPadding { Top = 40 },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 230, Height = 230,
Child = new AccuracyCircle(score) Child = new AccuracyCircle(score, withFlair)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -149,7 +149,7 @@ namespace osu.Game.Screens.Ranking
}; };
if (Score != null) if (Score != null)
ScorePanelList.AddScore(Score); ScorePanelList.AddScore(Score, true);
if (player != null && allowRetry) if (player != null && allowRetry)
{ {

View File

@ -85,6 +85,8 @@ namespace osu.Game.Screens.Ranking
public readonly ScoreInfo Score; public readonly ScoreInfo Score;
private readonly bool isNewLocalScore;
private Container content; private Container content;
private Container topLayerContainer; private Container topLayerContainer;
@ -97,9 +99,10 @@ namespace osu.Game.Screens.Ranking
private Container middleLayerContentContainer; private Container middleLayerContentContainer;
private Drawable middleLayerContent; private Drawable middleLayerContent;
public ScorePanel(ScoreInfo score) public ScorePanel(ScoreInfo score, bool isNewLocalScore = false)
{ {
Score = score; Score = score;
this.isNewLocalScore = isNewLocalScore;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -209,7 +212,7 @@ namespace osu.Game.Screens.Ranking
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint); middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);
topLayerContentContainer.Add(topLayerContent = new ExpandedPanelTopContent(Score.User).With(d => d.Alpha = 0)); topLayerContentContainer.Add(topLayerContent = new ExpandedPanelTopContent(Score.User).With(d => d.Alpha = 0));
middleLayerContentContainer.Add(middleLayerContent = new ExpandedPanelMiddleContent(Score).With(d => d.Alpha = 0)); middleLayerContentContainer.Add(middleLayerContent = new ExpandedPanelMiddleContent(Score, isNewLocalScore).With(d => d.Alpha = 0));
break; break;
case PanelState.Contracted: case PanelState.Contracted:

View File

@ -95,9 +95,10 @@ namespace osu.Game.Screens.Ranking
/// Adds a <see cref="ScoreInfo"/> to this list. /// Adds a <see cref="ScoreInfo"/> to this list.
/// </summary> /// </summary>
/// <param name="score">The <see cref="ScoreInfo"/> to add.</param> /// <param name="score">The <see cref="ScoreInfo"/> to add.</param>
public ScorePanel AddScore(ScoreInfo score) /// <param name="isNewLocalScore">Whether this is a score that has just been achieved locally. Controls whether flair is added to the display or not.</param>
public ScorePanel AddScore(ScoreInfo score, bool isNewLocalScore = false)
{ {
var panel = new ScorePanel(score) var panel = new ScorePanel(score, isNewLocalScore)
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,