1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 23:22:55 +08:00

Add add/remove buttons

This commit is contained in:
Dean Herbert 2019-10-22 21:50:21 +09:00
parent 4883844c4c
commit 5e22eed131

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -13,6 +14,8 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osuTK;
namespace osu.Game.Screens.Edit.Timing
{
@ -51,9 +54,14 @@ namespace osu.Game.Screens.Edit.Timing
public class ControlPointList : CompositeDrawable
{
private OsuButton deleteButton;
[Resolved]
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
[Resolved]
private Bindable<IEnumerable<ControlPoint>> selectedPoints { get; set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@ -73,9 +81,52 @@ namespace osu.Game.Screens.Edit.Timing
{
ControlPoints = Beatmap.Value.Beatmap.ControlPointInfo.AllControlPoints
}
}
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding(10),
Spacing = new Vector2(5),
Children = new Drawable[]
{
deleteButton = new OsuButton
{
Text = "-",
Size = new Vector2(30, 30),
Action = delete,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
},
new OsuButton
{
Text = "+",
Action = addNew,
Size = new Vector2(30, 30),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
},
}
},
};
}
protected override void LoadComplete()
{
base.LoadComplete();
selectedPoints.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true);
}
private void delete()
{
}
private void addNew()
{
}
}
}
}