Exemple #1
0
        public DrawableSlider(Slider s)
            : base(s)
        {
            slider = s;

            Position = s.StackedPosition;

            Container<DrawableSliderTick> ticks;
            Container<DrawableRepeatPoint> repeatPoints;

            InternalChildren = new Drawable[]
            {
                Body = new SliderBody(s)
                {
                    PathWidth = s.Scale * 64,
                },
                ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
                repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
                Ball = new SliderBall(s, this)
                {
                    BypassAutoSizeAxes = Axes.Both,
                    Scale = new Vector2(s.Scale),
                    AlwaysPresent = true,
                    Alpha = 0
                },
                HeadCircle = new DrawableSliderHead(s, s.HeadCircle)
                {
                    OnShake = Shake
                },
                TailCircle = new DrawableSliderTail(s, s.TailCircle)
            };

            components.Add(Body);
            components.Add(Ball);

            AddNested(HeadCircle);

            AddNested(TailCircle);
            components.Add(TailCircle);

            foreach (var tick in s.NestedHitObjects.OfType<SliderTick>())
            {
                var drawableTick = new DrawableSliderTick(tick) { Position = tick.Position - s.Position };

                ticks.Add(drawableTick);
                components.Add(drawableTick);
                AddNested(drawableTick);
            }

            foreach (var repeatPoint in s.NestedHitObjects.OfType<RepeatPoint>())
            {
                var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this) { Position = repeatPoint.Position - s.Position };

                repeatPoints.Add(drawableRepeatPoint);
                components.Add(drawableRepeatPoint);
                AddNested(drawableRepeatPoint);
            }

            HitObject.PositionChanged += _ => Position = HitObject.StackedPosition;
        }
Exemple #2
0
        public DrawableSlider(Slider s) : base(s)
        {
            slider = s;

            Children = new Drawable[]
            {
                body = new SliderBody(s)
                {
                    AccentColour = AccentColour,
                    Position     = s.StackedPosition,
                    PathWidth    = s.Scale * 64,
                },
                ticks        = new Container <DrawableSliderTick>(),
                repeatPoints = new Container <DrawableRepeatPoint>(),
                ball         = new SliderBall(s)
                {
                    Scale        = new Vector2(s.Scale),
                    AccentColour = AccentColour
                },
                initialCircle = new DrawableHitCircle(new HitCircle
                {
                    //todo: avoid creating this temporary HitCircle.
                    StartTime   = s.StartTime,
                    Position    = s.StackedPosition,
                    ComboIndex  = s.ComboIndex,
                    Scale       = s.Scale,
                    ComboColour = s.ComboColour,
                    Samples     = s.Samples,
                })
            };

            components.Add(body);
            components.Add(ball);

            AddNested(initialCircle);

            var repeatDuration = s.Curve.Distance / s.Velocity;

            foreach (var tick in s.Ticks)
            {
                var repeatStartTime = s.StartTime + tick.RepeatIndex * repeatDuration;
                var fadeInTime      = repeatStartTime + (tick.StartTime - repeatStartTime) / 2 - (tick.RepeatIndex == 0 ? TIME_FADEIN : TIME_FADEIN / 2);
                var fadeOutTime     = repeatStartTime + repeatDuration;

                var drawableTick = new DrawableSliderTick(tick)
                {
                    FadeInTime  = fadeInTime,
                    FadeOutTime = fadeOutTime,
                    Position    = tick.Position,
                };

                ticks.Add(drawableTick);
                AddNested(drawableTick);
            }

            foreach (var repeatPoint in s.RepeatPoints)
            {
                var repeatStartTime = s.StartTime + repeatPoint.RepeatIndex * repeatDuration;
                var fadeInTime      = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? TIME_FADEIN : TIME_FADEIN / 2);
                var fadeOutTime     = repeatStartTime + repeatDuration;

                var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this)
                {
                    FadeInTime  = fadeInTime,
                    FadeOutTime = fadeOutTime,
                    Position    = repeatPoint.Position,
                };

                repeatPoints.Add(drawableRepeatPoint);
                AddNested(drawableRepeatPoint);
            }
        }
Exemple #3
0
        public DrawableSlider(Slider s)
            : base(s)
        {
            slider = s;

            Children = new Drawable[]
            {
                Body = new SliderBody(s)
                {
                    AccentColour = AccentColour,
                    Position     = s.StackedPosition,
                    PathWidth    = s.Scale * 64,
                },
                ticks        = new Container <DrawableSliderTick>(),
                repeatPoints = new Container <DrawableRepeatPoint>(),
                Ball         = new SliderBall(s)
                {
                    Scale         = new Vector2(s.Scale),
                    AccentColour  = AccentColour,
                    AlwaysPresent = true,
                    Alpha         = 0
                },
                InitialCircle = new DrawableHitCircle(new HitCircle
                {
                    StartTime           = s.StartTime,
                    Position            = s.StackedPosition,
                    IndexInCurrentCombo = s.IndexInCurrentCombo,
                    Scale              = s.Scale,
                    ComboColour        = s.ComboColour,
                    Samples            = s.Samples,
                    SampleControlPoint = s.SampleControlPoint,
                    TimePreempt        = s.TimePreempt,
                    TimeFadein         = s.TimeFadein,
                    HitWindow300       = s.HitWindow300,
                    HitWindow100       = s.HitWindow100,
                    HitWindow50        = s.HitWindow50
                })
            };

            components.Add(Body);
            components.Add(Ball);

            AddNested(InitialCircle);

            foreach (var tick in s.NestedHitObjects.OfType <SliderTick>())
            {
                var spanStartTime = s.StartTime + tick.SpanIndex * s.SpanDuration;
                var fadeInTime    = spanStartTime + (tick.StartTime - spanStartTime) / 2 - (tick.SpanIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
                var fadeOutTime   = spanStartTime + s.SpanDuration;

                var drawableTick = new DrawableSliderTick(tick)
                {
                    FadeInTime  = fadeInTime,
                    FadeOutTime = fadeOutTime,
                    Position    = tick.Position,
                };

                ticks.Add(drawableTick);
                AddNested(drawableTick);
            }

            foreach (var repeatPoint in s.NestedHitObjects.OfType <RepeatPoint>())
            {
                var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this)
                {
                    Position = repeatPoint.Position
                };

                repeatPoints.Add(drawableRepeatPoint);
                components.Add(drawableRepeatPoint);
                AddNested(drawableRepeatPoint);
            }
        }
