1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 14:12:56 +08:00

extract method

This commit is contained in:
cdwcgt 2023-08-02 18:15:58 +09:00
parent 4c43c92329
commit 1bdd054bd6
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2

View File

@ -64,6 +64,8 @@ namespace osu.Game.Screens.Import
public ReplayMissingBeatmapScreen(APIBeatmap beatmap, MemoryStream? scoreStream = null)
{
this.beatmap = beatmap;
beatmapSetInfo = beatmap.BeatmapSet;
this.scoreStream = scoreStream;
}
@ -145,21 +147,32 @@ namespace osu.Game.Screens.Import
{
base.LoadComplete();
var onlineBeatmapRequest = new GetBeatmapSetRequest(beatmap.OnlineBeatmapSetID);
onlineBeatmapRequest.Success += res =>
if (beatmapSetInfo == null)
{
beatmapSetInfo = res;
beatmapPanelContainer.Child = new BeatmapCardNormal(res, allowExpansion: false);
checkForAutomaticDownload(res);
};
var onlineBeatmapRequest = new GetBeatmapSetRequest(beatmap.OnlineBeatmapSetID);
api.Queue(onlineBeatmapRequest);
onlineBeatmapRequest.Success += res =>
{
beatmapSetInfo = res;
updateStatus();
};
api.Queue(onlineBeatmapRequest);
}
updateStatus();
realmSubscription = realm.RegisterForNotifications(
realm => realm.All<BeatmapSetInfo>().Where(s => !s.DeletePending), beatmapsChanged);
}
private void updateStatus()
{
if (beatmapSetInfo == null) return;
beatmapPanelContainer.Clear();
beatmapPanelContainer.Child = new BeatmapCardNormal(beatmapSetInfo, allowExpansion: false);
checkForAutomaticDownload(beatmapSetInfo);
}
private void checkForAutomaticDownload(APIBeatmapSet beatmap)
{
if (!automaticDownload.Current.Value)