mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +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
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
@ -12,15 +10,12 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
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;
|
private readonly HitCircle hitCircle;
|
||||||
|
|
||||||
public HitCirclePiece(HitCircle hitCircle)
|
public HitCirclePiece(HitCircle hitCircle)
|
||||||
|
: base(hitCircle)
|
||||||
{
|
{
|
||||||
this.hitCircle = hitCircle;
|
this.hitCircle = hitCircle;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
@ -37,13 +32,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
|||||||
{
|
{
|
||||||
Colour = colours.Yellow;
|
Colour = colours.Yellow;
|
||||||
|
|
||||||
positionBindable.BindValueChanged(_ => UpdatePosition());
|
PositionBindable.BindValueChanged(_ => UpdatePosition(), true);
|
||||||
stackHeightBindable.BindValueChanged(_ => UpdatePosition());
|
StackHeightBindable.BindValueChanged(_ => UpdatePosition());
|
||||||
scaleBindable.BindValueChanged(v => Scale = new Vector2(v));
|
ScaleBindable.BindValueChanged(v => Scale = new Vector2(v), true);
|
||||||
|
|
||||||
positionBindable.BindTo(hitCircle.PositionBindable);
|
|
||||||
stackHeightBindable.BindTo(hitCircle.StackHeightBindable);
|
|
||||||
scaleBindable.BindTo(hitCircle.ScaleBindable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition;
|
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
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
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 Slider slider;
|
||||||
|
|
||||||
private readonly Container<PathControlPointPiece> pieces;
|
private readonly Container<PathControlPointPiece> pieces;
|
||||||
|
|
||||||
public PathControlPointVisualiser(Slider slider)
|
public PathControlPointVisualiser(Slider slider)
|
||||||
|
: base(slider)
|
||||||
{
|
{
|
||||||
this.slider = slider;
|
this.slider = slider;
|
||||||
|
|
||||||
@ -28,8 +25,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
controlPointsBindable.BindValueChanged(_ => updatePathControlPoints());
|
ControlPointsBindable.BindValueChanged(_ => updatePathControlPoints(), true);
|
||||||
controlPointsBindable.BindTo(slider.ControlPointsBindable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePathControlPoints()
|
private void updatePathControlPoints()
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
@ -13,15 +11,13 @@ using OpenTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
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 Slider slider;
|
||||||
private readonly ManualSliderBody body;
|
private readonly ManualSliderBody body;
|
||||||
|
|
||||||
public SliderBodyPiece(Slider slider)
|
public SliderBodyPiece(Slider slider)
|
||||||
|
: base(slider)
|
||||||
{
|
{
|
||||||
this.slider = slider;
|
this.slider = slider;
|
||||||
|
|
||||||
@ -37,11 +33,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
{
|
{
|
||||||
body.BorderColour = colours.Yellow;
|
body.BorderColour = colours.Yellow;
|
||||||
|
|
||||||
positionBindable.BindValueChanged(_ => updatePosition());
|
PositionBindable.BindValueChanged(_ => updatePosition(), true);
|
||||||
scaleBindable.BindValueChanged(v => body.PathWidth = v * 64);
|
ScaleBindable.BindValueChanged(v => body.PathWidth = v * 64, true);
|
||||||
|
|
||||||
positionBindable.BindTo(slider.PositionBindable);
|
|
||||||
scaleBindable.BindTo(slider.ScaleBindable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePosition() => Position = slider.StackedPosition;
|
private void updatePosition() => Position = slider.StackedPosition;
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -13,17 +12,14 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
|
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 Spinner spinner;
|
||||||
private readonly CircularContainer circle;
|
private readonly CircularContainer circle;
|
||||||
private readonly RingPiece ring;
|
private readonly RingPiece ring;
|
||||||
|
|
||||||
public SpinnerPiece(Spinner spinner)
|
public SpinnerPiece(Spinner spinner)
|
||||||
|
: base(spinner)
|
||||||
{
|
{
|
||||||
this.spinner = spinner;
|
this.spinner = spinner;
|
||||||
|
|
||||||
@ -57,13 +53,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
|
|||||||
{
|
{
|
||||||
Colour = colours.Yellow;
|
Colour = colours.Yellow;
|
||||||
|
|
||||||
positionBindable.BindValueChanged(_ => updatePosition());
|
PositionBindable.BindValueChanged(_ => updatePosition(), true);
|
||||||
stackHeightBindable.BindValueChanged(_ => updatePosition());
|
StackHeightBindable.BindValueChanged(_ => updatePosition());
|
||||||
scaleBindable.BindValueChanged(v => ring.Scale = new Vector2(v));
|
ScaleBindable.BindValueChanged(v => ring.Scale = new Vector2(v), true);
|
||||||
|
|
||||||
positionBindable.BindTo(spinner.PositionBindable);
|
|
||||||
stackHeightBindable.BindTo(spinner.StackHeightBindable);
|
|
||||||
scaleBindable.BindTo(spinner.ScaleBindable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePosition() => Position = spinner.Position;
|
private void updatePosition() => Position = spinner.Position;
|
||||||
|
Loading…
Reference in New Issue
Block a user