1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00

Fade out existing panel on beatmap change

This commit is contained in:
Andrei Zavatski 2019-08-08 12:08:51 +03:00
parent 08a92c38d7
commit e9b5c91690

View File

@ -19,6 +19,7 @@ namespace osu.Game.Screens.Multi.Match.Components
private RulesetStore rulesets { get; set; } private RulesetStore rulesets { get; set; }
private GetBeatmapSetRequest request; private GetBeatmapSetRequest request;
private DirectGridPanel panel;
public MatchBeatmapPanel() public MatchBeatmapPanel()
{ {
@ -30,16 +31,23 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
CurrentItem.BindValueChanged(item => CurrentItem.BindValueChanged(item =>
{ {
request?.Cancel();
if (panel != null)
{
panel.FadeOut(200);
panel.Expire();
panel = null;
}
var onlineId = item.NewValue?.Beatmap.OnlineBeatmapID ?? 0; var onlineId = item.NewValue?.Beatmap.OnlineBeatmapID ?? 0;
if (onlineId != 0) if (onlineId != 0)
{ {
request?.Cancel();
request = new GetBeatmapSetRequest(onlineId, BeatmapSetLookupType.BeatmapId); request = new GetBeatmapSetRequest(onlineId, BeatmapSetLookupType.BeatmapId);
request.Success += beatmap => request.Success += beatmap =>
{ {
ClearInternal(); panel = new DirectGridPanel(beatmap.ToBeatmapSet(rulesets));
var panel = new DirectGridPanel(beatmap.ToBeatmapSet(rulesets));
LoadComponentAsync(panel, p => { AddInternal(panel); }); LoadComponentAsync(panel, p => { AddInternal(panel); });
}; };
api.Queue(request); api.Queue(request);