1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Fix ruleset selector not updating to the first ruleset item until after LoadComplete()

This fixes the whole issue behind `Ruleset.Value` being null, by
updating `Current` on BDL rather than waiting for the base logic which
executes at `LoadComplete`.

This seems like something that should happen at the base `TabControl` class itself, by switching `Current` right after the first added tab item, rather than doing it on `LoadComplete`, but I'm not sure about changing framework logic outright, so fixing this locally until it occurs on other places.
This commit is contained in:
Salman Ahmed 2021-08-22 15:29:24 +03:00
parent f390e9a156
commit d164529be8

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Allocation;
@ -18,6 +19,12 @@ namespace osu.Game.Rulesets
{
foreach (var r in Rulesets.AvailableRulesets)
AddItem(r);
// This is supposed to be an implicit process in the base class, but the problem is that it happens in LoadComplete.
// That can become an issue with overlays that require access to the initial ruleset value
// before the ruleset selectors reached a LoadComplete state.
// (e.g. displaying RankingsOverlay for the first time).
Current.Value = Items.First();
}
}
}