private void Load(TextureStore store) { Body = new SnakingSliderBody(this) { PathRadius = ((1.0f - 0.7f * ((float)Beatmap.Difficulty.CircleSize - 5) / 5) / 2) * 64, AccentColour = Color4.Black }; // lets make it black for now, as almost every Legacy skin uses that. Anchor = Anchor.TopLeft; Origin = Anchor.Centre; Add(Body); SliderBeginCircle.Position = Body.PathOffset; Add(SliderBeginCircle); BindableProgress.ValueChanged += prog => { if (prog.NewValue >= .5) { ((Container)Parent)?.Remove(this); } Body.UpdateProgress(prog.NewValue); }; }
protected override void Update() { base.Update(); Tracking.Value = Ball.Tracking; double completionProgress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1); Ball.UpdateProgress(completionProgress); Body.UpdateProgress(completionProgress); foreach (DrawableHitObject hitObject in NestedHitObjects) { if (hitObject is ITrackSnaking s) { s.UpdateSnakingPosition(slider.Path.PositionAt(Body.SnakedStart ?? 0), slider.Path.PositionAt(Body.SnakedEnd ?? 0)); } if (hitObject is IRequireTracking t) { t.Tracking = Ball.Tracking; } } Size = Body.Size; OriginPosition = Body.PathOffset; if (DrawSize != Vector2.Zero) { var childAnchorPosition = Vector2.Divide(OriginPosition, DrawSize); foreach (var obj in NestedHitObjects) { obj.RelativeAnchorPosition = childAnchorPosition; } Ball.RelativeAnchorPosition = childAnchorPosition; } }
private void Load(TextureStore store) { Body = new SnakingSliderBody(this) { PathRadius = (1.0f - 0.7f * ((float)Beatmap.Difficulty.CircleSize - 5) / 5) / 2 * 64, AccentColour = Color4.Black }; // lets make it black for now, as almost every Legacy skin uses that. Body.SnakingIn.Value = false; Body.SnakingOut.Value = false; Origin = Anchor.TopLeft; Position = StackedPosition; Ball = new SliderBall { Scale = new Vector2(Body.PathRadius) }; SliderBeginCircle = new HitCircle(Beatmap, Body.PathOffset) { BeginTime = BeginTime }; InternalChildren = new Drawable[] { Body, Ball, SliderBeginCircle }; Body.UpdateProgress(0); Ball.Position = this.CurvePositionAt(0); Ball.Scale = new Vector2(Body.PathRadius / 64f); Logger.LogPrint($"B:{BeginTime} E:{EndTime}"); BindableProgress.ValueChanged += prog => { if (prog.NewValue * RepeatCount >= 1) { Hide(); } var progress = prog.NewValue / 2; Body.UpdateProgress(progress); var newPos = this.CurvePositionAt(progress); var diff = _lastPosition.HasValue ? _lastPosition.Value - newPos : newPos - this.CurvePositionAt(progress + 0.01f); if (diff == Vector2.Zero) { return; } Ball.Position = newPos; Ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI); _lastPosition = newPos; }; }