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

Bind ruleset to toolbar later for safety

This commit is contained in:
Dean Herbert 2022-01-10 16:31:28 +09:00
parent 605898ec53
commit c33e163178

View File

@ -58,8 +58,11 @@ namespace osu.Game.Overlays.Toolbar
AlwaysPresent = false;
}
[Resolved]
private Bindable<RulesetInfo> ruleset { get; set; }
[BackgroundDependencyLoader(true)]
private void load(OsuGame osuGame, Bindable<RulesetInfo> parentRuleset)
private void load(OsuGame osuGame)
{
Children = new Drawable[]
{
@ -106,13 +109,17 @@ namespace osu.Game.Overlays.Toolbar
}
};
// Bound after the selector is added to the hierarchy to give it a chance to load the available rulesets
rulesetSelector.Current.BindTo(parentRuleset);
if (osuGame != null)
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
}
protected override void LoadComplete()
{
base.LoadComplete();
rulesetSelector.Current.BindTo(ruleset);
}
public class ToolbarBackground : Container
{
private readonly Box gradientBackground;