2019-06-11 01:17:44 +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.
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-06-11 17:29:42 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2019-06-11 01:17:44 +08:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
2019-06-19 06:43:28 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2019-06-11 01:17:44 +08:00
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.BeatmapSet
|
|
|
|
|
{
|
|
|
|
|
public class BeatmapNotAvailable : Container
|
|
|
|
|
{
|
2019-06-11 17:29:42 +08:00
|
|
|
|
private BeatmapSetInfo beatmapSet;
|
2019-06-11 01:17:44 +08:00
|
|
|
|
|
2019-06-11 17:29:42 +08:00
|
|
|
|
public BeatmapSetInfo BeatmapSet
|
|
|
|
|
{
|
|
|
|
|
get => beatmapSet;
|
|
|
|
|
set
|
|
|
|
|
{
|
2019-06-19 08:37:08 +08:00
|
|
|
|
if (value == beatmapSet)
|
|
|
|
|
return;
|
2019-06-11 17:29:42 +08:00
|
|
|
|
|
|
|
|
|
beatmapSet = value;
|
|
|
|
|
|
2019-06-19 09:27:31 +08:00
|
|
|
|
var unavailable = availability != null;
|
|
|
|
|
this.FadeTo(unavailable ? 1 : 0);
|
|
|
|
|
|
|
|
|
|
if (unavailable)
|
|
|
|
|
updateText();
|
2019-06-11 17:29:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-19 06:43:28 +08:00
|
|
|
|
private readonly OsuSpriteText text;
|
2019-06-11 17:29:42 +08:00
|
|
|
|
private readonly LinkFlowContainer link;
|
|
|
|
|
|
2019-06-19 06:43:28 +08:00
|
|
|
|
private BeatmapSetOnlineAvailability availability => BeatmapSet?.OnlineInfo.Availability;
|
|
|
|
|
|
2019-06-11 17:29:42 +08:00
|
|
|
|
public BeatmapNotAvailable()
|
2019-06-11 01:17:44 +08:00
|
|
|
|
{
|
2019-06-13 22:32:27 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Padding = new MarginPadding { Top = 10, Right = 20 };
|
2019-06-11 01:17:44 +08:00
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-06-13 22:32:27 +08:00
|
|
|
|
Colour = Color4.Black.Opacity(0.6f),
|
2019-06-11 01:17:44 +08:00
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
2019-06-13 22:32:27 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2019-06-11 01:17:44 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
2019-06-11 02:13:37 +08:00
|
|
|
|
Margin = new MarginPadding { Top = 10, Left = 5, Right = 20 },
|
2019-06-11 01:17:44 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-06-19 06:43:28 +08:00
|
|
|
|
text = new OsuSpriteText
|
2019-06-11 01:17:44 +08:00
|
|
|
|
{
|
2019-06-13 22:32:27 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-06-19 06:43:28 +08:00
|
|
|
|
AllowMultiline = true,
|
2019-06-11 02:13:37 +08:00
|
|
|
|
Margin = new MarginPadding { Bottom = 10, Horizontal = 5 },
|
2019-06-19 06:43:28 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium),
|
2019-06-11 01:17:44 +08:00
|
|
|
|
Colour = Color4.Orange,
|
|
|
|
|
},
|
2019-06-11 17:29:42 +08:00
|
|
|
|
link = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14))
|
2019-06-11 01:17:44 +08:00
|
|
|
|
{
|
|
|
|
|
Direction = FillDirection.Full,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Margin = new MarginPadding { Bottom = 10, Horizontal = 5 },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2019-06-11 17:29:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-19 08:37:08 +08:00
|
|
|
|
private void updateText()
|
2019-06-11 17:29:42 +08:00
|
|
|
|
{
|
2019-06-19 06:43:28 +08:00
|
|
|
|
text.Text = availability.DownloadDisabled
|
2019-06-11 17:29:42 +08:00
|
|
|
|
? "This beatmap is currently not available for download."
|
|
|
|
|
: "Portions of this beatmap have been removed at the request of the creator or a third-party rights holder.";
|
|
|
|
|
|
2019-06-19 06:43:28 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(availability.ExternalLink))
|
|
|
|
|
link.AddLink("Check here for more information.", availability.ExternalLink);
|
2019-06-11 01:17:44 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|