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

Show loading spinner when carousel is not ready to be displayed

This commit is contained in:
Dean Herbert 2020-04-30 11:51:06 +09:00
parent c3ef1d3170
commit cf4e79cf38
2 changed files with 20 additions and 14 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
@ -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 = new DifficultyRecommender()).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 } }
}
},
}