mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:02:53 +08:00
declare BeatmapSet is not null
This commit is contained in:
parent
09047538c7
commit
e7b34cd4da
@ -21,15 +21,14 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
var beatmap = new APIBeatmap
|
||||
{
|
||||
OnlineBeatmapSetID = 173612
|
||||
OnlineBeatmapSetID = 173612,
|
||||
BeatmapSet = new APIBeatmapSet
|
||||
{
|
||||
OnlineID = 173612
|
||||
}
|
||||
};
|
||||
|
||||
var beatmapset = new APIBeatmapSet
|
||||
{
|
||||
OnlineID = 173612,
|
||||
};
|
||||
|
||||
setupBeatmapResponse(beatmap, beatmapset);
|
||||
setupBeatmapResponse(beatmap);
|
||||
|
||||
AddStep("import score", () =>
|
||||
{
|
||||
@ -62,7 +61,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddUntilStep("Replay missing screen not show", () => Game.ScreenStack.CurrentScreen.GetType() != typeof(ReplayMissingBeatmapScreen));
|
||||
}
|
||||
|
||||
private void setupBeatmapResponse(APIBeatmap b, APIBeatmapSet s)
|
||||
private void setupBeatmapResponse(APIBeatmap b)
|
||||
=> AddStep("setup response", () =>
|
||||
{
|
||||
dummyAPI.HandleRequest = request =>
|
||||
@ -73,12 +72,6 @@ namespace osu.Game.Tests.Visual.Online
|
||||
return true;
|
||||
}
|
||||
|
||||
if (request is GetBeatmapSetRequest getBeatmapSetRequest)
|
||||
{
|
||||
getBeatmapSetRequest.TriggerSuccess(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
});
|
||||
|
@ -18,7 +18,6 @@ using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Settings;
|
||||
@ -57,14 +56,12 @@ namespace osu.Game.Screens.Import
|
||||
private SettingsCheckbox automaticDownload = null!;
|
||||
|
||||
private readonly MemoryStream scoreStream;
|
||||
private readonly APIBeatmap beatmap;
|
||||
|
||||
private APIBeatmapSet? beatmapSetInfo;
|
||||
private readonly APIBeatmapSet beatmapSetInfo;
|
||||
|
||||
public ReplayMissingBeatmapScreen(APIBeatmap beatmap, MemoryStream scoreStream)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
beatmapSetInfo = beatmap.BeatmapSet;
|
||||
beatmapSetInfo = beatmap.BeatmapSet!;
|
||||
|
||||
this.scoreStream = scoreStream;
|
||||
}
|
||||
@ -147,18 +144,6 @@ namespace osu.Game.Screens.Import
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (beatmapSetInfo == null)
|
||||
{
|
||||
var onlineBeatmapRequest = new GetBeatmapSetRequest(beatmap.OnlineBeatmapSetID);
|
||||
|
||||
onlineBeatmapRequest.Success += res =>
|
||||
{
|
||||
beatmapSetInfo = res;
|
||||
updateStatus();
|
||||
};
|
||||
api.Queue(onlineBeatmapRequest);
|
||||
}
|
||||
|
||||
updateStatus();
|
||||
realmSubscription = realm.RegisterForNotifications(
|
||||
realm => realm.All<BeatmapSetInfo>().Where(s => !s.DeletePending), beatmapsChanged);
|
||||
@ -185,8 +170,6 @@ namespace osu.Game.Screens.Import
|
||||
{
|
||||
if (changes?.InsertedIndices == null) return;
|
||||
|
||||
if (beatmapSetInfo == null) return;
|
||||
|
||||
if (!scoreStream.CanRead) return;
|
||||
|
||||
if (sender.Any(b => b.OnlineID == beatmapSetInfo.OnlineID))
|
||||
|
Loading…
Reference in New Issue
Block a user