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