From 72c4a26aeadcc78e4c7a4dd66415e292581d1121 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 4 Oct 2016 13:35:40 -0400 Subject: [PATCH] Move control of databases into osu-framework --- osu.Game/Database/BeatmapDatabase.cs | 5 +++-- osu.Game/OsuGameBase.cs | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 2c318c5997..86c352c81c 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -1,4 +1,5 @@ using System; +using osu.Framework.OS; using SQLite; namespace osu.Game.Database @@ -7,11 +8,11 @@ namespace osu.Game.Database { private static SQLiteConnection Connection { get; set; } - public BeatmapDatabase() + public BeatmapDatabase(BasicStorage storage) { if (Connection == null) { - Connection = new SQLiteConnection("beatmap.db"); + Connection = storage.GetDb("beatmaps"); Connection.CreateTable(); Connection.CreateTable(); Connection.CreateTable(); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 98a5c254bb..89b5229ad9 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -17,7 +17,7 @@ namespace osu.Game public class OsuGameBase : BaseGame { internal OsuConfigManager Config = new OsuConfigManager(); - internal BeatmapDatabase Beatmaps = new BeatmapDatabase(); + internal BeatmapDatabase Beatmaps { get; private set; } protected override string MainResourceFile => @"osu.Game.Resources.dll"; @@ -34,6 +34,8 @@ namespace osu.Game { base.Load(game); + Beatmaps = new BeatmapDatabase(Host.Storage); + //this completely overrides the framework default. will need to change once we make a proper FontStore. Fonts = new TextureStore() { ScaleAdjust = 0.01f }; Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular"));