Use bindables for hitobject events

This commit is contained in:
smoogipoo
2018-11-09 13:58:46 +09:00
parent 0833ba2692
commit cc8531790a
12 changed files with 150 additions and 96 deletions

View File

@ -1,14 +1,19 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Osu.Objects;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
public class PathControlPointVisualiser : CompositeDrawable
{
private readonly IBindable<Vector2[]> controlPointsBindable = new Bindable<Vector2[]>();
private readonly Slider slider;
private readonly Container<PathControlPointPiece> pieces;
@ -18,9 +23,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
this.slider = slider;
InternalChild = pieces = new Container<PathControlPointPiece> { RelativeSizeAxes = Axes.Both };
}
slider.ControlPointsChanged += _ => updatePathControlPoints();
updatePathControlPoints();
[BackgroundDependencyLoader]
private void load()
{
controlPointsBindable.BindValueChanged(_ => updatePathControlPoints());
controlPointsBindable.BindTo(slider.ControlPointsBindable);
}
private void updatePathControlPoints()