1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 04:02:59 +08:00

Merge pull request #8903 from peppy/carousel-loading-spinner

Show loading spinner when carousel is not ready to be displayed
This commit is contained in:
Dan Balasescu 2020-04-30 21:29:53 +09:00 committed by GitHub
commit 5740563391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 15 deletions

View File

@ -797,6 +797,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
AddUntilStep("wait for carousel loaded", () => songSelect.Carousel.IsAlive);
}
private void addManyTestMaps()

View File

@ -34,6 +34,7 @@ using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Graphics.UserInterface;
using osu.Game.Scoring;
namespace osu.Game.Screens.Select
@ -77,7 +78,7 @@ namespace osu.Game.Screens.Select
protected BeatmapCarousel Carousel { get; private set; }
private DifficultyRecommender recommender;
private readonly DifficultyRecommender recommender = new DifficultyRecommender();
private BeatmapInfoWedge beatmapInfoWedge;
private DialogOverlay dialogOverlay;
@ -92,6 +93,8 @@ namespace osu.Game.Screens.Select
private SampleChannel sampleChangeDifficulty;
private SampleChannel sampleChangeBeatmap;
private Container carouselContainer;
protected BeatmapDetailArea BeatmapDetails { get; private set; }
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
@ -105,9 +108,22 @@ namespace osu.Game.Screens.Select
// initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
transferRulesetValue();
LoadComponentAsync(Carousel = new BeatmapCarousel
{
AllowSelection = false, // delay any selection until our bindables are ready to make a good choice.
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Both,
BleedTop = FilterControl.HEIGHT,
BleedBottom = Footer.HEIGHT,
SelectionChanged = updateSelectedBeatmap,
BeatmapSetsChanged = carouselBeatmapsLoaded,
GetRecommendedBeatmap = recommender.GetRecommendedBeatmap,
}, c => carouselContainer.Child = c);
AddRangeInternal(new Drawable[]
{
recommender = new DifficultyRecommender(),
recommender,
new ResetScrollContainer(() => Carousel.ScrollToSelected())
{
RelativeSizeAxes = Axes.Y,
@ -139,7 +155,7 @@ namespace osu.Game.Screens.Select
Padding = new MarginPadding { Right = -150 },
},
},
new Container
carouselContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding
@ -147,18 +163,7 @@ namespace osu.Game.Screens.Select
Top = FilterControl.HEIGHT,
Bottom = Footer.HEIGHT
},
Child = Carousel = new BeatmapCarousel
{
AllowSelection = false, // delay any selection until our bindables are ready to make a good choice.
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Both,
BleedTop = FilterControl.HEIGHT,
BleedBottom = Footer.HEIGHT,
SelectionChanged = updateSelectedBeatmap,
BeatmapSetsChanged = carouselBeatmapsLoaded,
GetRecommendedBeatmap = recommender.GetRecommendedBeatmap,
},
Child = new LoadingSpinner(true) { State = { Value = Visibility.Visible } }
}
},
}