mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Make BeatmapSetOverlay accept nulls everywhere
This commit is contained in:
@ -11,6 +11,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
@ -18,7 +19,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public class Header : Container
|
||||
{
|
||||
private const float transition_duration = 250;
|
||||
private const float transition_duration = 200;
|
||||
private const float tabs_height = 50;
|
||||
private const float buttons_height = 45;
|
||||
private const float buttons_spacing = 5;
|
||||
@ -34,12 +35,13 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
public Details Details;
|
||||
|
||||
private BeatmapManager beatmaps;
|
||||
|
||||
private DelayedLoadWrapper cover;
|
||||
|
||||
public readonly BeatmapPicker Picker;
|
||||
|
||||
private BeatmapSetInfo beatmapSet;
|
||||
private readonly FavouriteButton favouriteButton;
|
||||
|
||||
public BeatmapSetInfo BeatmapSet
|
||||
{
|
||||
get { return beatmapSet; }
|
||||
@ -49,15 +51,26 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
beatmapSet = value;
|
||||
|
||||
Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = BeatmapSet;
|
||||
title.Text = BeatmapSet.Metadata.Title;
|
||||
artist.Text = BeatmapSet.Metadata.Artist;
|
||||
onlineStatusPill.Status = BeatmapSet.OnlineInfo.Status;
|
||||
|
||||
downloadButtonsContainer.FadeIn();
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
title.Text = BeatmapSet?.Metadata.Title ?? string.Empty;
|
||||
artist.Text = BeatmapSet?.Metadata.Artist ?? string.Empty;
|
||||
onlineStatusPill.Status = BeatmapSet?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None;
|
||||
|
||||
cover?.FadeOut(400, Easing.Out);
|
||||
if (BeatmapSet != null)
|
||||
{
|
||||
downloadButtonsContainer.FadeIn(transition_duration);
|
||||
favouriteButton.FadeIn(transition_duration);
|
||||
|
||||
noVideoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 0 : 1, transition_duration);
|
||||
videoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 1 : 0, transition_duration);
|
||||
|
||||
cover?.FadeOut(400, Easing.Out);
|
||||
coverContainer.Add(cover = new DelayedLoadWrapper(
|
||||
new BeatmapSetCover(BeatmapSet)
|
||||
{
|
||||
@ -71,6 +84,11 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
downloadButtonsContainer.FadeOut(transition_duration);
|
||||
favouriteButton.FadeOut(transition_duration);
|
||||
}
|
||||
}
|
||||
|
||||
public Header()
|
||||
@ -166,7 +184,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FavouriteButton(),
|
||||
favouriteButton = new FavouriteButton(),
|
||||
downloadButtonsContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -238,6 +256,8 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
this.beatmaps = beatmaps;
|
||||
|
||||
beatmaps.ItemAdded += handleBeatmapAdd;
|
||||
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
Reference in New Issue
Block a user