mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09: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:
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
@ -18,6 +19,12 @@ namespace osu.Game.Rulesets
|
|||||||
{
|
{
|
||||||
foreach (var r in Rulesets.AvailableRulesets)
|
foreach (var r in Rulesets.AvailableRulesets)
|
||||||
AddItem(r);
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user