2019-01-24 16:43:03 +08: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 17:19:50 +08:00
|
|
|
|
|
2020-04-21 15:03:18 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2020-04-21 15:03:18 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-03-27 18:29:27 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2021-02-22 16:14:13 +08:00
|
|
|
|
using osu.Framework.Localisation;
|
2019-03-01 11:38:05 +08:00
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
2020-04-21 15:03:18 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2019-05-16 14:02:13 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2020-04-21 15:03:18 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2021-10-29 16:58:46 +08:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2021-01-13 16:29:30 +08:00
|
|
|
|
using osu.Game.Overlays.BeatmapSet;
|
2020-04-21 15:03:18 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-04-21 15:03:18 +08:00
|
|
|
|
namespace osu.Game.Overlays.BeatmapListing.Panels
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2020-04-21 19:55:33 +08:00
|
|
|
|
public class ListBeatmapPanel : BeatmapPanel
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-06-05 08:01:15 +08:00
|
|
|
|
private const float transition_duration = 120;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
private const float horizontal_padding = 10;
|
|
|
|
|
private const float vertical_padding = 5;
|
|
|
|
|
private const float height = 70;
|
|
|
|
|
|
2021-09-08 12:27:20 +08:00
|
|
|
|
private FillFlowContainer statusContainer, titleContainer, artistContainer;
|
2020-04-21 15:03:18 +08:00
|
|
|
|
protected BeatmapPanelDownloadButton DownloadButton;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
private PlayButton playButton;
|
|
|
|
|
private Box progressBar;
|
2018-08-05 13:36:09 +08:00
|
|
|
|
|
|
|
|
|
protected override bool FadePlayButton => false;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
protected override PlayButton PlayButton => playButton;
|
|
|
|
|
protected override Box PreviewBar => progressBar;
|
|
|
|
|
|
2021-10-29 16:58:46 +08:00
|
|
|
|
public ListBeatmapPanel(APIBeatmapSet beatmap)
|
2018-08-05 13:36:09 +08:00
|
|
|
|
: base(beatmap)
|
2018-06-05 08:01:15 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
Height = height;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2018-09-19 13:07:46 +08:00
|
|
|
|
private void load(OsuColour colours)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Content.CornerRadius = 5;
|
|
|
|
|
|
|
|
|
|
AddRange(new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.25f), Color4.Black.Opacity(0.75f)),
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding, Left = horizontal_padding, Right = vertical_padding },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
LayoutEasing = Easing.OutQuint,
|
2018-06-05 08:01:15 +08:00
|
|
|
|
LayoutDuration = transition_duration,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Spacing = new Vector2(10, 0),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2018-08-05 13:36:09 +08:00
|
|
|
|
new FillFlowContainer
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-08-05 13:36:09 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
playButton = new PlayButton(SetInfo)
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
2019-05-16 14:17:44 +08:00
|
|
|
|
Size = new Vector2(height / 3),
|
2018-08-05 13:36:09 +08:00
|
|
|
|
FillMode = FillMode.Fit,
|
2019-05-16 14:17:44 +08:00
|
|
|
|
Margin = new MarginPadding { Right = 10 },
|
2018-08-05 13:36:09 +08:00
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2021-01-13 16:29:30 +08:00
|
|
|
|
titleContainer = new FillFlowContainer
|
2018-08-05 13:36:09 +08:00
|
|
|
|
{
|
2021-01-13 16:29:30 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
2021-10-29 16:58:46 +08:00
|
|
|
|
Text = new RomanisableString(SetInfo.TitleUnicode, SetInfo.Title),
|
2021-01-13 16:29:30 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
|
|
|
|
|
},
|
|
|
|
|
}
|
2018-08-05 13:36:09 +08:00
|
|
|
|
},
|
2021-09-08 12:27:20 +08:00
|
|
|
|
artistContainer = new FillFlowContainer
|
2018-08-05 13:36:09 +08:00
|
|
|
|
{
|
2021-09-08 12:27:20 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
2021-10-29 16:58:46 +08:00
|
|
|
|
Text = new RomanisableString(SetInfo.ArtistUnicode, SetInfo.Artist),
|
2021-09-08 12:27:20 +08:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true)
|
|
|
|
|
},
|
|
|
|
|
},
|
2018-08-05 13:36:09 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
2019-03-01 11:38:05 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
statusContainer = new FillFlowContainer
|
|
|
|
|
{
|
2019-03-05 15:02:07 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Margin = new MarginPadding { Vertical = vertical_padding, Horizontal = 5 },
|
2019-03-01 11:38:05 +08:00
|
|
|
|
Spacing = new Vector2(5),
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
Height = 20,
|
|
|
|
|
Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding },
|
2019-09-03 01:59:43 +08:00
|
|
|
|
Spacing = new Vector2(3),
|
2019-08-25 10:44:56 +08:00
|
|
|
|
Children = GetDifficultyIcons(colours),
|
2019-03-01 11:38:05 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2018-06-05 08:01:15 +08:00
|
|
|
|
Direction = FillDirection.Horizontal,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2018-08-05 13:36:09 +08:00
|
|
|
|
new Container
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-08-05 13:36:09 +08:00
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
2018-06-05 08:01:15 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2020-04-21 15:03:18 +08:00
|
|
|
|
Child = DownloadButton = new BeatmapPanelDownloadButton(SetInfo)
|
2018-06-05 08:01:15 +08:00
|
|
|
|
{
|
2018-07-03 22:56:49 +08:00
|
|
|
|
Size = new Vector2(height - vertical_padding * 3),
|
2019-05-16 14:17:44 +08:00
|
|
|
|
Margin = new MarginPadding { Left = vertical_padding * 2, Right = vertical_padding },
|
2018-06-05 08:01:15 +08:00
|
|
|
|
},
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2018-06-05 08:01:15 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2021-10-29 16:58:46 +08:00
|
|
|
|
new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.PlayCount),
|
|
|
|
|
new Statistic(FontAwesome.Solid.Heart, SetInfo.FavouriteCount),
|
2019-05-16 14:02:13 +08:00
|
|
|
|
new LinkFlowContainer(s =>
|
|
|
|
|
{
|
|
|
|
|
s.Shadow = false;
|
|
|
|
|
s.Font = OsuFont.GetFont(size: 14);
|
|
|
|
|
})
|
2018-06-05 08:01:15 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2019-05-16 14:02:13 +08:00
|
|
|
|
}.With(d =>
|
|
|
|
|
{
|
|
|
|
|
d.AutoSizeAxes = Axes.Both;
|
|
|
|
|
d.AddText("mapped by ");
|
2021-10-29 16:58:46 +08:00
|
|
|
|
d.AddUserLink(SetInfo.Author);
|
2019-05-16 14:02:13 +08:00
|
|
|
|
}),
|
2018-04-13 17:19:50 +08:00
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
2021-10-29 16:58:46 +08:00
|
|
|
|
Text = SetInfo.Source,
|
2018-06-05 08:01:15 +08:00
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 14),
|
2021-10-29 16:58:46 +08:00
|
|
|
|
Alpha = string.IsNullOrEmpty(SetInfo.Source) ? 0f : 1f,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
progressBar = new Box
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
BypassAutoSizeAxes = Axes.Y,
|
|
|
|
|
Size = new Vector2(0, 3),
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
Colour = colours.Yellow,
|
|
|
|
|
},
|
|
|
|
|
});
|
2019-03-01 11:38:05 +08:00
|
|
|
|
|
2021-10-29 16:58:46 +08:00
|
|
|
|
if (SetInfo.HasExplicitContent)
|
2021-01-13 16:29:30 +08:00
|
|
|
|
{
|
2021-01-17 21:40:24 +08:00
|
|
|
|
titleContainer.Add(new ExplicitContentBeatmapPill
|
2021-01-13 16:29:30 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Margin = new MarginPadding { Left = 10f, Top = 2f },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-29 16:58:46 +08:00
|
|
|
|
if (SetInfo.TrackId != null)
|
2021-09-08 12:27:20 +08:00
|
|
|
|
{
|
|
|
|
|
artistContainer.Add(new FeaturedArtistBeatmapPill
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Margin = new MarginPadding { Left = 10f, Top = 2f },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-29 16:58:46 +08:00
|
|
|
|
if (SetInfo.HasVideo)
|
2019-03-01 11:38:05 +08:00
|
|
|
|
{
|
2019-04-02 18:55:24 +08:00
|
|
|
|
statusContainer.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) });
|
2019-03-01 11:38:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-29 16:58:46 +08:00
|
|
|
|
if (SetInfo.HasStoryboard)
|
2019-03-01 11:38:05 +08:00
|
|
|
|
{
|
2019-04-02 18:55:24 +08:00
|
|
|
|
statusContainer.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) });
|
2019-03-01 11:38:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
statusContainer.Add(new BeatmapSetOnlineStatusPill
|
|
|
|
|
{
|
2021-10-26 02:20:40 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2019-03-05 15:02:07 +08:00
|
|
|
|
TextSize = 12,
|
2019-03-05 16:14:49 +08:00
|
|
|
|
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 4 },
|
2021-10-29 16:58:46 +08:00
|
|
|
|
Status = SetInfo.Status,
|
2019-03-01 11:38:05 +08:00
|
|
|
|
});
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|