mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 05:22:54 +08:00
Add scrolling to the extended statistics panel
This commit is contained in:
parent
3ba5d88914
commit
5e3d124eef
@ -10,6 +10,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.Placeholders;
|
using osu.Game.Online.Placeholders;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
@ -85,15 +86,21 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
playableBeatmap = beatmapManager.GetWorkingBeatmap(newScore.BeatmapInfo).GetPlayableBeatmap(newScore.Ruleset, newScore.Mods);
|
playableBeatmap = beatmapManager.GetWorkingBeatmap(newScore.BeatmapInfo).GetPlayableBeatmap(newScore.Ruleset, newScore.Mods);
|
||||||
}, loadCancellation.Token).ContinueWith(t => Schedule(() =>
|
}, loadCancellation.Token).ContinueWith(t => Schedule(() =>
|
||||||
{
|
{
|
||||||
var rows = new FillFlowContainer
|
FillFlowContainer rows;
|
||||||
|
Container<Drawable> container = new OsuScrollContainer(Direction.Vertical)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.Both,
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Direction = FillDirection.Vertical,
|
Alpha = 0,
|
||||||
Spacing = new Vector2(30, 15),
|
Children = new[]
|
||||||
Alpha = 0
|
{
|
||||||
|
rows = new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool panelIsEmpty = true;
|
bool panelIsEmpty = true;
|
||||||
@ -107,6 +114,8 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
|
|
||||||
if (columnsToDisplay?.Any() ?? false)
|
if (columnsToDisplay?.Any() ?? false)
|
||||||
panelIsEmpty = false;
|
panelIsEmpty = false;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
rows.Add(new GridContainer
|
rows.Add(new GridContainer
|
||||||
{
|
{
|
||||||
@ -114,6 +123,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Margin = new MarginPadding { Bottom = 15 },
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
columnsToDisplay?.Select(c => new StatisticContainer(c)
|
columnsToDisplay?.Select(c => new StatisticContainer(c)
|
||||||
@ -130,27 +140,51 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
|
|
||||||
if (!hitEventsAvailable)
|
if (!hitEventsAvailable)
|
||||||
{
|
{
|
||||||
rows.Add(new FillFlowContainer
|
if (panelIsEmpty)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
// Replace the scroll container with fill flow container to get the message centered.
|
||||||
AutoSizeAxes = Axes.Y,
|
container = new FillFlowContainer
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new MessagePlaceholder(panelIsEmpty
|
RelativeSizeAxes = Axes.Both,
|
||||||
? "Extended statistics are only available after watching a replay!"
|
Anchor = Anchor.Centre,
|
||||||
: "More statistics available after watching a replay!"),
|
Origin = Anchor.Centre,
|
||||||
new ReplayDownloadButton(newScore)
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Scale = new Vector2(1.5f),
|
new MessagePlaceholder("Extended statistics are only available after watching a replay!"),
|
||||||
Anchor = Anchor.Centre,
|
new ReplayDownloadButton(newScore)
|
||||||
Origin = Anchor.Centre,
|
{
|
||||||
},
|
Scale = new Vector2(1.5f),
|
||||||
}
|
Anchor = Anchor.Centre,
|
||||||
});
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rows.Add(new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new MessagePlaceholder("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(container, d =>
|
||||||
{
|
{
|
||||||
if (!Score.Value.Equals(newScore))
|
if (!Score.Value.Equals(newScore))
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user