2020-02-04 20:00:27 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 08:43:03 +00:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-04-18 07:04:02 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2017-09-13 02:41:10 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Beatmaps;
|
2021-10-29 08:58:46 +00:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2018-04-18 07:04:02 +00:00
|
|
|
|
using osu.Game.Overlays.BeatmapSet.Buttons;
|
2017-09-13 02:41:10 +00:00
|
|
|
|
using osu.Game.Screens.Select.Details;
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-25 09:26:27 +00:00
|
|
|
|
namespace osu.Game.Overlays.BeatmapSet
|
2017-09-13 02:41:10 +00:00
|
|
|
|
{
|
|
|
|
|
public class Details : FillFlowContainer
|
|
|
|
|
{
|
2019-06-13 09:31:39 +00:00
|
|
|
|
protected readonly UserRatings Ratings;
|
|
|
|
|
|
2017-09-13 21:25:23 +00:00
|
|
|
|
private readonly PreviewButton preview;
|
2017-09-13 02:41:10 +00:00
|
|
|
|
private readonly BasicStats basic;
|
|
|
|
|
private readonly AdvancedStats advanced;
|
2020-02-04 20:00:27 +00:00
|
|
|
|
private readonly DetailBox ratingBox;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-10-29 08:58:46 +00:00
|
|
|
|
private APIBeatmapSet beatmapSet;
|
2018-04-18 07:04:02 +00:00
|
|
|
|
|
2021-10-29 08:58:46 +00:00
|
|
|
|
public APIBeatmapSet BeatmapSet
|
2017-09-13 21:25:23 +00:00
|
|
|
|
{
|
2019-02-28 04:58:19 +00:00
|
|
|
|
get => beatmapSet;
|
2017-09-13 21:25:23 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == beatmapSet) return;
|
2019-02-28 04:31:40 +00:00
|
|
|
|
|
2017-09-13 21:25:23 +00:00
|
|
|
|
beatmapSet = value;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-13 21:25:23 +00:00
|
|
|
|
basic.BeatmapSet = preview.BeatmapSet = BeatmapSet;
|
2019-06-13 09:31:39 +00:00
|
|
|
|
updateDisplay();
|
2017-09-13 21:25:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-10-29 08:58:46 +00:00
|
|
|
|
private IBeatmapInfo beatmapInfo;
|
2018-04-18 07:04:02 +00:00
|
|
|
|
|
2021-10-29 08:58:46 +00:00
|
|
|
|
public IBeatmapInfo BeatmapInfo
|
2017-09-13 02:41:10 +00:00
|
|
|
|
{
|
2021-10-02 03:44:22 +00:00
|
|
|
|
get => beatmapInfo;
|
2017-09-13 02:41:10 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
2021-10-02 03:44:22 +00:00
|
|
|
|
if (value == beatmapInfo) return;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-10-02 03:44:22 +00:00
|
|
|
|
basic.BeatmapInfo = advanced.BeatmapInfo = beatmapInfo = value;
|
2017-09-13 02:41:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-04-18 07:04:02 +00:00
|
|
|
|
private void updateDisplay()
|
|
|
|
|
{
|
2021-10-25 05:44:49 +00:00
|
|
|
|
Ratings.Ratings = BeatmapSet?.Ratings;
|
2021-10-29 08:58:46 +00:00
|
|
|
|
ratingBox.Alpha = BeatmapSet?.Status > 0 ? 1 : 0;
|
2018-04-18 07:04:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-09-13 21:25:23 +00:00
|
|
|
|
public Details()
|
2017-09-13 02:41:10 +00:00
|
|
|
|
{
|
2017-09-25 09:26:27 +00:00
|
|
|
|
Width = BeatmapSetOverlay.RIGHT_WIDTH;
|
2017-09-13 02:41:10 +00:00
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Spacing = new Vector2(1f);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-13 02:41:10 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-09-13 21:25:23 +00:00
|
|
|
|
preview = new PreviewButton
|
2017-09-13 02:41:10 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
},
|
|
|
|
|
new DetailBox
|
|
|
|
|
{
|
2017-09-13 21:31:53 +00:00
|
|
|
|
Child = basic = new BasicStats
|
2017-09-13 02:41:10 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2020-02-16 20:43:33 +00:00
|
|
|
|
Padding = new MarginPadding { Vertical = 10 }
|
2017-09-13 02:41:10 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new DetailBox
|
|
|
|
|
{
|
|
|
|
|
Child = advanced = new AdvancedStats
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Margin = new MarginPadding { Vertical = 7.5f },
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-02-04 20:00:27 +00:00
|
|
|
|
ratingBox = new DetailBox
|
2017-09-13 02:41:10 +00:00
|
|
|
|
{
|
2019-06-13 09:31:39 +00:00
|
|
|
|
Child = Ratings = new UserRatings
|
2017-09-13 02:41:10 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 95,
|
|
|
|
|
Margin = new MarginPadding { Top = 10 },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-04-18 07:04:02 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
updateDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-13 02:41:10 +00:00
|
|
|
|
private class DetailBox : Container
|
|
|
|
|
{
|
|
|
|
|
private readonly Container content;
|
2020-02-04 20:00:00 +00:00
|
|
|
|
private readonly Box background;
|
|
|
|
|
|
2017-09-13 02:41:10 +00:00
|
|
|
|
protected override Container<Drawable> Content => content;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-13 02:41:10 +00:00
|
|
|
|
public DetailBox()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-09-13 02:41:10 +00:00
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
|
{
|
2020-02-04 20:00:00 +00:00
|
|
|
|
background = new Box
|
2017-09-13 02:41:10 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-02-04 18:54:51 +00:00
|
|
|
|
Alpha = 0.5f
|
2017-09-13 02:41:10 +00:00
|
|
|
|
},
|
|
|
|
|
content = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Padding = new MarginPadding { Horizontal = 15 },
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-02-04 20:00:00 +00:00
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
|
|
|
|
{
|
|
|
|
|
background.Colour = colourProvider.Background6;
|
|
|
|
|
}
|
2017-09-13 02:41:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|