mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 03:22:55 +08:00
Disable RulesetToggleButton whenever the ruleset can't be changed
This commit is contained in:
parent
306f05b7bd
commit
ca574f2345
@ -49,14 +49,14 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
private Drawable icon
|
||||
{
|
||||
get { return iconContainer.Icon; }
|
||||
set { iconContainer.Icon = value; }
|
||||
get => iconContainer.Icon;
|
||||
set => iconContainer.Icon = value;
|
||||
}
|
||||
|
||||
private RulesetInfo ruleset;
|
||||
public RulesetInfo Ruleset
|
||||
{
|
||||
get { return ruleset; }
|
||||
get => ruleset;
|
||||
set
|
||||
{
|
||||
ruleset = value;
|
||||
@ -73,6 +73,9 @@ namespace osu.Game.Overlays.Direct
|
||||
iconContainer.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100);
|
||||
}
|
||||
|
||||
public override bool HandleKeyboardInput => !bindable.Disabled && base.HandleKeyboardInput;
|
||||
public override bool HandleMouseInput => !bindable.Disabled && base.HandleMouseInput;
|
||||
|
||||
public RulesetToggleButton(Bindable<RulesetInfo> bindable, RulesetInfo ruleset)
|
||||
{
|
||||
this.bindable = bindable;
|
||||
@ -90,6 +93,7 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
Ruleset = ruleset;
|
||||
bindable.ValueChanged += Bindable_ValueChanged;
|
||||
bindable.DisabledChanged += isDisabled => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300);
|
||||
Bindable_ValueChanged(bindable.Value);
|
||||
Action = () => bindable.Value = Ruleset;
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault();
|
||||
}
|
||||
|
||||
public override bool HandleKeyboardInput => !ruleset.Disabled;
|
||||
public override bool HandleMouseInput => !ruleset.Disabled;
|
||||
public override bool HandleKeyboardInput => !ruleset.Disabled && base.HandleKeyboardInput;
|
||||
public override bool HandleMouseInput => !ruleset.Disabled && base.HandleMouseInput;
|
||||
|
||||
private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user