mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 19:43:22 +08:00
Update statistics item display logic
This commit is contained in:
parent
c5c4c85006
commit
3ba5d88914
@ -74,26 +74,6 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
if (newScore == null)
|
||||
return;
|
||||
|
||||
if (newScore.HitEvents.Count == 0)
|
||||
{
|
||||
content.Add(new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new MessagePlaceholder("Extended statistics are only available after watching a replay!"),
|
||||
new ReplayDownloadButton(newScore)
|
||||
{
|
||||
Scale = new Vector2(1.5f),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
spinner.Show();
|
||||
|
||||
var localCancellationSource = loadCancellation = new CancellationTokenSource();
|
||||
@ -116,11 +96,17 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
Alpha = 0
|
||||
};
|
||||
|
||||
bool panelIsEmpty = true;
|
||||
bool hitEventsAvailable = newScore.HitEvents.Count != 0;
|
||||
|
||||
foreach (var row in newScore.Ruleset.CreateInstance().CreateStatisticsForScore(newScore, playableBeatmap))
|
||||
{
|
||||
var columnsToDisplay = newScore.HitEvents.Count == 0
|
||||
? row.Columns?.Where(c => !c.RequiresHitEvents).ToArray()
|
||||
: row.Columns;
|
||||
var columnsToDisplay = hitEventsAvailable
|
||||
? row.Columns
|
||||
: row.Columns?.Where(c => !c.RequiresHitEvents).ToArray();
|
||||
|
||||
if (columnsToDisplay?.Any() ?? false)
|
||||
panelIsEmpty = false;
|
||||
|
||||
rows.Add(new GridContainer
|
||||
{
|
||||
@ -142,6 +128,28 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
});
|
||||
}
|
||||
|
||||
if (!hitEventsAvailable)
|
||||
{
|
||||
rows.Add(new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new MessagePlaceholder(panelIsEmpty
|
||||
? "Extended statistics are only available after watching a replay!"
|
||||
: "More statistics available after watching a replay!"),
|
||||
new ReplayDownloadButton(newScore)
|
||||
{
|
||||
Scale = new Vector2(1.5f),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
LoadComponentAsync(rows, d =>
|
||||
{
|
||||
if (!Score.Value.Equals(newScore))
|
||||
@ -153,7 +161,6 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
}, localCancellationSource.Token);
|
||||
}), localCancellationSource.Token);
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user