Update download progress bar appearance to match intended design

This commit is contained in:
Bartłomiej Dach
2021-11-10 18:38:52 +01:00
parent 91baaa73f3
commit 222846290e
2 changed files with 63 additions and 40 deletions

View File

@ -210,15 +210,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
d.AddText("mapped by ", t => t.Colour = colourProvider.Content2); d.AddText("mapped by ", t => t.Colour = colourProvider.Content2);
d.AddUserLink(beatmapSet.Author); d.AddUserLink(beatmapSet.Author);
}), }),
statisticsContainer = new FillFlowContainer<BeatmapCardStatistic>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Alpha = 0,
ChildrenEnumerable = createStatistics()
}
} }
}, },
new Container new Container
@ -228,44 +219,63 @@ namespace osu.Game.Beatmaps.Drawables.Cards
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Padding = new MarginPadding
{
Horizontal = 10,
Vertical = 4
},
Children = new Drawable[] Children = new Drawable[]
{ {
idleBottomContent = new FillFlowContainer idleBottomContent = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal, Direction = FillDirection.Vertical,
Padding = new MarginPadding Spacing = new Vector2(0, 3),
{ AlwaysPresent = true,
Horizontal = 10,
Vertical = 4
},
Spacing = new Vector2(4, 0),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Children = new Drawable[] Children = new Drawable[]
{ {
new BeatmapSetOnlineStatusPill statisticsContainer = new FillFlowContainer<BeatmapCardStatistic>
{ {
AutoSizeAxes = Axes.Both, RelativeSizeAxes = Axes.X,
Status = beatmapSet.Status, AutoSizeAxes = Axes.Y,
Anchor = Anchor.CentreLeft, Direction = FillDirection.Horizontal,
Origin = Anchor.CentreLeft Spacing = new Vector2(10, 0),
Alpha = 0,
AlwaysPresent = true,
ChildrenEnumerable = createStatistics()
}, },
new DifficultySpectrumDisplay(beatmapSet) new FillFlowContainer
{ {
Anchor = Anchor.CentreLeft, RelativeSizeAxes = Axes.X,
Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Y,
DotSize = new Vector2(6, 12) Direction = FillDirection.Horizontal,
Spacing = new Vector2(4, 0),
Children = new Drawable[]
{
new BeatmapSetOnlineStatusPill
{
AutoSizeAxes = Axes.Both,
Status = beatmapSet.Status,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft
},
new DifficultySpectrumDisplay(beatmapSet)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
DotSize = new Vector2(6, 12)
}
}
} }
} }
}, },
downloadProgressBar = new BeatmapCardDownloadProgressBar(beatmapSet) downloadProgressBar = new BeatmapCardDownloadProgressBar(beatmapSet)
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 0, Height = 6,
Anchor = Anchor.BottomLeft, Anchor = Anchor.Centre,
Origin = Anchor.BottomLeft Origin = Anchor.Centre
} }
} }
} }
@ -358,7 +368,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
rightButtonArea.FadeTo(IsHovered ? 1 : 0, TRANSITION_DURATION, Easing.OutQuint); rightButtonArea.FadeTo(IsHovered ? 1 : 0, TRANSITION_DURATION, Easing.OutQuint);
idleBottomContent.FadeTo(downloadProgressBar.IsActive.Value ? 0 : 1, TRANSITION_DURATION, Easing.OutQuint); idleBottomContent.FadeTo(downloadProgressBar.IsActive.Value ? 0 : 1, TRANSITION_DURATION, Easing.OutQuint);
downloadProgressBar.ResizeHeightTo(downloadProgressBar.IsActive.Value ? 8 : 0, TRANSITION_DURATION, Easing.OutQuint); downloadProgressBar.FadeTo(downloadProgressBar.IsActive.Value ? 1 : 0, TRANSITION_DURATION, Easing.OutQuint);
} }
} }
} }

View File

@ -21,8 +21,11 @@ namespace osu.Game.Beatmaps.Drawables.Cards
public override bool IsPresent => true; public override bool IsPresent => true;
private readonly BeatmapDownloadTracker tracker; private readonly BeatmapDownloadTracker tracker;
private readonly Box background; private readonly CircularContainer background;
private readonly Box foreground; private readonly CircularContainer foreground;
private readonly Box backgroundFill;
private readonly Box foregroundFill;
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -35,13 +38,23 @@ namespace osu.Game.Beatmaps.Drawables.Cards
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
tracker = new BeatmapDownloadTracker(beatmapSet), tracker = new BeatmapDownloadTracker(beatmapSet),
background = new Box background = new CircularContainer
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both,
Masking = true,
Child = backgroundFill = new Box
{
RelativeSizeAxes = Axes.Both,
}
}, },
foreground = new Box foreground = new CircularContainer
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both,
Masking = true,
Child = foregroundFill = new Box
{
RelativeSizeAxes = Axes.Both,
}
} }
}; };
} }
@ -49,7 +62,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
background.Colour = colourProvider.Background6; backgroundFill.Colour = colourProvider.Background6;
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -66,12 +79,12 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{ {
case DownloadState.Downloading: case DownloadState.Downloading:
FinishTransforms(true); FinishTransforms(true);
foreground.Colour = colourProvider.Highlight1; foregroundFill.Colour = colourProvider.Highlight1;
isActive.Value = true; isActive.Value = true;
break; break;
case DownloadState.Importing: case DownloadState.Importing:
foreground.FadeColour(colours.Yellow, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint); foregroundFill.FadeColour(colours.Yellow, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
isActive.Value = true; isActive.Value = true;
break; break;