2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-03-23 11:22:31 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
using System;
|
2017-03-23 11:22:31 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
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-09-08 01:53:53 +08:00
|
|
|
|
private const float details_padding = 10;
|
|
|
|
|
|
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;
|
|
|
|
|
|
2017-03-30 23:32:18 +08:00
|
|
|
|
public readonly BeatmapDetails Details;
|
2017-03-23 12:19:29 +08:00
|
|
|
|
public readonly Leaderboard Leaderboard;
|
|
|
|
|
|
2017-03-23 15:31:08 +08:00
|
|
|
|
private WorkingBeatmap beatmap;
|
|
|
|
|
public WorkingBeatmap Beatmap
|
2017-03-23 12:19:29 +08:00
|
|
|
|
{
|
2017-03-23 15:31:08 +08:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return beatmap;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
beatmap = value;
|
2017-04-11 12:48:43 +08:00
|
|
|
|
Leaderboard.Beatmap = beatmap?.BeatmapInfo;
|
2017-04-24 18:17:11 +08:00
|
|
|
|
Details.Beatmap = beatmap?.BeatmapInfo;
|
2017-03-23 15:31:08 +08:00
|
|
|
|
}
|
2017-03-23 12:19:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 11:22:31 +08:00
|
|
|
|
public BeatmapDetailArea()
|
|
|
|
|
{
|
2017-07-11 21:58:06 +08:00
|
|
|
|
AddRangeInternal(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:
|
2017-03-23 15:28:40 +08:00
|
|
|
|
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:
|
2017-03-23 15:28:40 +08:00
|
|
|
|
Details.Hide();
|
2017-12-21 20:54:46 +08:00
|
|
|
|
Leaderboard.Scope = (LeaderboardScope)tab - 1;
|
2017-03-23 15:28:40 +08:00
|
|
|
|
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
|
|
|
|
|
2017-07-11 21:58:06 +08:00
|
|
|
|
AddRange(new Drawable[]
|
2017-03-23 12:19:29 +08:00
|
|
|
|
{
|
2017-03-30 23:32:18 +08:00
|
|
|
|
Details = new BeatmapDetails
|
2017-03-23 12:19:29 +08:00
|
|
|
|
{
|
2017-04-24 17:55:49 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2017-04-06 21:39:23 +08:00
|
|
|
|
Alpha = 0,
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Margin = new MarginPadding { Top = details_padding },
|
2017-03-23 12:19:29 +08:00
|
|
|
|
},
|
|
|
|
|
Leaderboard = new Leaderboard
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2017-09-08 01:53:53 +08:00
|
|
|
|
|
|
|
|
|
protected override void UpdateAfterChildren()
|
|
|
|
|
{
|
|
|
|
|
base.UpdateAfterChildren();
|
|
|
|
|
|
2017-09-08 02:38:23 +08:00
|
|
|
|
Details.Height = Math.Min(DrawHeight - details_padding * 3 - BeatmapDetailAreaTabControl.HEIGHT, 450);
|
2017-09-08 01:53:53 +08:00
|
|
|
|
}
|
2017-03-23 11:22:31 +08:00
|
|
|
|
}
|
2017-04-24 17:55:49 +08:00
|
|
|
|
}
|