mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:33:20 +08:00
Cleanups
This commit is contained in:
parent
cc8531790a
commit
13279f707b
@ -2,9 +2,7 @@
|
||||
// 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.Graphics;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||
@ -12,15 +10,12 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
||||
{
|
||||
public class HitCirclePiece : CompositeDrawable
|
||||
public class HitCirclePiece : HitObjectPiece
|
||||
{
|
||||
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
||||
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||
|
||||
private readonly HitCircle hitCircle;
|
||||
|
||||
public HitCirclePiece(HitCircle hitCircle)
|
||||
: base(hitCircle)
|
||||
{
|
||||
this.hitCircle = hitCircle;
|
||||
Origin = Anchor.Centre;
|
||||
@ -37,13 +32,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
||||
{
|
||||
Colour = colours.Yellow;
|
||||
|
||||
positionBindable.BindValueChanged(_ => UpdatePosition());
|
||||
stackHeightBindable.BindValueChanged(_ => UpdatePosition());
|
||||
scaleBindable.BindValueChanged(v => Scale = new Vector2(v));
|
||||
|
||||
positionBindable.BindTo(hitCircle.PositionBindable);
|
||||
stackHeightBindable.BindTo(hitCircle.StackHeightBindable);
|
||||
scaleBindable.BindTo(hitCircle.ScaleBindable);
|
||||
PositionBindable.BindValueChanged(_ => UpdatePosition(), true);
|
||||
StackHeightBindable.BindValueChanged(_ => UpdatePosition());
|
||||
ScaleBindable.BindValueChanged(v => Scale = new Vector2(v), true);
|
||||
}
|
||||
|
||||
protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition;
|
||||
|
36
osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
Normal file
36
osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
Normal file
@ -0,0 +1,36 @@
|
||||
// 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.Containers;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints
|
||||
{
|
||||
/// <summary>
|
||||
/// A piece of a blueprint which responds to changes in the state of a <see cref="OsuHitObject"/>.
|
||||
/// </summary>
|
||||
public abstract class HitObjectPiece : CompositeDrawable
|
||||
{
|
||||
protected readonly IBindable<Vector2> PositionBindable = new Bindable<Vector2>();
|
||||
protected readonly IBindable<int> StackHeightBindable = new Bindable<int>();
|
||||
protected readonly IBindable<float> ScaleBindable = new Bindable<float>();
|
||||
|
||||
private readonly OsuHitObject hitObject;
|
||||
|
||||
protected HitObjectPiece(OsuHitObject hitObject)
|
||||
{
|
||||
this.hitObject = hitObject;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
PositionBindable.BindTo(hitObject.PositionBindable);
|
||||
StackHeightBindable.BindTo(hitObject.StackHeightBindable);
|
||||
ScaleBindable.BindTo(hitObject.ScaleBindable);
|
||||
}
|
||||
}
|
||||
}
|
32
osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
Normal file
32
osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
Normal file
@ -0,0 +1,32 @@
|
||||
// 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.Game.Rulesets.Osu.Objects;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints
|
||||
{
|
||||
/// <summary>
|
||||
/// A piece of a blueprint which responds to changes in the state of a <see cref="Slider"/>.
|
||||
/// </summary>
|
||||
public abstract class SliderPiece : HitObjectPiece
|
||||
{
|
||||
protected readonly IBindable<Vector2[]> ControlPointsBindable = new Bindable<Vector2[]>();
|
||||
|
||||
private readonly Slider slider;
|
||||
|
||||
protected SliderPiece(Slider slider)
|
||||
: base(slider)
|
||||
{
|
||||
this.slider = slider;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
ControlPointsBindable.BindTo(slider.ControlPointsBindable);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,23 +2,20 @@
|
||||
// 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
|
||||
public class PathControlPointVisualiser : SliderPiece
|
||||
{
|
||||
private readonly IBindable<Vector2[]> controlPointsBindable = new Bindable<Vector2[]>();
|
||||
|
||||
private readonly Slider slider;
|
||||
|
||||
private readonly Container<PathControlPointPiece> pieces;
|
||||
|
||||
public PathControlPointVisualiser(Slider slider)
|
||||
: base(slider)
|
||||
{
|
||||
this.slider = slider;
|
||||
|
||||
@ -28,8 +25,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
controlPointsBindable.BindValueChanged(_ => updatePathControlPoints());
|
||||
controlPointsBindable.BindTo(slider.ControlPointsBindable);
|
||||
ControlPointsBindable.BindValueChanged(_ => updatePathControlPoints(), true);
|
||||
}
|
||||
|
||||
private void updatePathControlPoints()
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||
@ -13,15 +11,13 @@ using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
{
|
||||
public class SliderBodyPiece : CompositeDrawable
|
||||
public class SliderBodyPiece : SliderPiece
|
||||
{
|
||||
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||
|
||||
private readonly Slider slider;
|
||||
private readonly ManualSliderBody body;
|
||||
|
||||
public SliderBodyPiece(Slider slider)
|
||||
: base(slider)
|
||||
{
|
||||
this.slider = slider;
|
||||
|
||||
@ -37,11 +33,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
{
|
||||
body.BorderColour = colours.Yellow;
|
||||
|
||||
positionBindable.BindValueChanged(_ => updatePosition());
|
||||
scaleBindable.BindValueChanged(v => body.PathWidth = v * 64);
|
||||
|
||||
positionBindable.BindTo(slider.PositionBindable);
|
||||
scaleBindable.BindTo(slider.ScaleBindable);
|
||||
PositionBindable.BindValueChanged(_ => updatePosition(), true);
|
||||
ScaleBindable.BindValueChanged(v => body.PathWidth = v * 64, true);
|
||||
}
|
||||
|
||||
private void updatePosition() => Position = slider.StackedPosition;
|
||||
|
@ -2,7 +2,6 @@
|
||||
// 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.Framework.Graphics.Shapes;
|
||||
@ -13,17 +12,14 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
|
||||
{
|
||||
public class SpinnerPiece : CompositeDrawable
|
||||
public class SpinnerPiece : HitObjectPiece
|
||||
{
|
||||
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
||||
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||
|
||||
private readonly Spinner spinner;
|
||||
private readonly CircularContainer circle;
|
||||
private readonly RingPiece ring;
|
||||
|
||||
public SpinnerPiece(Spinner spinner)
|
||||
: base(spinner)
|
||||
{
|
||||
this.spinner = spinner;
|
||||
|
||||
@ -57,13 +53,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
|
||||
{
|
||||
Colour = colours.Yellow;
|
||||
|
||||
positionBindable.BindValueChanged(_ => updatePosition());
|
||||
stackHeightBindable.BindValueChanged(_ => updatePosition());
|
||||
scaleBindable.BindValueChanged(v => ring.Scale = new Vector2(v));
|
||||
|
||||
positionBindable.BindTo(spinner.PositionBindable);
|
||||
stackHeightBindable.BindTo(spinner.StackHeightBindable);
|
||||
scaleBindable.BindTo(spinner.ScaleBindable);
|
||||
PositionBindable.BindValueChanged(_ => updatePosition(), true);
|
||||
StackHeightBindable.BindValueChanged(_ => updatePosition());
|
||||
ScaleBindable.BindValueChanged(v => ring.Scale = new Vector2(v), true);
|
||||
}
|
||||
|
||||
private void updatePosition() => Position = spinner.Position;
|
||||
|
Loading…
Reference in New Issue
Block a user