1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 14:07:25 +08:00
osu-lazer/osu.Game/Beatmaps/Drawable/BeatmapSetHeader.cs

82 lines
2.9 KiB
C#
Raw Normal View History

2016-10-27 10:55:55 +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;
2016-10-27 10:55:55 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Game.Database;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawable
{
class BeatmapSetHeader : Panel
2016-10-27 10:55:55 +08:00
{
public Action<BeatmapSetHeader> GainedSelection;
protected override void Selected()
{
base.Selected();
Width = 1;
GainedSelection?.Invoke(this);
}
protected override void Deselected()
{
base.Deselected();
Width = 0.8f;
}
2016-11-05 19:00:14 +08:00
public BeatmapSetHeader(BeatmapSetInfo beatmapSet, WorkingBeatmap working)
2016-10-27 10:55:55 +08:00
{
Children = new Framework.Graphics.Drawable[]
{
2016-11-05 19:00:14 +08:00
working.Background == null ? new Box{ RelativeSizeAxes = Axes.Both, Colour = new Color4(20, 20, 20, 255) } : new Sprite
2016-10-27 10:55:55 +08:00
{
2016-11-05 19:00:14 +08:00
Texture = working.Background,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
2016-11-06 11:37:41 +08:00
Scale = new Vector2(1366 / working.Background.Width * 0.6f),
2016-11-05 19:00:14 +08:00
Colour = new Color4(200, 200, 200, 255),
},
2016-10-27 10:55:55 +08:00
new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
Spacing = new Vector2(0, 2),
Padding = new MarginPadding { Top = 10, Left = 15, Right = 10, Bottom = 10 },
2016-10-27 10:55:55 +08:00
AutoSizeAxes = Axes.Both,
Children = new[]
{
new SpriteText
{
Font = @"Exo2.0-SemiBoldItalic",
2016-10-27 10:55:55 +08:00
Text = beatmapSet.Metadata.Title ?? beatmapSet.Metadata.TitleUnicode,
TextSize = 22
2016-10-27 10:55:55 +08:00
},
new SpriteText
{
Font = @"Exo2.0-MediumItalic",
2016-10-27 10:55:55 +08:00
Text = beatmapSet.Metadata.Artist ?? beatmapSet.Metadata.ArtistUnicode,
TextSize = 16
},
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Children = new[]
{
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(159, 198, 0, 255)),
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(246, 101, 166, 255)),
}
}
}
}
};
Deselected();
2016-10-27 10:55:55 +08:00
}
}
}