Refactor database to reuse existing types

This commit is contained in:
Drew DeVault
2016-10-07 13:50:34 -04:00
parent 23bc26ddac
commit e9a45de51f
11 changed files with 44 additions and 67 deletions

View File

@ -1,21 +0,0 @@
using System;
using SQLite;
namespace osu.Game.Database
{
public class Beatmap
{
[PrimaryKey]
public int ID { get; set; }
[NotNull, Indexed]
public int BeatmapSetID { get; set; }
[Indexed]
public int BeatmapMetadataID { get; set; }
public float DrainRate { get; set; }
public float CircleSize { get; set; }
public float OverallDifficulty { get; set; }
public float ApproachRate { get; set; }
public float SliderMultiplier { get; set; }
public float SliderTickRate { get; set; }
}
}

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using osu.Framework.OS;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.IO;
using SQLite;
@ -52,7 +53,7 @@ namespace osu.Game.Database
var decoder = BeatmapDecoder.GetDecoder(stream);
var beatmap = decoder.Decode(stream);
maps.Add(new Beatmap
{
{
BeatmapID = beatmap.BeatmapID,
BeatmapSetID = metadata.BeatmapSetID,
// TODO: Import more things

View File

@ -1,23 +0,0 @@
using System;
using osu.Game.GameModes.Play;
using SQLite;
namespace osu.Game.Database
{
public class BeatmapMetadata
{
[PrimaryKey]
public int ID { get; set; }
public string Title { get; set; }
public string TitleUnicode { get; set; }
public string Artist { get; set; }
public string ArtistUnicode { get; set; }
public string Author { get; set; }
public string Source { get; set; }
public string Tags { get; set; }
public PlayMode Mode { get; set; }
public int PreviewTime { get; set; }
public string AudioFile { get; set; }
public string BackgroundFile { get; set; }
}
}

View File

@ -1,14 +0,0 @@
using System;
using SQLite;
namespace osu.Game.Database
{
public class BeatmapSet
{
[PrimaryKey]
public int BeatmapSetID { get; set; }
[NotNull, Indexed]
public int BeatmapMetadataID { get; set; }
}
}