2019-01-24 08:43:03 +00: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.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Drawables
|
|
|
|
|
{
|
2019-11-01 10:40:45 +00:00
|
|
|
|
[LongRunningLoad]
|
2018-04-13 09:19:50 +00:00
|
|
|
|
public class BeatmapSetCover : Sprite
|
|
|
|
|
{
|
|
|
|
|
private readonly BeatmapSetInfo set;
|
|
|
|
|
private readonly BeatmapSetCoverType type;
|
|
|
|
|
|
|
|
|
|
public BeatmapSetCover(BeatmapSetInfo set, BeatmapSetCoverType type = BeatmapSetCoverType.Cover)
|
|
|
|
|
{
|
|
|
|
|
if (set == null)
|
|
|
|
|
throw new ArgumentNullException(nameof(set));
|
|
|
|
|
|
|
|
|
|
this.set = set;
|
|
|
|
|
this.type = type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2018-12-27 13:13:51 +00:00
|
|
|
|
private void load(LargeTextureStore textures)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
string resource = null;
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case BeatmapSetCoverType.Cover:
|
|
|
|
|
resource = set.OnlineInfo.Covers.Cover;
|
|
|
|
|
break;
|
2019-04-01 03:44:46 +00:00
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
case BeatmapSetCoverType.Card:
|
|
|
|
|
resource = set.OnlineInfo.Covers.Card;
|
|
|
|
|
break;
|
2019-04-01 03:44:46 +00:00
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
case BeatmapSetCoverType.List:
|
|
|
|
|
resource = set.OnlineInfo.Covers.List;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (resource != null)
|
2018-08-30 22:04:40 +00:00
|
|
|
|
Texture = textures.Get(resource);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum BeatmapSetCoverType
|
|
|
|
|
{
|
|
|
|
|
Cover,
|
|
|
|
|
Card,
|
|
|
|
|
List,
|
|
|
|
|
}
|
|
|
|
|
}
|