mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08:00
Show loading spinner when carousel is not ready to be displayed
This commit is contained in:
parent
c3ef1d3170
commit
cf4e79cf38
@ -797,6 +797,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
|
AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
|
||||||
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
|
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("wait for carousel loaded", () => songSelect.Carousel.IsAlive);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addManyTestMaps()
|
private void addManyTestMaps()
|
||||||
|
@ -34,6 +34,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
@ -92,6 +93,8 @@ namespace osu.Game.Screens.Select
|
|||||||
private SampleChannel sampleChangeDifficulty;
|
private SampleChannel sampleChangeDifficulty;
|
||||||
private SampleChannel sampleChangeBeatmap;
|
private SampleChannel sampleChangeBeatmap;
|
||||||
|
|
||||||
|
private Container carouselContainer;
|
||||||
|
|
||||||
protected BeatmapDetailArea BeatmapDetails { get; private set; }
|
protected BeatmapDetailArea BeatmapDetails { get; private set; }
|
||||||
|
|
||||||
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
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).
|
// initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
|
||||||
transferRulesetValue();
|
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[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
recommender = new DifficultyRecommender(),
|
recommender,
|
||||||
new ResetScrollContainer(() => Carousel.ScrollToSelected())
|
new ResetScrollContainer(() => Carousel.ScrollToSelected())
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
@ -139,7 +155,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Padding = new MarginPadding { Right = -150 },
|
Padding = new MarginPadding { Right = -150 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new Container
|
carouselContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
@ -147,18 +163,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Top = FilterControl.HEIGHT,
|
Top = FilterControl.HEIGHT,
|
||||||
Bottom = Footer.HEIGHT
|
Bottom = Footer.HEIGHT
|
||||||
},
|
},
|
||||||
Child = Carousel = new BeatmapCarousel
|
Child = new LoadingSpinner(true) { State = { Value = Visibility.Visible } }
|
||||||
{
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user