2016-10-14 03:10:00 +08:00
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2016-10-27 10:55:55 +08:00
|
|
|
using osu.Framework.Graphics.Primitives;
|
2016-10-14 03:10:00 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Game.Database;
|
2016-10-14 06:15:43 +08:00
|
|
|
using osu.Game.Graphics;
|
2016-10-21 03:33:46 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2016-10-27 10:55:55 +08:00
|
|
|
using OpenTK;
|
|
|
|
using OpenTK.Graphics;
|
2016-10-14 03:10:00 +08:00
|
|
|
|
2016-10-27 10:55:55 +08:00
|
|
|
namespace osu.Game.Beatmaps.Drawable
|
2016-10-14 03:10:00 +08:00
|
|
|
{
|
2016-10-27 18:52:48 +08:00
|
|
|
class BeatmapPanel : Panel
|
2016-10-14 03:10:00 +08:00
|
|
|
{
|
2016-10-26 22:52:04 +08:00
|
|
|
public BeatmapInfo Beatmap;
|
2016-10-14 03:10:00 +08:00
|
|
|
|
2016-10-27 18:52:48 +08:00
|
|
|
public Action<BeatmapPanel> GainedSelection;
|
|
|
|
|
|
|
|
protected override void Selected()
|
|
|
|
{
|
|
|
|
base.Selected();
|
|
|
|
GainedSelection?.Invoke(this);
|
2016-10-21 03:16:06 +08:00
|
|
|
}
|
2016-10-20 04:37:42 +08:00
|
|
|
|
2016-10-28 22:27:59 +08:00
|
|
|
public BeatmapPanel(BeatmapInfo beatmap)
|
2016-10-27 18:52:48 +08:00
|
|
|
{
|
|
|
|
Beatmap = beatmap;
|
|
|
|
Height *= 0.75f;
|
|
|
|
|
2016-10-27 10:55:55 +08:00
|
|
|
Children = new Framework.Graphics.Drawable[]
|
2016-10-14 03:10:00 +08:00
|
|
|
{
|
2016-10-14 06:15:43 +08:00
|
|
|
new Box
|
|
|
|
{
|
2016-10-20 04:37:42 +08:00
|
|
|
Colour = new Color4(40, 86, 102, 255), // TODO: gradient
|
2016-10-14 06:15:43 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2016-10-24 21:58:51 +08:00
|
|
|
Size = Vector2.One,
|
2016-10-14 06:15:43 +08:00
|
|
|
},
|
|
|
|
new FlowContainer
|
|
|
|
{
|
|
|
|
Padding = new MarginPadding(5),
|
|
|
|
Direction = FlowDirection.HorizontalOnly,
|
2016-10-24 21:58:51 +08:00
|
|
|
AutoSizeAxes = Axes.Both,
|
2016-10-27 10:55:55 +08:00
|
|
|
Children = new Framework.Graphics.Drawable[]
|
2016-10-14 06:15:43 +08:00
|
|
|
{
|
|
|
|
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(159, 198, 0, 255)),
|
|
|
|
new FlowContainer
|
|
|
|
{
|
|
|
|
Padding = new MarginPadding { Left = 10 },
|
2016-10-21 03:33:46 +08:00
|
|
|
Direction = FlowDirection.VerticalOnly,
|
2016-10-24 21:58:51 +08:00
|
|
|
AutoSizeAxes = Axes.Both,
|
2016-10-27 10:55:55 +08:00
|
|
|
Children = new Framework.Graphics.Drawable[]
|
2016-10-14 06:15:43 +08:00
|
|
|
{
|
2016-10-21 03:33:46 +08:00
|
|
|
new FlowContainer
|
2016-10-14 06:15:43 +08:00
|
|
|
{
|
2016-10-21 03:33:46 +08:00
|
|
|
Direction = FlowDirection.HorizontalOnly,
|
2016-10-24 21:58:51 +08:00
|
|
|
AutoSizeAxes = Axes.Both,
|
2016-10-21 03:33:46 +08:00
|
|
|
Children = new[]
|
|
|
|
{
|
|
|
|
new SpriteText
|
|
|
|
{
|
|
|
|
Text = beatmap.Version,
|
|
|
|
TextSize = 20,
|
|
|
|
},
|
|
|
|
new SpriteText
|
|
|
|
{
|
2016-10-28 22:27:59 +08:00
|
|
|
Text = $" mapped by {(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}",
|
2016-10-21 03:33:46 +08:00
|
|
|
TextSize = 16,
|
|
|
|
},
|
|
|
|
}
|
2016-10-14 06:15:43 +08:00
|
|
|
},
|
2016-10-21 03:33:46 +08:00
|
|
|
new StarCounter { Count = beatmap.BaseDifficulty?.OverallDifficulty ?? 5, StarSize = 8 }
|
2016-10-14 06:15:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-14 03:10:00 +08:00
|
|
|
};
|
2016-10-27 18:52:48 +08:00
|
|
|
}
|
2016-10-14 03:10:00 +08:00
|
|
|
}
|
|
|
|
}
|