Merge pull request #13908 from peppy/editor-disallow-placement-when-untimed

Fix editor composer allowing object placement without timing present
This commit is contained in:
Dan Balasescu
2021-07-19 18:37:19 +09:00
committed by GitHub
7 changed files with 141 additions and 54 deletions

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
@ -63,10 +64,12 @@ namespace osu.Game.Rulesets.Edit
private InputManager inputManager;
private RadioButtonCollection toolboxCollection;
private EditorRadioButtonCollection toolboxCollection;
private FillFlowContainer togglesCollection;
private IBindable<bool> hasTiming;
protected HitObjectComposer(Ruleset ruleset)
{
Ruleset = ruleset;
@ -126,7 +129,7 @@ namespace osu.Game.Rulesets.Edit
{
new ToolboxGroup("toolbox (1-9)")
{
Child = toolboxCollection = new RadioButtonCollection { RelativeSizeAxes = Axes.X }
Child = toolboxCollection = new EditorRadioButtonCollection { RelativeSizeAxes = Axes.X }
},
new ToolboxGroup("toggles (Q~P)")
{
@ -160,6 +163,14 @@ namespace osu.Game.Rulesets.Edit
base.LoadComplete();
inputManager = GetContainingInputManager();
hasTiming = EditorBeatmap.HasTiming.GetBoundCopy();
hasTiming.BindValueChanged(timing =>
{
// it's important this is performed before the similar code in EditorRadioButton disables the button.
if (!timing.NewValue)
setSelectTool();
});
}
public override Playfield Playfield => drawableRulesetWrapper.Playfield;
@ -219,7 +230,8 @@ namespace osu.Game.Rulesets.Edit
if (item != null)
{
item.Select();
if (!item.Selected.Disabled)
item.Select();
return true;
}
}