1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 16:47:24 +08:00
osu-lazer/osu.Game/Screens/Select/BeatmapDetailArea.cs

81 lines
2.5 KiB
C#
Raw Normal View History

2017-03-23 11:22:31 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
2017-03-23 12:19:29 +08:00
using osu.Game.Beatmaps;
using osu.Game.Screens.Select.Leaderboards;
2017-03-23 11:22:31 +08:00
namespace osu.Game.Screens.Select
{
public class BeatmapDetailArea : Container
{
2017-03-23 13:47:27 +08:00
private readonly Container content;
2017-03-23 11:29:28 +08:00
protected override Container<Drawable> Content => content;
public readonly BeatmapDetails Details;
2017-03-23 12:19:29 +08:00
public readonly Leaderboard Leaderboard;
private WorkingBeatmap beatmap;
public WorkingBeatmap Beatmap
2017-03-23 12:19:29 +08:00
{
get
{
return beatmap;
}
set
{
beatmap = value;
Leaderboard.Beatmap = beatmap?.BeatmapInfo;
Details.Beatmap = beatmap?.Beatmap.BeatmapInfo;
}
2017-03-23 12:19:29 +08:00
}
2017-03-23 11:22:31 +08:00
public BeatmapDetailArea()
{
2017-03-23 11:29:28 +08:00
AddInternal(new Drawable[]
2017-03-23 11:22:31 +08:00
{
new BeatmapDetailAreaTabControl
{
RelativeSizeAxes = Axes.X,
2017-04-04 23:27:08 +08:00
OnFilter = (tab, mods) =>
2017-03-23 12:19:29 +08:00
{
switch (tab)
{
case BeatmapDetailTab.Details:
Details.Show();
Leaderboard.Hide();
2017-03-23 12:19:29 +08:00
break;
2017-04-04 23:27:08 +08:00
2017-03-23 12:19:29 +08:00
default:
Details.Hide();
Leaderboard.Show();
2017-03-23 12:19:29 +08:00
break;
}
},
2017-03-23 11:22:31 +08:00
},
2017-03-23 11:29:28 +08:00
content = new Container
2017-03-23 11:22:31 +08:00
{
2017-03-23 11:29:28 +08:00
RelativeSizeAxes = Axes.Both,
2017-03-23 11:22:31 +08:00
Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
},
2017-03-23 11:29:28 +08:00
});
2017-03-23 12:19:29 +08:00
Add(new Drawable[]
{
Details = new BeatmapDetails
2017-03-23 12:19:29 +08:00
{
RelativeSizeAxes = Axes.Both,
2017-03-26 06:33:03 +08:00
Padding = new MarginPadding(5),
Alpha = 0,
2017-03-23 12:19:29 +08:00
},
Leaderboard = new Leaderboard
{
RelativeSizeAxes = Axes.Both,
2017-03-23 12:19:29 +08:00
}
});
}
2017-03-23 11:22:31 +08:00
}
2017-04-04 23:27:08 +08:00
}