2019-06-18 05:23:00 +08:00
|
|
|
|
// 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 osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets
|
|
|
|
|
{
|
|
|
|
|
public abstract class BindableRulesetSelector : RulesetSelector
|
|
|
|
|
{
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(Bindable<RulesetInfo> parentRuleset)
|
|
|
|
|
{
|
2019-06-18 06:11:05 +08:00
|
|
|
|
Current.BindTo(parentRuleset);
|
|
|
|
|
Current.BindValueChanged(OnRulesetChanged);
|
2019-06-18 05:23:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-18 06:11:05 +08:00
|
|
|
|
protected virtual void OnRulesetChanged(ValueChangedEvent<RulesetInfo> e)
|
2019-06-18 05:23:00 +08:00
|
|
|
|
{
|
2019-06-18 06:11:05 +08:00
|
|
|
|
if (Current.Disabled)
|
2019-06-18 05:23:00 +08:00
|
|
|
|
{
|
2019-06-18 06:11:05 +08:00
|
|
|
|
return;
|
2019-06-18 05:23:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|