mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Fix RulesetStore preparation
This commit is contained in:
parent
8b01f8671f
commit
4653470779
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Ionic.Zip;
|
using Ionic.Zip;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
@ -15,14 +16,13 @@ using osu.Framework.Logging;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Beatmaps.IO;
|
using osu.Game.Beatmaps.IO;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.IPC;
|
using osu.Game.IPC;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Online.API.Requests;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Online.API;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
@ -302,10 +302,6 @@ namespace osu.Game.Beatmaps
|
|||||||
if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
||||||
return DefaultBeatmap;
|
return DefaultBeatmap;
|
||||||
|
|
||||||
// TODO Include()
|
|
||||||
//lock (beatmaps)
|
|
||||||
// beatmaps.Populate(beatmapInfo);
|
|
||||||
|
|
||||||
if (beatmapInfo.BeatmapSet == null)
|
if (beatmapInfo.BeatmapSet == null)
|
||||||
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoId} is not in the local database.");
|
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoId} is not in the local database.");
|
||||||
|
|
||||||
@ -339,10 +335,6 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
BeatmapSetInfo set = beatmaps.QueryBeatmapSet(query);
|
BeatmapSetInfo set = beatmaps.QueryBeatmapSet(query);
|
||||||
|
|
||||||
// TODO Include()
|
|
||||||
//if (set != null)
|
|
||||||
// beatmaps.Populate(set);
|
|
||||||
|
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,10 +365,6 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
BeatmapInfo set = beatmaps.QueryBeatmap(query);
|
BeatmapInfo set = beatmaps.QueryBeatmap(query);
|
||||||
|
|
||||||
// TODO Include()
|
|
||||||
//if (set != null)
|
|
||||||
// beatmaps.Populate(set);
|
|
||||||
|
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +387,6 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
if (ZipFile.IsZipFile(path))
|
if (ZipFile.IsZipFile(path))
|
||||||
return new OszArchiveReader(storage.GetStream(path));
|
return new OszArchiveReader(storage.GetStream(path));
|
||||||
else
|
|
||||||
return new LegacyFilesystemReader(path);
|
return new LegacyFilesystemReader(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,15 +492,11 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
|
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="populate">Whether returned objects should be pre-populated with all data.</param>
|
|
||||||
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
||||||
public List<BeatmapSetInfo> GetAllUsableBeatmapSets(bool populate = true)
|
public List<BeatmapSetInfo> GetAllUsableBeatmapSets()
|
||||||
{
|
{
|
||||||
lock (beatmaps)
|
lock (beatmaps)
|
||||||
{
|
{
|
||||||
if (populate)
|
|
||||||
return beatmaps.QueryBeatmapSets(b => !b.DeletePending);
|
|
||||||
else
|
|
||||||
return beatmaps.QueryBeatmapSets(b => !b.DeletePending);
|
return beatmaps.QueryBeatmapSets(b => !b.DeletePending);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,6 @@ namespace osu.Game.IO
|
|||||||
accurateRefCount.ReferenceCount += f.Count();
|
accurateRefCount.ReferenceCount += f.Count();
|
||||||
return accurateRefCount;
|
return accurateRefCount;
|
||||||
});
|
});
|
||||||
//Connection.FileInfo.UpdateRange(incrementedFiles);
|
|
||||||
Connection.SaveChanges();
|
Connection.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +103,6 @@ namespace osu.Game.IO
|
|||||||
return accurateRefCount;
|
return accurateRefCount;
|
||||||
});
|
});
|
||||||
|
|
||||||
//Connection.FileInfo.UpdateRange(incrementedFiles);
|
|
||||||
Connection.SaveChanges();
|
Connection.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ namespace osu.Game.Rulesets
|
|||||||
Connection.RulesetInfo.Add(rulesetInfo);
|
Connection.RulesetInfo.Add(rulesetInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Connection.SaveChanges();
|
||||||
|
|
||||||
//add any other modes
|
//add any other modes
|
||||||
foreach (var r in instances.Where(r => r.LegacyID < 0))
|
foreach (var r in instances.Where(r => r.LegacyID < 0))
|
||||||
@ -65,6 +66,7 @@ namespace osu.Game.Rulesets
|
|||||||
if (existing == null)
|
if (existing == null)
|
||||||
Connection.RulesetInfo.Add(us);
|
Connection.RulesetInfo.Add(us);
|
||||||
}
|
}
|
||||||
|
Connection.SaveChanges();
|
||||||
|
|
||||||
//perform a consistency check
|
//perform a consistency check
|
||||||
foreach (var r in Connection.RulesetInfo)
|
foreach (var r in Connection.RulesetInfo)
|
||||||
@ -78,8 +80,6 @@ namespace osu.Game.Rulesets
|
|||||||
{
|
{
|
||||||
r.Available = false;
|
r.Available = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Connection.RulesetInfo.Update(r);
|
|
||||||
}
|
}
|
||||||
Connection.SaveChanges();
|
Connection.SaveChanges();
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
if (!menuMusic)
|
if (!menuMusic)
|
||||||
{
|
{
|
||||||
var sets = beatmaps.GetAllUsableBeatmapSets(false);
|
var sets = beatmaps.GetAllUsableBeatmapSets();
|
||||||
if (sets.Count > 0)
|
if (sets.Count > 0)
|
||||||
setInfo = beatmaps.QueryBeatmapSet(s => s.Id == sets[RNG.Next(0, sets.Count - 1)].Id);
|
setInfo = beatmaps.QueryBeatmapSet(s => s.Id == sets[RNG.Next(0, sets.Count - 1)].Id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user