mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 02:32:55 +08:00
Allow intro screen to retrieve beatmap even if rulesets is not loaded
This commit is contained in:
parent
51edb0f073
commit
77149044a5
@ -365,6 +365,10 @@ namespace osu.Game.Beatmaps
|
|||||||
queryable = beatmaps.BeatmapSetsOverview;
|
queryable = beatmaps.BeatmapSetsOverview;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IncludedDetails.AllButRuleset:
|
||||||
|
queryable = beatmaps.BeatmapSetsWithoutRuleset;
|
||||||
|
break;
|
||||||
|
|
||||||
case IncludedDetails.AllButFiles:
|
case IncludedDetails.AllButFiles:
|
||||||
queryable = beatmaps.BeatmapSetsWithoutFiles;
|
queryable = beatmaps.BeatmapSetsWithoutFiles;
|
||||||
break;
|
break;
|
||||||
@ -384,8 +388,33 @@ namespace osu.Game.Beatmaps
|
|||||||
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
|
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query">The query.</param>
|
/// <param name="query">The query.</param>
|
||||||
|
/// <param name="includes">The level of detail to include in the returned objects.</param>
|
||||||
/// <returns>Results from the provided query.</returns>
|
/// <returns>Results from the provided query.</returns>
|
||||||
public IEnumerable<BeatmapSetInfo> QueryBeatmapSets(Expression<Func<BeatmapSetInfo, bool>> query) => beatmaps.ConsumableItems.AsNoTracking().Where(query);
|
public IEnumerable<BeatmapSetInfo> QueryBeatmapSets(Expression<Func<BeatmapSetInfo, bool>> query, IncludedDetails includes = IncludedDetails.All)
|
||||||
|
{
|
||||||
|
IQueryable<BeatmapSetInfo> queryable;
|
||||||
|
|
||||||
|
switch (includes)
|
||||||
|
{
|
||||||
|
case IncludedDetails.Minimal:
|
||||||
|
queryable = beatmaps.BeatmapSetsOverview;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IncludedDetails.AllButRuleset:
|
||||||
|
queryable = beatmaps.BeatmapSetsWithoutRuleset;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IncludedDetails.AllButFiles:
|
||||||
|
queryable = beatmaps.BeatmapSetsWithoutFiles;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
queryable = beatmaps.ConsumableItems;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return queryable.AsNoTracking().Where(query);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform a lookup query on available <see cref="BeatmapInfo"/>s.
|
/// Perform a lookup query on available <see cref="BeatmapInfo"/>s.
|
||||||
@ -554,6 +583,11 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
AllButFiles,
|
AllButFiles,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Include everything except ruleset. Used for cases where we aren't sure the ruleset is present but still want to consume the beatmap.
|
||||||
|
/// </summary>
|
||||||
|
AllButRuleset,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Include everything.
|
/// Include everything.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -92,6 +92,13 @@ namespace osu.Game.Beatmaps
|
|||||||
.Include(s => s.Beatmaps)
|
.Include(s => s.Beatmaps)
|
||||||
.AsNoTracking();
|
.AsNoTracking();
|
||||||
|
|
||||||
|
public IQueryable<BeatmapSetInfo> BeatmapSetsWithoutRuleset => ContextFactory.Get().BeatmapSetInfo
|
||||||
|
.Include(s => s.Metadata)
|
||||||
|
.Include(s => s.Files).ThenInclude(f => f.FileInfo)
|
||||||
|
.Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty)
|
||||||
|
.Include(s => s.Beatmaps).ThenInclude(b => b.Metadata)
|
||||||
|
.AsNoTracking();
|
||||||
|
|
||||||
public IQueryable<BeatmapSetInfo> BeatmapSetsWithoutFiles => ContextFactory.Get().BeatmapSetInfo
|
public IQueryable<BeatmapSetInfo> BeatmapSetsWithoutFiles => ContextFactory.Get().BeatmapSetInfo
|
||||||
.Include(s => s.Metadata)
|
.Include(s => s.Metadata)
|
||||||
.Include(s => s.Beatmaps).ThenInclude(s => s.Ruleset)
|
.Include(s => s.Beatmaps).ThenInclude(s => s.Ruleset)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
@ -109,7 +110,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
bool loadThemedIntro()
|
bool loadThemedIntro()
|
||||||
{
|
{
|
||||||
setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash);
|
setInfo = beatmaps.QueryBeatmapSets(b => b.Hash == BeatmapHash, IncludedDetails.AllButRuleset).FirstOrDefault();
|
||||||
|
|
||||||
if (setInfo == null)
|
if (setInfo == null)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user