Make BeatmapOnlineInfo and BeatmapSetOnlineInfo separate classes, -OnlineWorkingBeatmap

This commit is contained in:
DrabWeb
2017-05-28 00:37:55 -03:00
parent e67a00f1f6
commit ab32e962ca
10 changed files with 102 additions and 88 deletions

View File

@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@ -36,7 +37,7 @@ namespace osu.Game.Overlays.Direct
protected Drawable GetBackground(TextureStore textures)
{
return new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(SetInfo.Beatmaps.FirstOrDefault(), textures, null))
return new AsyncLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo)
{
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
@ -84,5 +85,22 @@ namespace osu.Game.Overlays.Direct
Value = value;
}
}
private class BeatmapSetBackgroundSprite : Sprite
{
private readonly BeatmapSetInfo set;
public BeatmapSetBackgroundSprite(BeatmapSetInfo set)
{
this.set = set;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
if (set.OnlineInfo?.Covers.FirstOrDefault() != null)
Texture = textures.Get(set.OnlineInfo.Covers.First());
}
}
}
}