mirror of
https://github.com/osukey/osukey.git
synced 2025-05-08 07:07:18 +09: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)
|
if (newScore == null)
|
||||||
return;
|
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();
|
spinner.Show();
|
||||||
|
|
||||||
var localCancellationSource = loadCancellation = new CancellationTokenSource();
|
var localCancellationSource = loadCancellation = new CancellationTokenSource();
|
||||||
@ -116,11 +96,17 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
Alpha = 0
|
Alpha = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool panelIsEmpty = true;
|
||||||
|
bool hitEventsAvailable = newScore.HitEvents.Count != 0;
|
||||||
|
|
||||||
foreach (var row in newScore.Ruleset.CreateInstance().CreateStatisticsForScore(newScore, playableBeatmap))
|
foreach (var row in newScore.Ruleset.CreateInstance().CreateStatisticsForScore(newScore, playableBeatmap))
|
||||||
{
|
{
|
||||||
var columnsToDisplay = newScore.HitEvents.Count == 0
|
var columnsToDisplay = hitEventsAvailable
|
||||||
? row.Columns?.Where(c => !c.RequiresHitEvents).ToArray()
|
? row.Columns
|
||||||
: row.Columns;
|
: row.Columns?.Where(c => !c.RequiresHitEvents).ToArray();
|
||||||
|
|
||||||
|
if (columnsToDisplay?.Any() ?? false)
|
||||||
|
panelIsEmpty = false;
|
||||||
|
|
||||||
rows.Add(new GridContainer
|
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 =>
|
LoadComponentAsync(rows, d =>
|
||||||
{
|
{
|
||||||
if (!Score.Value.Equals(newScore))
|
if (!Score.Value.Equals(newScore))
|
||||||
@ -153,7 +161,6 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
}, localCancellationSource.Token);
|
}, localCancellationSource.Token);
|
||||||
}), localCancellationSource.Token);
|
}), localCancellationSource.Token);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user