Pull beatmap list from db and render simple list

This commit is contained in:
Drew DeVault 2016-10-19 10:31:10 -04:00
parent 2ef516a6fa
commit a14edc06c8
4 changed files with 28 additions and 8 deletions

View File

@ -8,7 +8,7 @@ namespace osu.Game.Database
{ {
public class BeatmapMetadata public class BeatmapMetadata
{ {
[PrimaryKey] [PrimaryKey, AutoIncrement]
public int ID { get; set; } public int ID { get; set; }
public int BeatmapSetID { get; set; } public int BeatmapSetID { get; set; }

View File

@ -4,21 +4,33 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.GameModes.Backgrounds; using osu.Game.GameModes.Backgrounds;
using osu.Framework; using osu.Framework;
namespace osu.Game.GameModes.Play namespace osu.Game.GameModes.Play
{ {
class PlaySongSelect : GameModeWhiteBox class PlaySongSelect : OsuGameMode
{ {
private Bindable<PlayMode> playMode; private Bindable<PlayMode> playMode;
// TODO: use currently selected track as bg
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
protected override IEnumerable<Type> PossibleChildren => new[] { private FlowContainer setList;
typeof(ModSelect),
typeof(Player) private void addBeatmapSets()
}; {
var sets = (Game as OsuGame).Beatmaps.GetBeatmapSets();
foreach (var beatmapSet in sets)
{
setList.Add(new SpriteText
{
Text = beatmapSet.Metadata.Title
});
}
}
public override void Load(BaseGame game) public override void Load(BaseGame game)
{ {
@ -28,6 +40,14 @@ namespace osu.Game.GameModes.Play
playMode = osu.PlayMode; playMode = osu.PlayMode;
playMode.ValueChanged += PlayMode_ValueChanged; playMode.ValueChanged += PlayMode_ValueChanged;
Add(setList = new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
Padding = new OpenTK.Vector2(0, osu.Toolbar.Height)
});
addBeatmapSets();
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)