mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 05:43:21 +08:00
Fix carousel filtering twice on startup due to unpopulated ruleset
This commit is contained in:
parent
bca1be0bfa
commit
280c1a0eb4
@ -46,40 +46,40 @@ namespace osu.Game.Screens.Select
|
|||||||
protected const float BACKGROUND_BLUR = 20;
|
protected const float BACKGROUND_BLUR = 20;
|
||||||
private const float left_area_padding = 20;
|
private const float left_area_padding = 20;
|
||||||
|
|
||||||
public readonly FilterControl FilterControl;
|
public FilterControl FilterControl;
|
||||||
|
|
||||||
protected virtual bool ShowFooter => true;
|
protected virtual bool ShowFooter => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be null if <see cref="ShowFooter"/> is false.
|
/// Can be null if <see cref="ShowFooter"/> is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly BeatmapOptionsOverlay BeatmapOptions;
|
protected BeatmapOptionsOverlay BeatmapOptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be null if <see cref="ShowFooter"/> is false.
|
/// Can be null if <see cref="ShowFooter"/> is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly Footer Footer;
|
protected Footer Footer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains any panel which is triggered by a footer button.
|
/// Contains any panel which is triggered by a footer button.
|
||||||
/// Helps keep them located beneath the footer itself.
|
/// Helps keep them located beneath the footer itself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly Container FooterPanels;
|
protected Container FooterPanels;
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
|
||||||
|
|
||||||
protected readonly BeatmapCarousel Carousel;
|
protected BeatmapCarousel Carousel;
|
||||||
private readonly BeatmapInfoWedge beatmapInfoWedge;
|
private BeatmapInfoWedge beatmapInfoWedge;
|
||||||
private DialogOverlay dialogOverlay;
|
private DialogOverlay dialogOverlay;
|
||||||
private BeatmapManager beatmaps;
|
private BeatmapManager beatmaps;
|
||||||
|
|
||||||
protected readonly ModSelectOverlay ModSelect;
|
protected ModSelectOverlay ModSelect;
|
||||||
|
|
||||||
protected SampleChannel SampleConfirm;
|
protected SampleChannel SampleConfirm;
|
||||||
private SampleChannel sampleChangeDifficulty;
|
private SampleChannel sampleChangeDifficulty;
|
||||||
private SampleChannel sampleChangeBeatmap;
|
private SampleChannel sampleChangeBeatmap;
|
||||||
|
|
||||||
protected readonly BeatmapDetailArea BeatmapDetails;
|
protected BeatmapDetailArea BeatmapDetails;
|
||||||
|
|
||||||
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
@ -90,8 +90,14 @@ namespace osu.Game.Screens.Select
|
|||||||
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||||
private readonly Bindable<IReadOnlyList<Mod>> mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>()); // Bound to the game's mods, but is not reset on exiting
|
private readonly Bindable<IReadOnlyList<Mod>> mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>()); // Bound to the game's mods, but is not reset on exiting
|
||||||
|
|
||||||
protected SongSelect()
|
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria) => Carousel.Filter(criteria);
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
|
||||||
{
|
{
|
||||||
|
// transfer initial value so filter is in a good state (it uses our re-cached bindables).
|
||||||
|
transferRulesetValue();
|
||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
new ParallaxContainer
|
new ParallaxContainer
|
||||||
@ -215,13 +221,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
BeatmapDetails.Leaderboard.ScoreSelected += score => this.Push(new SoloResults(score));
|
BeatmapDetails.Leaderboard.ScoreSelected += score => this.Push(new SoloResults(score));
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria) => Carousel.Filter(criteria);
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
|
||||||
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
|
|
||||||
{
|
|
||||||
if (Footer != null)
|
if (Footer != null)
|
||||||
{
|
{
|
||||||
Footer.AddButton(new FooterButtonMods { Current = mods }, ModSelect);
|
Footer.AddButton(new FooterButtonMods { Current = mods }, ModSelect);
|
||||||
@ -640,7 +640,7 @@ namespace osu.Game.Screens.Select
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// manual binding to parent ruleset to allow for delayed load in the incoming direction.
|
// manual binding to parent ruleset to allow for delayed load in the incoming direction.
|
||||||
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
|
transferRulesetValue();
|
||||||
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
|
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
|
||||||
|
|
||||||
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
|
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
|
||||||
@ -652,6 +652,11 @@ namespace osu.Game.Screens.Select
|
|||||||
boundLocalBindables = true;
|
boundLocalBindables = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void transferRulesetValue()
|
||||||
|
{
|
||||||
|
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
|
||||||
|
}
|
||||||
|
|
||||||
private void delete(BeatmapSetInfo beatmap)
|
private void delete(BeatmapSetInfo beatmap)
|
||||||
{
|
{
|
||||||
if (beatmap == null || beatmap.ID <= 0) return;
|
if (beatmap == null || beatmap.ID <= 0) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user