2019-01-24 08:43:03 +00:00
|
|
|
|
// 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 09:19:50 +00:00
|
|
|
|
|
2019-09-19 05:26:15 +00:00
|
|
|
|
using System;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Screens.Select.Leaderboards;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Select
|
|
|
|
|
{
|
|
|
|
|
public class BeatmapDetailArea : Container
|
|
|
|
|
{
|
2019-09-19 05:26:15 +00:00
|
|
|
|
private const float details_padding = 10;
|
|
|
|
|
|
|
|
|
|
private readonly Container content;
|
|
|
|
|
protected override Container<Drawable> Content => content;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
public readonly BeatmapDetails Details;
|
2018-12-14 10:51:27 +00:00
|
|
|
|
public readonly BeatmapLeaderboard Leaderboard;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
private WorkingBeatmap beatmap;
|
2019-02-28 04:31:40 +00:00
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
public WorkingBeatmap Beatmap
|
|
|
|
|
{
|
2019-02-28 04:58:19 +00:00
|
|
|
|
get => beatmap;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
beatmap = value;
|
|
|
|
|
Details.Beatmap = beatmap?.BeatmapInfo;
|
2019-09-09 17:04:04 +00:00
|
|
|
|
Leaderboard.Beatmap = beatmap is DummyWorkingBeatmap ? null : beatmap?.BeatmapInfo;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BeatmapDetailArea()
|
|
|
|
|
{
|
2019-09-19 05:26:15 +00:00
|
|
|
|
AddRangeInternal(new Drawable[]
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
new BeatmapDetailAreaTabControl
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
OnFilter = (tab, mods) =>
|
|
|
|
|
{
|
2019-07-03 11:34:20 +00:00
|
|
|
|
Leaderboard.FilterMods = mods;
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
switch (tab)
|
|
|
|
|
{
|
|
|
|
|
case BeatmapDetailTab.Details:
|
|
|
|
|
Details.Show();
|
|
|
|
|
Leaderboard.Hide();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
Details.Hide();
|
2018-12-14 10:51:27 +00:00
|
|
|
|
Leaderboard.Scope = (BeatmapLeaderboardScope)tab - 1;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
Leaderboard.Show();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2019-09-19 05:26:15 +00:00
|
|
|
|
content = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AddRange(new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
Details = new BeatmapDetails
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
Margin = new MarginPadding { Top = details_padding },
|
|
|
|
|
},
|
|
|
|
|
Leaderboard = new BeatmapLeaderboard
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-07-14 11:03:14 +00:00
|
|
|
|
}
|
2019-09-19 05:26:15 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateAfterChildren()
|
|
|
|
|
{
|
|
|
|
|
base.UpdateAfterChildren();
|
|
|
|
|
|
|
|
|
|
Details.Height = Math.Min(DrawHeight - details_padding * 3 - BeatmapDetailAreaTabControl.HEIGHT, 450);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|