From e271bcec635da3309f266c3ecd96222bcae004dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 28 Nov 2016 12:40:24 +0900 Subject: [PATCH] General fix-ups for slider class. --- .../Objects/Drawables/DrawableHitCircle.cs | 6 +-- .../Objects/Drawables/DrawableSlider.cs | 43 +++++++++++++------ 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/osu.Game.Mode.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Mode.Osu/Objects/Drawables/DrawableHitCircle.cs index 8bead0fe53..47657eea80 100644 --- a/osu.Game.Mode.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Mode.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -59,15 +59,15 @@ namespace osu.Game.Modes.Osu.Objects.Drawables Colour = osuObject.Colour, } }; + + //may not be so correct + Size = circle.DrawSize; } protected override void LoadComplete() { base.LoadComplete(); - //may not be so correct - Size = circle.DrawSize; - //force application of the state that was set before we loaded. UpdateState(State); } diff --git a/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs index 5a67a849d8..672867c607 100644 --- a/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs @@ -1,38 +1,53 @@ using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Objects.Drawables.Pieces; using OpenTK; using osu.Framework.Graphics.Sprites; +using OpenTK.Graphics; namespace osu.Game.Modes.Osu.Objects.Drawables { class DrawableSlider : DrawableOsuHitObject { + private Path path; + private DrawableHitCircle startCircle; + private Slider slider; + public DrawableSlider(Slider s) : base(s) { - Origin = Anchor.Centre; - Position = new Vector2(s.Position.X, s.Position.Y); + slider = s; - Path sliderPath; - Add(sliderPath = new Path()); + Origin = Anchor.TopLeft; + Position = Vector2.Zero; - for (int i = 0; i < s.Curve.Path.Count; ++i) - sliderPath.Positions.Add(s.Curve.Path[i] - s.Position); - - Add(new DrawableHitCircle(new HitCircle + Children = new Drawable[] { - StartTime = s.StartTime, - Position = sliderPath.Positions[0] - s.Position, - }) - { - Depth = 1 - }); + startCircle = new DrawableHitCircle(new HitCircle + { + StartTime = s.StartTime, + Position = s.Position, + Colour = s.Colour, + }) + { + Depth = 1 //override time-based depth. + }, + path = new Path + { + Colour = s.Colour, + } + }; } protected override void 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. UpdateState(State); }