mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add a container for Beatmap Availability
This commit is contained in:
@ -63,9 +63,6 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty(@"availability")]
|
[JsonProperty(@"availability")]
|
||||||
private BeatmapSetOnlineAvailability availability { get; set; }
|
private BeatmapSetOnlineAvailability availability { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"download_unavailable")]
|
|
||||||
private bool test { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty(@"beatmaps")]
|
[JsonProperty(@"beatmaps")]
|
||||||
private IEnumerable<APIBeatmap> beatmaps { get; set; }
|
private IEnumerable<APIBeatmap> beatmaps { get; set; }
|
||||||
|
|
||||||
|
69
osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs
Normal file
69
osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// 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 System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
|
{
|
||||||
|
public class BeatmapNotAvailable : Container
|
||||||
|
{
|
||||||
|
private LinkFlowContainer linkContainer;
|
||||||
|
|
||||||
|
public override void Show()
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Margin = new MarginPadding() { Top = 10 };
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Black.Opacity(0.6f),
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Margin = new MarginPadding() { Top = 10, Left = 5, Right = 20 },
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding() { Bottom = 10, Horizontal = 5 },
|
||||||
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium),
|
||||||
|
Text = "This beatmap is currently not available for download.",
|
||||||
|
Colour = Color4.Orange,
|
||||||
|
},
|
||||||
|
linkContainer = new LinkFlowContainer(text => text.Font = OsuFont.GetFont(size: 14))
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Full,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Margin = new MarginPadding { Bottom = 10, Horizontal = 5 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
base.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Link
|
||||||
|
{
|
||||||
|
set => linkContainer.AddLink("Check here for more information.", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays.BeatmapSet.Buttons;
|
using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||||
@ -32,6 +33,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly UpdateableBeatmapSetCover cover;
|
private readonly UpdateableBeatmapSetCover cover;
|
||||||
private readonly OsuSpriteText title, artist;
|
private readonly OsuSpriteText title, artist;
|
||||||
private readonly AuthorInfo author;
|
private readonly AuthorInfo author;
|
||||||
|
private readonly BeatmapNotAvailable unavailableContainer;
|
||||||
private readonly FillFlowContainer downloadButtonsContainer;
|
private readonly FillFlowContainer downloadButtonsContainer;
|
||||||
private readonly BeatmapSetOnlineStatusPill onlineStatusPill;
|
private readonly BeatmapSetOnlineStatusPill onlineStatusPill;
|
||||||
public Details Details;
|
public Details Details;
|
||||||
@ -134,6 +136,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
Margin = new MarginPadding { Top = 20 },
|
Margin = new MarginPadding { Top = 20 },
|
||||||
Child = author = new AuthorInfo(),
|
Child = author = new AuthorInfo(),
|
||||||
},
|
},
|
||||||
|
unavailableContainer = new BeatmapNotAvailable(),
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -208,6 +211,18 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
favouriteButton.FadeOut(transition_duration);
|
favouriteButton.FadeOut(transition_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (setInfo.NewValue?.OnlineInfo.Availability?.DownloadDisabled ?? false)
|
||||||
|
{
|
||||||
|
this.ResizeHeightTo(460, transition_duration / 2);
|
||||||
|
unavailableContainer.Show();
|
||||||
|
unavailableContainer.Link = setInfo.NewValue.OnlineInfo.Availability.ExternalLink;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.ResizeHeightTo(400, transition_duration / 2);
|
||||||
|
unavailableContainer.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
updateDownloadButtons();
|
updateDownloadButtons();
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
@ -216,6 +231,14 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
if (BeatmapSet.Value == null) return;
|
if (BeatmapSet.Value == null) return;
|
||||||
|
|
||||||
|
if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false)
|
||||||
|
{
|
||||||
|
downloadButtonsContainer.RemoveAll(x => true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
switch (State.Value)
|
switch (State.Value)
|
||||||
{
|
{
|
||||||
case DownloadState.LocallyAvailable:
|
case DownloadState.LocallyAvailable:
|
||||||
@ -241,4 +264,5 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user