BeatmapSetCover can display other types of covers now

This commit is contained in:
jorolf 2017-11-19 14:16:00 +01:00
parent 7b1083b824
commit fe7f9cccaa

View File

@ -11,21 +11,44 @@ namespace osu.Game.Beatmaps.Drawables
public class BeatmapSetCover : Sprite public class BeatmapSetCover : Sprite
{ {
private readonly BeatmapSetInfo set; private readonly BeatmapSetInfo set;
public BeatmapSetCover(BeatmapSetInfo set) private readonly BeatmapSetCoverType type;
public BeatmapSetCover(BeatmapSetInfo set, BeatmapSetCoverType type = BeatmapSetCoverType.Cover)
{ {
if (set == null) if (set == null)
throw new ArgumentNullException(nameof(set)); throw new ArgumentNullException(nameof(set));
this.set = set; this.set = set;
this.type = type;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures) private void load(TextureStore textures)
{ {
string resource = set.OnlineInfo.Covers.Cover; string resource = null;
switch (type)
{
case BeatmapSetCoverType.Cover:
resource = set.OnlineInfo.Covers.Cover;
break;
case BeatmapSetCoverType.Card:
resource = set.OnlineInfo.Covers.Card;
break;
case BeatmapSetCoverType.List:
resource = set.OnlineInfo.Covers.List;
break;
}
if (resource != null) if (resource != null)
Texture = textures.Get(resource); Texture = textures.Get(resource);
} }
} }
public enum BeatmapSetCoverType
{
Cover,
Card,
List,
}
} }