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