mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
extract method
This commit is contained in:
parent
4c43c92329
commit
1bdd054bd6
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user