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

Use new loading layer in beatmap listing overlay

This commit is contained in:
Dean Herbert 2020-02-21 16:13:24 +09:00
parent dacbbb5eee
commit 2bda310fa7

View File

@ -15,6 +15,7 @@ using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Overlays.BeatmapListing; using osu.Game.Overlays.BeatmapListing;
using osu.Game.Overlays.Direct; using osu.Game.Overlays.Direct;
@ -34,7 +35,6 @@ namespace osu.Game.Overlays
private SearchBeatmapSetsRequest getSetsRequest; private SearchBeatmapSetsRequest getSetsRequest;
private Container panelsPlaceholder;
private Drawable currentContent; private Drawable currentContent;
private BeatmapListingSearchSection searchSection; private BeatmapListingSearchSection searchSection;
private BeatmapListingSortTabControl sortControl; private BeatmapListingSortTabControl sortControl;
@ -121,12 +121,21 @@ namespace osu.Game.Overlays
} }
} }
}, },
panelsPlaceholder = new Container new Container
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Horizontal = 20 }, Padding = new MarginPadding { Horizontal = 20 },
} Children = new Drawable[]
{
panelTarget = new Container
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
},
loadingLayer = new LoadingLayer(panelTarget),
}
},
} }
} }
} }
@ -160,6 +169,9 @@ namespace osu.Game.Overlays
private ScheduledDelegate queryChangedDebounce; private ScheduledDelegate queryChangedDebounce;
private LoadingLayer loadingLayer;
private Container panelTarget;
private void queueUpdateSearch(bool queryTextChanged = false) private void queueUpdateSearch(bool queryTextChanged = false)
{ {
getSetsRequest?.Cancel(); getSetsRequest?.Cancel();
@ -181,7 +193,7 @@ namespace osu.Game.Overlays
previewTrackManager.StopAnyPlaying(this); previewTrackManager.StopAnyPlaying(this);
currentContent?.FadeColour(Color4.DimGray, 400, Easing.OutQuint); loadingLayer.Show();
getSetsRequest = new SearchBeatmapSetsRequest( getSetsRequest = new SearchBeatmapSetsRequest(
searchSection.Query.Value, searchSection.Query.Value,
@ -229,6 +241,8 @@ namespace osu.Game.Overlays
private void addContentToPlaceholder(Drawable content) private void addContentToPlaceholder(Drawable content)
{ {
loadingLayer.Hide();
Drawable lastContent = currentContent; Drawable lastContent = currentContent;
if (lastContent != null) if (lastContent != null)
@ -242,7 +256,7 @@ namespace osu.Game.Overlays
lastContent.Delay(25).Schedule(() => lastContent.BypassAutoSizeAxes = Axes.Y); lastContent.Delay(25).Schedule(() => lastContent.BypassAutoSizeAxes = Axes.Y);
} }
panelsPlaceholder.Add(currentContent = content); panelTarget.Add(currentContent = content);
currentContent.FadeIn(200, Easing.OutQuint); currentContent.FadeIn(200, Easing.OutQuint);
} }