1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Allow to set database of music controller.

This commit is contained in:
Huo Yaoyuan 2016-10-27 16:58:40 +08:00
parent 6482184a09
commit 3e30935d10

View File

@ -28,13 +28,20 @@ namespace osu.Game.Overlays
private SpriteText title, artist; private SpriteText title, artist;
private OsuGameBase osuGame; private OsuGameBase osuGame;
private List<BeatmapSetInfo> playList; private List<BeatmapSetInfo> playList;
private BeatmapDatabase database;
private BeatmapSetInfo currentPlay; private BeatmapSetInfo currentPlay;
public AudioTrack CurrentTrack { get; set; }//TODO:gets exterally public AudioTrack CurrentTrack { get; set; }//TODO:gets exterally
public MusicController(BeatmapDatabase db = null)
{
database = db;
}
public override void Load(BaseGame game) public override void Load(BaseGame game)
{ {
base.Load(game); base.Load(game);
osuGame = game as OsuGameBase; osuGame = game as OsuGameBase;
playList = osuGame.Beatmaps.Query<BeatmapSetInfo>().ToList(); if (database == null) database = osuGame.Beatmaps;
playList = database.Query<BeatmapSetInfo>().ToList();
currentPlay = playList.FirstOrDefault(); currentPlay = playList.FirstOrDefault();
Width = 400; Width = 400;
Height = 130; Height = 130;