1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:42:54 +08:00

Update ToLive usages in line with recent changes

This commit is contained in:
Dean Herbert 2021-12-17 18:45:22 +09:00
parent 31a3161189
commit 1f9318265e
4 changed files with 10 additions and 10 deletions

View File

@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
private void load(GameHost host, AudioManager audio)
{
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, Beatmap.Default));
Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, ContextFactory, rulesets, API, audio, Resources, host, Beatmap.Default));
}
public override void SetUpSteps()
@ -827,7 +827,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddStep("join other user", () => client.AddUser(new APIUser { Id = 1234 }));
AddStep("add item as other user", () => client.AddUserPlaylistItem(1234, new MultiplayerPlaylistItem(new PlaylistItem
{
BeatmapID = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.RulesetID == 0)).BeatmapInfo.OnlineID ?? -1
BeatmapID = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.RulesetID == 0)).BeatmapInfo.OnlineID
})));
AddUntilStep("item arrived in playlist", () => client.Room?.Playlist.Count == 2);
@ -858,7 +858,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddStep("join other user", () => client.AddUser(new APIUser { Id = 1234 }));
AddStep("add item as other user", () => client.AddUserPlaylistItem(1234, new MultiplayerPlaylistItem(new PlaylistItem
{
BeatmapID = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.RulesetID == 0)).BeatmapInfo.OnlineID ?? -1
BeatmapID = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.RulesetID == 0)).BeatmapInfo.OnlineID
})));
AddUntilStep("item arrived in playlist", () => client.Room?.Playlist.Count == 2);

View File

@ -166,7 +166,7 @@ namespace osu.Game.Beatmaps
return context.All<BeatmapSetInfo>()
.Where(b => !b.DeletePending)
.Where(query)
.ToLive();
.ToLive(contextFactory);
}
}
@ -178,7 +178,7 @@ namespace osu.Game.Beatmaps
public ILive<BeatmapSetInfo>? QueryBeatmapSet(Expression<Func<BeatmapSetInfo, bool>> query)
{
using (var context = contextFactory.CreateContext())
return context.All<BeatmapSetInfo>().FirstOrDefault(query)?.ToLive();
return context.All<BeatmapSetInfo>().FirstOrDefault(query)?.ToLive(contextFactory);
}
/// <summary>

View File

@ -52,7 +52,7 @@ namespace osu.Game.Scoring
public ILive<ScoreInfo> Query(Expression<Func<ScoreInfo, bool>> query)
{
using (var context = contextFactory.CreateContext())
return context.All<ScoreInfo>().FirstOrDefault(query)?.ToLive();
return context.All<ScoreInfo>().FirstOrDefault(query)?.ToLive(contextFactory);
}
/// <summary>

View File

@ -82,9 +82,9 @@ namespace osu.Game.Screens.Menu
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game, RealmContextFactory realmContextFactory)
{
// prevent user from changing beatmap while the intro is still runnning.
// prevent user from changing beatmap while the intro is still running.
beatmap = Beatmap.BeginLease(false);
MenuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Menu
if (sets.Count > 0)
{
setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo?.PerformRead(s => s.Beatmaps[0].ToLive()));
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo?.PerformRead(s => s.Beatmaps[0].ToLive(realmContextFactory)));
}
}
@ -131,7 +131,7 @@ namespace osu.Game.Screens.Menu
if (setInfo == null)
return false;
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.PerformRead(s => s.Beatmaps[0].ToLive()));
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.PerformRead(s => s.Beatmaps[0].ToLive(realmContextFactory)));
return UsingThemedIntro = initialBeatmap != null;
}