Exemple #4
0
        public DrawableSlider(Slider s)
            : base(s)
        {
            slider = s;

            Children = new Drawable[]
            {
                Body = new SliderBody(s)
                {
                    AccentColour = AccentColour,
                    Position     = s.StackedPosition,
                    PathWidth    = s.Scale * 64,
                },
                ticks        = new Container <DrawableSliderTick>(),
                repeatPoints = new Container <DrawableRepeatPoint>(),
                Ball         = new SliderBall(s)
                {
                    Scale         = new Vector2(s.Scale),
                    AccentColour  = AccentColour,
                    AlwaysPresent = true,
                    Alpha         = 0
                },
                InitialCircle = new DrawableHitCircle(new HitCircle
                {
                    StartTime          = s.StartTime,
                    Position           = s.StackedPosition,
                    ComboIndex         = s.ComboIndex,
                    Scale              = s.Scale,
                    ComboColour        = s.ComboColour,
                    Samples            = s.Samples,
                    SampleControlPoint = s.SampleControlPoint
                })
            };

            components.Add(Body);
            components.Add(Ball);

            AddNested(InitialCircle);

            var repeatDuration = s.Curve.Distance / s.Velocity;

            foreach (var tick in s.NestedHitObjects.OfType <SliderTick>())
            {
                var repeatStartTime = s.StartTime + tick.RepeatIndex * repeatDuration;
                var fadeInTime      = repeatStartTime + (tick.StartTime - repeatStartTime) / 2 - (tick.RepeatIndex == 0 ? FadeInDuration : FadeInDuration / 2);
                var fadeOutTime     = repeatStartTime + repeatDuration;

                var drawableTick = new DrawableSliderTick(tick)
                {
                    FadeInTime  = fadeInTime,
                    FadeOutTime = fadeOutTime,
                    Position    = tick.Position,
                };

                ticks.Add(drawableTick);
                AddNested(drawableTick);
            }

            foreach (var repeatPoint in s.NestedHitObjects.OfType <RepeatPoint>())
            {
                var repeatStartTime = s.StartTime + repeatPoint.RepeatIndex * repeatDuration;
                var fadeInTime      = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? FadeInDuration : FadeInDuration / 2);
                var fadeOutTime     = repeatStartTime + repeatDuration;

                var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this)
                {
                    FadeInTime  = fadeInTime,
                    FadeOutTime = fadeOutTime,
                    Position    = repeatPoint.Position,
                };

                repeatPoints.Add(drawableRepeatPoint);
                AddNested(drawableRepeatPoint);
            }
        }
Exemple #5
0
        public DrawableSlider(Slider s)
            : base(s)
        {
            slider = s;

            DrawableSliderTail              tail;
            Container <DrawableSliderTick>  ticks;
            Container <DrawableRepeatPoint> repeatPoints;

            Children = new Drawable[]
            {
                Body = new SliderBody(s)
                {
                    AccentColour = AccentColour,
                    Position     = s.StackedPosition,
                    PathWidth    = s.Scale * 64,
                },
                ticks        = new Container <DrawableSliderTick>(),
                repeatPoints = new Container <DrawableRepeatPoint>(),
                Ball         = new SliderBall(s)
                {
                    Scale         = new Vector2(s.Scale),
                    AccentColour  = AccentColour,
                    AlwaysPresent = true,
                    Alpha         = 0
                },
                HeadCircle = new DrawableHitCircle(s.HeadCircle),
                tail       = new DrawableSliderTail(s.TailCircle)
            };

            components.Add(Body);
            components.Add(Ball);

            AddNested(HeadCircle);

            AddNested(tail);
            components.Add(tail);

            foreach (var tick in s.NestedHitObjects.OfType <SliderTick>())
            {
                var drawableTick = new DrawableSliderTick(tick)
                {
                    Position = tick.Position
                };

                ticks.Add(drawableTick);
                components.Add(drawableTick);
                AddNested(drawableTick);
            }

            foreach (var repeatPoint in s.NestedHitObjects.OfType <RepeatPoint>())
            {
                var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this)
                {
                    Position = repeatPoint.Position
                };

                repeatPoints.Add(drawableRepeatPoint);
                components.Add(drawableRepeatPoint);
                AddNested(drawableRepeatPoint);
            }
        }