2017-05-18 05:02:33 +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
|
|
|
|
|
|
2017-05-20 02:43:18 +08:00
|
|
|
|
using System.Linq;
|
2017-05-18 05:02:33 +08:00
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2017-05-20 02:43:18 +08:00
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2017-05-19 23:52:23 +08:00
|
|
|
|
using osu.Framework.Localisation;
|
2017-05-19 02:01:01 +08:00
|
|
|
|
using osu.Game.Database;
|
2017-05-18 05:02:33 +08:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Direct
|
|
|
|
|
{
|
|
|
|
|
public class DirectGridPanel : DirectPanel
|
|
|
|
|
{
|
2017-05-20 06:50:45 +08:00
|
|
|
|
private const float horizontal_padding = 10;
|
|
|
|
|
private const float vertical_padding = 5;
|
2017-05-18 05:02:33 +08:00
|
|
|
|
|
2017-05-20 04:52:34 +08:00
|
|
|
|
private FillFlowContainer bottomPanel;
|
|
|
|
|
|
2017-05-19 02:01:01 +08:00
|
|
|
|
public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
|
|
|
|
Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image)
|
|
|
|
|
CornerRadius = 4;
|
|
|
|
|
Masking = true;
|
2017-05-20 04:52:34 +08:00
|
|
|
|
|
2017-05-18 05:02:33 +08:00
|
|
|
|
EdgeEffect = new EdgeEffect
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Shadow,
|
|
|
|
|
Offset = new Vector2(0f, 1f),
|
|
|
|
|
Radius = 3f,
|
|
|
|
|
Colour = Color4.Black.Opacity(0.25f),
|
|
|
|
|
};
|
2017-05-19 23:52:23 +08:00
|
|
|
|
}
|
2017-05-18 05:02:33 +08:00
|
|
|
|
|
2017-05-20 04:52:34 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
FadeInFromZero(200, EasingTypes.Out);
|
|
|
|
|
bottomPanel.LayoutDuration = 200;
|
|
|
|
|
bottomPanel.LayoutEasing = EasingTypes.Out;
|
|
|
|
|
bottomPanel.Origin = Anchor.BottomLeft;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-19 23:52:23 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2017-05-20 02:43:18 +08:00
|
|
|
|
private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures)
|
2017-05-19 23:52:23 +08:00
|
|
|
|
{
|
2017-05-20 06:50:45 +08:00
|
|
|
|
Children = new[]
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
},
|
2017-05-20 03:07:05 +08:00
|
|
|
|
GetBackground(textures),
|
2017-05-18 05:02:33 +08:00
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black.Opacity(0.5f),
|
|
|
|
|
},
|
2017-05-20 04:52:34 +08:00
|
|
|
|
bottomPanel = new FillFlowContainer
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
2017-05-20 04:52:34 +08:00
|
|
|
|
Origin = Anchor.TopLeft,
|
2017-05-18 05:02:33 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Spacing = new Vector2(0f, vertical_padding),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Left = horizontal_padding, Right = horizontal_padding },
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2017-05-19 23:52:23 +08:00
|
|
|
|
new OsuSpriteText
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
2017-05-19 23:52:23 +08:00
|
|
|
|
Text = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
|
2017-05-18 05:02:33 +08:00
|
|
|
|
TextSize = 18,
|
|
|
|
|
Font = @"Exo2.0-BoldItalic",
|
|
|
|
|
},
|
2017-05-19 23:52:23 +08:00
|
|
|
|
new OsuSpriteText
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
2017-05-19 23:52:23 +08:00
|
|
|
|
Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
|
2017-05-18 05:02:33 +08:00
|
|
|
|
Font = @"Exo2.0-BoldItalic",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2017-05-22 14:13:55 +08:00
|
|
|
|
Padding = new MarginPadding
|
|
|
|
|
{
|
|
|
|
|
Top = vertical_padding,
|
|
|
|
|
Bottom = vertical_padding,
|
|
|
|
|
Left = horizontal_padding,
|
|
|
|
|
Right = horizontal_padding,
|
|
|
|
|
},
|
2017-05-18 05:02:33 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2017-05-19 23:52:23 +08:00
|
|
|
|
new OsuSpriteText
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
2017-05-24 13:19:45 +08:00
|
|
|
|
Text = "mapped by ",
|
2017-05-18 05:02:33 +08:00
|
|
|
|
TextSize = 14,
|
|
|
|
|
Shadow = false,
|
2017-05-19 23:52:23 +08:00
|
|
|
|
Colour = colours.Gray5,
|
2017-05-18 05:02:33 +08:00
|
|
|
|
},
|
2017-05-19 23:52:23 +08:00
|
|
|
|
new OsuSpriteText
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
2017-05-19 23:52:23 +08:00
|
|
|
|
Text = SetInfo.Metadata.Author,
|
2017-05-18 05:02:33 +08:00
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-SemiBoldItalic",
|
|
|
|
|
Shadow = false,
|
2017-05-19 23:52:23 +08:00
|
|
|
|
Colour = colours.BlueDark,
|
2017-05-18 05:02:33 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-05-20 02:43:18 +08:00
|
|
|
|
new Container
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
2017-05-20 02:43:18 +08:00
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
Height = 14,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
2017-05-24 13:19:45 +08:00
|
|
|
|
Text = $"from {SetInfo.Metadata.Source}",
|
2017-05-20 02:43:18 +08:00
|
|
|
|
TextSize = 14,
|
|
|
|
|
Shadow = false,
|
|
|
|
|
Colour = colours.Gray5,
|
2017-05-20 07:03:07 +08:00
|
|
|
|
Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
|
2017-05-20 02:43:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2017-05-18 05:02:33 +08:00
|
|
|
|
},
|
2017-05-19 23:52:23 +08:00
|
|
|
|
new FillFlowContainer
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
2017-05-19 23:52:23 +08:00
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
Height = 20,
|
2017-05-20 02:43:18 +08:00
|
|
|
|
Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding },
|
2017-05-20 03:11:45 +08:00
|
|
|
|
Children = GetDifficultyIcons(),
|
2017-05-18 05:02:33 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Margin = new MarginPadding { Top = vertical_padding, Right = vertical_padding },
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2017-05-28 11:37:55 +08:00
|
|
|
|
new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
|
2017-05-18 05:02:33 +08:00
|
|
|
|
{
|
2017-05-19 23:52:23 +08:00
|
|
|
|
Margin = new MarginPadding { Right = 1 },
|
2017-05-18 05:02:33 +08:00
|
|
|
|
},
|
2017-05-28 11:37:55 +08:00
|
|
|
|
new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
|
2017-05-18 05:02:33 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|