示例#1
0
        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);
            };
        }
示例#2
0
文件: HitSlider.cs 项目: Mempler/Qsor
        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;
            };
        }