示例#1
0
        private void load()
        {
            config?.BindWith(OsuRulesetSetting.SnakingInSliders, Body.SnakingIn);
            config?.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut);

            positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
            scaleBindable.BindValueChanged(scale =>
            {
                Body.PathRadius = scale.NewValue * 64;
                Ball.Scale      = new Vector2(scale.NewValue);
            });

            positionBindable.BindTo(HitObject.PositionBindable);
            scaleBindable.BindTo(HitObject.ScaleBindable);
            pathBindable.BindTo(slider.PathBindable);

            pathBindable.BindValueChanged(_ => Body.Refresh());

            AccentColour.BindValueChanged(colour =>
            {
                Body.AccentColour = colour.NewValue;
                Ball.AccentColour = colour.NewValue;

                foreach (var drawableHitObject in NestedHitObjects)
                {
                    drawableHitObject.AccentColour.Value = colour.NewValue;
                }
            }, true);
        }
示例#2
0
        private void load(OsuConfigManager config)
        {
            config.BindWith(OsuSetting.SnakingInSliders, Body.SnakingIn);
            config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut);

            positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
            scaleBindable.BindValueChanged(v =>
            {
                Body.PathWidth = HitObject.Scale * 64;
                Ball.Scale     = new Vector2(HitObject.Scale);
            });

            positionBindable.BindTo(HitObject.PositionBindable);
            scaleBindable.BindTo(HitObject.ScaleBindable);
            pathBindable.BindTo(slider.PathBindable);

            pathBindable.BindValueChanged(_ => Body.Refresh());
        }
示例#3
0
        private void load()
        {
            config?.BindWith(OsuRulesetSetting.SnakingInSliders, Body.SnakingIn);
            config?.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut);

            positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
            scaleBindable.BindValueChanged(scale =>
            {
                Body.PathRadius = scale.NewValue * 64;
                Ball.Scale      = new Vector2(scale.NewValue);
            });

            positionBindable.BindTo(HitObject.PositionBindable);
            scaleBindable.BindTo(HitObject.ScaleBindable);
            pathBindable.BindTo(slider.PathBindable);

            pathBindable.BindValueChanged(_ => Body.Refresh());
        }
示例#4
0
        public DrawableSlider(Slider s)
            : base(s)
        {
            slider = s;

            Position = s.StackedPosition;

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

            InternalChildren = new Drawable[]
            {
                Body = new SnakingSliderBody(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;
            HitObject.ScaleChanged    += _ =>
            {
                Body.PathWidth = HitObject.Scale * 64;
                Ball.Scale     = new Vector2(HitObject.Scale);
            };

            slider.PathChanged += _ => Body.Refresh();
        }