1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-06 04:53:06 +08:00
osu-lazer/osu.Game/Screens/Select/BeatmapDetailArea.cs

108 lines
3.9 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Screens.Select.Details;
2018-04-13 17:19:50 +08:00
using osu.Game.Screens.Select.Leaderboards;
namespace osu.Game.Screens.Select
{
public class BeatmapDetailArea : Container
{
private const float padding = 10;
2018-04-13 17:19:50 +08:00
public readonly BeatmapDetails Details;
public readonly BeatmapLeaderboard Leaderboard;
public readonly UserTopScoreContainer TopScore;
2018-04-13 17:19:50 +08:00
private WorkingBeatmap beatmap;
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
public WorkingBeatmap Beatmap
{
get => beatmap;
2018-04-13 17:19:50 +08:00
set
{
beatmap = value;
Leaderboard.Beatmap = beatmap?.BeatmapInfo;
Details.Beatmap = beatmap?.BeatmapInfo;
TopScore.Hide();
2018-04-13 17:19:50 +08:00
}
}
public BeatmapDetailArea()
{
Children = new Drawable[]
2018-04-13 17:19:50 +08:00
{
new BeatmapDetailAreaTabControl
{
RelativeSizeAxes = Axes.X,
OnFilter = (tab, mods) =>
{
Leaderboard.FilterMods = mods;
2018-04-13 17:19:50 +08:00
switch (tab)
{
case BeatmapDetailTab.Details:
Details.Show();
Leaderboard.Hide();
break;
default:
Details.Hide();
Leaderboard.Scope = (BeatmapLeaderboardScope)tab - 1;
2018-04-13 17:19:50 +08:00
Leaderboard.Show();
break;
}
},
},
new Container
2018-04-13 17:19:50 +08:00
{
Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT, Bottom = padding },
2018-04-13 17:19:50 +08:00
RelativeSizeAxes = Axes.Both,
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
2019-07-14 21:16:21 +08:00
RowDimensions = new[]
{
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 { Top = padding },
},
Leaderboard = new BeatmapLeaderboard
{
RelativeSizeAxes = Axes.Both,
}
}
}
},
new Drawable[]
{
TopScore = new UserTopScoreContainer
{
Score = { BindTarget = Leaderboard.TopScore }
}
}
},
},
}
};
2018-04-13 17:19:50 +08:00
}
}
}