2019-01-24 08:43:03 +00: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 09:19:50 +00:00
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2017-09-08 21:32:07 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-28 09:44:40 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2017-09-08 21:32:07 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2021-10-29 08:58:46 +00:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-25 09:26:27 +00:00
|
|
|
|
namespace osu.Game.Overlays.BeatmapSet
|
2017-09-08 21:32:07 +00:00
|
|
|
|
{
|
|
|
|
|
public class Info : Container
|
|
|
|
|
{
|
2020-02-16 20:43:33 +00:00
|
|
|
|
private const float metadata_width = 175;
|
2017-09-08 21:32:07 +00:00
|
|
|
|
private const float spacing = 20;
|
2020-02-16 20:43:33 +00:00
|
|
|
|
private const float base_height = 220;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-08 21:32:07 +00:00
|
|
|
|
private readonly Box successRateBackground;
|
2020-02-04 11:00:18 +00:00
|
|
|
|
private readonly Box background;
|
2017-09-11 05:48:48 +00:00
|
|
|
|
private readonly SuccessRate successRate;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-10-29 08:58:46 +00:00
|
|
|
|
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
2018-04-18 07:04:02 +00:00
|
|
|
|
|
2021-10-29 08:58:46 +00:00
|
|
|
|
public APIBeatmap BeatmapInfo
|
2017-09-11 05:48:48 +00:00
|
|
|
|
{
|
2021-10-29 08:58:46 +00:00
|
|
|
|
get => successRate.Beatmap;
|
|
|
|
|
set => successRate.Beatmap = value;
|
2017-09-11 05:48:48 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-13 15:37:18 +00:00
|
|
|
|
public Info()
|
2017-09-08 21:32:07 +00:00
|
|
|
|
{
|
2019-07-11 13:44:48 +00:00
|
|
|
|
MetadataSection source, tags, genre, language;
|
2021-06-09 04:44:26 +00:00
|
|
|
|
OsuSpriteText notRankedPlaceholder;
|
2020-02-04 22:09:10 +00:00
|
|
|
|
|
2017-09-08 21:32:07 +00:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2020-02-16 20:43:33 +00:00
|
|
|
|
Height = base_height;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-08 21:32:07 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2020-02-04 11:00:18 +00:00
|
|
|
|
background = new Box
|
2017-09-08 21:32:07 +00:00
|
|
|
|
{
|
2020-02-04 11:00:18 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Both
|
2017-09-08 21:32:07 +00:00
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-09-25 09:26:27 +00:00
|
|
|
|
Padding = new MarginPadding { Top = 15, Horizontal = BeatmapSetOverlay.X_PADDING },
|
2017-09-08 21:32:07 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-09-25 09:26:27 +00:00
|
|
|
|
Padding = new MarginPadding { Right = metadata_width + BeatmapSetOverlay.RIGHT_WIDTH + spacing * 2 },
|
2017-11-15 10:02:56 +00:00
|
|
|
|
Child = new Container
|
2017-09-08 21:32:07 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-01-30 04:30:25 +00:00
|
|
|
|
Child = new MetadataSection(MetadataType.Description),
|
2017-09-08 21:32:07 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2022-08-01 08:36:06 +00:00
|
|
|
|
new Container
|
2017-09-08 21:32:07 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Width = metadata_width,
|
|
|
|
|
Padding = new MarginPadding { Horizontal = 10 },
|
2017-09-25 09:26:27 +00:00
|
|
|
|
Margin = new MarginPadding { Right = BeatmapSetOverlay.RIGHT_WIDTH + spacing },
|
2022-08-01 08:36:06 +00:00
|
|
|
|
Masking = true,
|
2017-09-13 15:37:18 +00:00
|
|
|
|
Child = new FillFlowContainer
|
2017-09-08 21:32:07 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2019-09-02 04:45:13 +00:00
|
|
|
|
Direction = FillDirection.Full,
|
2017-09-13 15:37:18 +00:00
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2020-01-30 04:30:25 +00:00
|
|
|
|
source = new MetadataSection(MetadataType.Source),
|
|
|
|
|
genre = new MetadataSection(MetadataType.Genre) { Width = 0.5f },
|
|
|
|
|
language = new MetadataSection(MetadataType.Language) { Width = 0.5f },
|
|
|
|
|
tags = new MetadataSection(MetadataType.Tags),
|
2017-09-13 15:37:18 +00:00
|
|
|
|
},
|
2017-09-08 21:32:07 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
2017-09-25 09:26:27 +00:00
|
|
|
|
Width = BeatmapSetOverlay.RIGHT_WIDTH,
|
2017-09-11 05:48:48 +00:00
|
|
|
|
Children = new Drawable[]
|
2017-09-08 21:32:07 +00:00
|
|
|
|
{
|
|
|
|
|
successRateBackground = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
2017-09-11 05:48:48 +00:00
|
|
|
|
successRate = new SuccessRate
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Top = 20, Horizontal = 15 },
|
|
|
|
|
},
|
2021-06-09 04:44:26 +00:00
|
|
|
|
notRankedPlaceholder = new OsuSpriteText
|
2020-02-04 20:02:02 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Alpha = 0,
|
2021-06-09 04:44:26 +00:00
|
|
|
|
Text = "This beatmap is not ranked",
|
2020-02-07 19:28:02 +00:00
|
|
|
|
Font = OsuFont.GetFont(size: 12)
|
2020-02-04 20:02:02 +00:00
|
|
|
|
},
|
2017-09-08 21:32:07 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2019-02-28 09:44:40 +00:00
|
|
|
|
|
|
|
|
|
BeatmapSet.ValueChanged += b =>
|
|
|
|
|
{
|
2021-10-29 08:58:46 +00:00
|
|
|
|
source.Text = b.NewValue?.Source ?? string.Empty;
|
|
|
|
|
tags.Text = b.NewValue?.Tags ?? string.Empty;
|
|
|
|
|
genre.Text = b.NewValue?.Genre.Name ?? string.Empty;
|
|
|
|
|
language.Text = b.NewValue?.Language.Name ?? string.Empty;
|
|
|
|
|
bool setHasLeaderboard = b.NewValue?.Status > 0;
|
2020-02-04 20:02:02 +00:00
|
|
|
|
successRate.Alpha = setHasLeaderboard ? 1 : 0;
|
2021-06-09 04:44:26 +00:00
|
|
|
|
notRankedPlaceholder.Alpha = setHasLeaderboard ? 0 : 1;
|
2020-02-16 20:43:33 +00:00
|
|
|
|
Height = setHasLeaderboard ? 270 : base_height;
|
2019-02-28 09:44:40 +00:00
|
|
|
|
};
|
2017-09-08 21:32:07 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-08 21:32:07 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
2020-02-04 11:00:18 +00:00
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2017-09-08 21:32:07 +00:00
|
|
|
|
{
|
2020-02-04 11:00:18 +00:00
|
|
|
|
successRateBackground.Colour = colourProvider.Background4;
|
|
|
|
|
background.Colour = colourProvider.Background5;
|
2017-09-08 21:32:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|