public CytusSliderTick(double time, float x, float y, CytusSliderTick next) : base(time, x, y, next)
 {
 }
 public CytusDrawableSliderTick(CytusSliderTick hitObject, float x, float y, TextureStore textures) : base(hitObject, x, y, textures)
 {
     Size /= 1.5f;
 }
        protected override IEnumerable <CytusHitObject> ConvertHitObject(HitObject original, IBeatmap beatmap)
        {
            if (!(original is IHasXPosition))
            {
                throw new Exception($"This hitobject of type {original.GetType().Name} is not a {nameof(IHasXPosition)}!");
            }

            double time = original.StartTime;
            float  x    = ((IHasXPosition)original).X;
            float  y    = beatmap.GetScanPosition(original.StartTime, Constants.BeatsPerScan);

            // we have to determine if this is a slider or normal hitobject
            // TODO: check for IHasRepeats
            if (original is IHasCurve ihc)
            {
                CytusSliderTick lastTick;
                double          endTime      = ihc.EndTime;
                var             tp           = beatmap.ControlPointInfo.TimingPointAt(time);
                double          tickInterval = tp.BeatLength / (int)tp.TimeSignature;
                SliderCurve     curve        = ihc.Curve ?? new SliderCurve {
                    ControlPoints = ihc.ControlPoints,
                    CurveType     = ihc.CurveType,
                    Distance      = ihc.Distance,
                    Offset        = Vector2.Zero
                };

                var end = lastTick = new CytusSliderEnd(endTime, x + curve.PositionAt(1).X, beatmap.GetScanPosition(endTime, Constants.BeatsPerScan))
                {
                    Samples            = original.Samples,
                    SampleControlPoint = original.SampleControlPoint
                };

                var ticks = new List <CytusSliderTick>();
                for (double i = endTime - tickInterval; i >= time + tickInterval / 2; i -= tickInterval)
                {
                    ticks.Add(lastTick = new CytusSliderTick(i, x + curve.PositionAt((i - time) / (endTime - time)).X, beatmap.GetScanPosition(i, Constants.BeatsPerScan), lastTick)
                    {
                        Samples            = original.Samples,
                        SampleControlPoint = original.SampleControlPoint
                    });
                }

                var start = new CytusSliderHead(original.StartTime, x, y, lastTick)
                {
                    Samples            = original.Samples,
                    SampleControlPoint = original.SampleControlPoint
                };

                yield return(start);

                foreach (var tick in ticks)
                {
                    yield return(tick);
                }
                yield return(end);
            }
            else
            {
                // This is a normal note
                yield return(new CytusNote(time, x, y)
                {
                    Samples = original.Samples,
                    SampleControlPoint = original.SampleControlPoint
                });
            }
        }
 public CytusDrawableSliderEnd(CytusSliderTick hitObject, float x, float y, TextureStore textures) : base(hitObject, x, y, textures)
 {
     // Don't show the arrow, since we're the last one
     SliderArrow.Hide();
 }
Ejemplo n.º 5
0
 public CytusSliderHead(double time, float x, float y, CytusSliderTick next) : base(time, x, y)
 {
     Next = next;
 }