mirror of
https://github.com/ppy/osu
synced 2025-03-05 02:49:30 +00:00
General fix-ups for slider class.
This commit is contained in:
parent
54fc25e163
commit
e271bcec63
@ -59,15 +59,15 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
Colour = osuObject.Colour,
|
Colour = osuObject.Colour,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//may not be so correct
|
||||||
|
Size = circle.DrawSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
//may not be so correct
|
|
||||||
Size = circle.DrawSize;
|
|
||||||
|
|
||||||
//force application of the state that was set before we loaded.
|
//force application of the state that was set before we loaded.
|
||||||
UpdateState(State);
|
UpdateState(State);
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,53 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Modes.Osu.Objects.Drawables.Pieces;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
class DrawableSlider : DrawableOsuHitObject
|
class DrawableSlider : DrawableOsuHitObject
|
||||||
{
|
{
|
||||||
|
private Path path;
|
||||||
|
private DrawableHitCircle startCircle;
|
||||||
|
private Slider slider;
|
||||||
|
|
||||||
public DrawableSlider(Slider s) : base(s)
|
public DrawableSlider(Slider s) : base(s)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
slider = s;
|
||||||
Position = new Vector2(s.Position.X, s.Position.Y);
|
|
||||||
|
|
||||||
Path sliderPath;
|
Origin = Anchor.TopLeft;
|
||||||
Add(sliderPath = new Path());
|
Position = Vector2.Zero;
|
||||||
|
|
||||||
for (int i = 0; i < s.Curve.Path.Count; ++i)
|
Children = new Drawable[]
|
||||||
sliderPath.Positions.Add(s.Curve.Path[i] - s.Position);
|
|
||||||
|
|
||||||
Add(new DrawableHitCircle(new HitCircle
|
|
||||||
{
|
{
|
||||||
StartTime = s.StartTime,
|
startCircle = new DrawableHitCircle(new HitCircle
|
||||||
Position = sliderPath.Positions[0] - s.Position,
|
{
|
||||||
})
|
StartTime = s.StartTime,
|
||||||
{
|
Position = s.Position,
|
||||||
Depth = 1
|
Colour = s.Colour,
|
||||||
});
|
})
|
||||||
|
{
|
||||||
|
Depth = 1 //override time-based depth.
|
||||||
|
},
|
||||||
|
path = new Path
|
||||||
|
{
|
||||||
|
Colour = s.Colour,
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
for (int i = 0; i < slider.Curve.Path.Count; ++i)
|
||||||
|
path.Positions.Add(slider.Curve.Path[i]);
|
||||||
|
|
||||||
|
path.PathWidth = startCircle.DrawWidth / 4;
|
||||||
|
|
||||||
//force application of the state that was set before we loaded.
|
//force application of the state that was set before we loaded.
|
||||||
UpdateState(State);
|
UpdateState(State);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user