Add top score section into beatmap detail area

This commit is contained in:
Andrei Zavatski 2019-07-14 13:33:47 +03:00
parent 922c3c89ae
commit d1409d4610
3 changed files with 42 additions and 30 deletions

View File

@ -163,6 +163,7 @@ namespace osu.Game.Tests.Visual.SongSelect
}); });
AddStep("null beatmap", () => detailsArea.Beatmap = null); AddStep("null beatmap", () => detailsArea.Beatmap = null);
AddStep("Toggle top score visibility", () => detailsArea.TopScore.ToggleVisibility());
} }
} }
} }

View File

@ -5,19 +5,18 @@ using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Screens.Select.Details;
using osu.Game.Screens.Select.Leaderboards; using osu.Game.Screens.Select.Leaderboards;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
public class BeatmapDetailArea : Container public class BeatmapDetailArea : Container
{ {
private const float details_padding = 10; private const float padding = 10;
private readonly Container content;
protected override Container<Drawable> Content => content;
public readonly BeatmapDetails Details; public readonly BeatmapDetails Details;
public readonly BeatmapLeaderboard Leaderboard; public readonly BeatmapLeaderboard Leaderboard;
public readonly UserTopScoreContainer TopScore;
private WorkingBeatmap beatmap; private WorkingBeatmap beatmap;
@ -34,7 +33,7 @@ namespace osu.Game.Screens.Select
public BeatmapDetailArea() public BeatmapDetailArea()
{ {
AddRangeInternal(new Drawable[] Children = new Drawable[]
{ {
new BeatmapDetailAreaTabControl new BeatmapDetailAreaTabControl
{ {
@ -58,33 +57,44 @@ namespace osu.Game.Screens.Select
} }
}, },
}, },
content = new Container new GridContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT }, Margin = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
RowDimensions = new Dimension[]
{
new Dimension(GridSizeMode.Distributed),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
Details = new BeatmapDetails
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
Padding = new MarginPadding { Vertical = padding },
},
Leaderboard = new BeatmapLeaderboard
{
RelativeSizeAxes = Axes.Both,
}
}
}
},
new Drawable[]
{
TopScore = new UserTopScoreContainer(),
}
},
}, },
}); };
AddRange(new Drawable[]
{
Details = new BeatmapDetails
{
RelativeSizeAxes = Axes.X,
Alpha = 0,
Margin = new MarginPadding { Top = details_padding },
},
Leaderboard = new BeatmapLeaderboard
{
RelativeSizeAxes = Axes.Both,
}
});
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
Details.Height = Math.Min(DrawHeight - details_padding * 3 - BeatmapDetailAreaTabControl.HEIGHT, 450);
} }
} }
} }

View File

@ -13,7 +13,7 @@ namespace osu.Game.Screens.Select.Details
{ {
public class UserTopScoreContainer : VisibilityContainer public class UserTopScoreContainer : VisibilityContainer
{ {
private const int height = 150; private const int height = 110;
private const int duration = 300; private const int duration = 300;
private readonly Container contentContainer; private readonly Container contentContainer;
@ -37,6 +37,7 @@ namespace osu.Game.Screens.Select.Details
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Height = height, Height = height,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Vertical = 10 },
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText