public override float GetNoteX(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var trackCount          = animationMetrics.TrackCount;
            var endLeftMarginRatio  = animationMetrics.NoteEndXRatios[0];
            var endRightMarginRatio = animationMetrics.NoteEndXRatios[trackCount - 1];

            var endXRatio = endLeftMarginRatio + (endRightMarginRatio - endLeftMarginRatio) * (note.EndX / (trackCount - 1));

            var   onStage = NoteAnimationHelper.GetOnStageStatusOf(note, now, animationMetrics);
            float xRatio;

            switch (onStage)
            {
            case OnStageStatus.Incoming:
                if (note.HasPrevHold())
                {
                    xRatio = GetIncomingNoteXRatio(note.PrevHold, note, now, animationMetrics);
                }
                else if (note.HasPrevSlide())
                {
                    xRatio = GetIncomingNoteXRatio(note.PrevSlide, note, now, animationMetrics);
                }
                else
                {
                    xRatio = endXRatio;
                }
                break;

            case OnStageStatus.Passed:
                if (note.HasNextSlide())
                {
                    var destXRatio = endLeftMarginRatio + (endRightMarginRatio - endLeftMarginRatio) * (note.NextSlide.EndX / (trackCount - 1));
                    var nextPerc   = (float)(now - note.HitTime) / (float)(note.NextSlide.HitTime - note.HitTime);
                    xRatio = MathHelper.Lerp(endXRatio, destXRatio, nextPerc);
                }
                else
                {
                    xRatio = endXRatio;
                }
                break;

            default:
                var startLeftMarginRatio  = animationMetrics.NoteStartXRatios[0];
                var startRightMarginRatio = animationMetrics.NoteStartXRatios[trackCount - 1];

                float whichStartToTake;
                if (note.IsSlide())
                {
                    whichStartToTake = note.EndX;
                }
                else
                {
                    if (note.StartX < 0)
                    {
                        whichStartToTake = note.StartX * 0.5f;
                    }
                    else if (note.StartX > trackCount - 1)
                    {
                        whichStartToTake = (trackCount - 1) + (note.StartX - (trackCount - 1)) * 0.5f;
                    }
                    else
                    {
                        whichStartToTake = note.StartX;
                    }
                }

                var startXRatio = startLeftMarginRatio + (startRightMarginRatio - startLeftMarginRatio) * (whichStartToTake / (trackCount - 1));

                var timePoints = NoteAnimationHelper.CalculateNoteTimePoints(note, animationMetrics);
                var perc       = (now - timePoints.Enter) / timePoints.Duration;

                xRatio = (float)MathHelper.Lerp(startXRatio, endXRatio, perc);
                break;
            }

            return(animationMetrics.Width * xRatio);
        }
Exemple #2
0
        public override RibbonParameters GetHoldRibbonParameters(RuntimeNote startNote, RuntimeNote endNote, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var t1   = (float)GetTransformedTime(startNote, now, animationMetrics);
            var t2   = (float)GetTransformedTime(endNote, now, animationMetrics);
            var tmid = (t1 + t2) * 0.5f;

            var x1   = GetNoteXByTransformedTime(startNote, t1, animationMetrics);
            var x2   = GetNoteXByTransformedTime(endNote, t2, animationMetrics);
            var xmid = GetNoteXByTransformedTime(endNote, tmid, animationMetrics);

            var y1   = GetNoteYByTransformedTime(t1, animationMetrics);
            var y2   = GetNoteYByTransformedTime(t2, animationMetrics);
            var ymid = GetNoteYByTransformedTime(tmid, animationMetrics);

            var(controlX1, controlX2) = GetBezierFromQuadratic(x1, xmid, x2);
            var(controlY1, controlY2) = GetBezierFromQuadratic(y1, ymid, y2);

            return(new RibbonParameters(x1, y1, controlX1, controlY1, controlX2, controlY2, x2, y2));
        }
Exemple #3
0
 public override float GetSpecialNoteY(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
 {
     return(GetNoteY(note, now, noteMetrics, animationMetrics));
 }
Exemple #4
0
 public override Vector2 GetNoteRadius(RuntimeNote note, float now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
 {
     return(noteMetrics.EndRadius);
 }
Exemple #5
0
        public override float GetNoteX(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            if (note.IsSlide() && note.HasNextSlide())
            {
                var thisStatus = NoteAnimationHelper.GetOnStageStatusOf(note, now, animationMetrics);
                if (thisStatus >= OnStageStatus.Passed)
                {
                    var nextSlide  = note.NextSlide;
                    var nextStatus = NoteAnimationHelper.GetOnStageStatusOf(nextSlide, now, animationMetrics);
                    if (nextStatus < OnStageStatus.Passed)
                    {
                        var x1 = GetEndXByNotePosition(note.EndX, animationMetrics);
                        var x2 = GetEndXByNotePosition(nextSlide.EndX, animationMetrics);
                        return((float)((now - note.HitTime) / (nextSlide.HitTime - note.HitTime)) * (x2 - x1) + x1);
                    }
                }
            }

            var transformedTime = GetTransformedTime(note, now, animationMetrics);

            return(GetNoteXByTransformedTime(note, transformedTime, animationMetrics));
        }
Exemple #6
0
 public override SizeF GetSpecialNoteRadius(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
 {
     return(GetNoteRadius(note, now, noteMetrics, animationMetrics));
 }
        public override RibbonParameters GetHoldRibbonParameters(RuntimeNote startNote, RuntimeNote endNote, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var tp1 = NoteAnimationHelper.CalculateNoteTimePoints(startNote, animationMetrics);
            var tp2 = NoteAnimationHelper.CalculateNoteTimePoints(endNote, animationMetrics);

            var t1    = GetTransformedTime(startNote, now, tp1);
            var t2    = GetTransformedTime(endNote, now, tp2);
            var tperc = startNote.IsHold() ? 0.5 : 0.4;
            var tm    = MathHelper.Lerp(t1, t2, tperc);

            var x1 = GetNoteX(startNote, now, noteMetrics, animationMetrics);
            var x2 = GetNoteX(endNote, now, noteMetrics, animationMetrics);

            var   startStatus = NoteAnimationHelper.GetOnStageStatusOf(startNote, now, tp1);
            float y1;

            if (startStatus == OnStageStatus.Passed)
            {
                y1 = animationMetrics.Bottom;
            }
            else
            {
                y1 = GetNoteOnStageY(t1, animationMetrics);
            }

            var   endStatus = NoteAnimationHelper.GetOnStageStatusOf(endNote, now, tp2);
            float y2;

            if (endStatus == OnStageStatus.Incoming)
            {
                y2 = animationMetrics.Top;
            }
            else
            {
                y2 = GetNoteOnStageY(t2, animationMetrics);
            }

            // CGSS-like
            //var xm = GetNoteOnStageX(endNote.StartX, endNote.EndX, tm, animationMetrics);
            // Naive guess
            //var xm = (x1 + x2) / 2;
            var xm = MathHelper.Lerp(x1, x2, 0.5f);

            if (startNote.IsSlide())
            {
                if (endNote.EndX < startNote.EndX)
                {
                    xm -= animationMetrics.Width * 0.02f * (float)((tp2.Leave - now) / (tp2.Leave - tp1.Enter));
                }
                else if (endNote.EndX > startNote.EndX)
                {
                    xm += animationMetrics.Width * 0.02f * (float)((tp2.Leave - now) / (tp2.Leave - tp1.Enter));
                }
            }
            var ym = GetNoteOnStageY(tm, animationMetrics);

            var(cx1, cx2) = GetBezierFromQuadratic(x1, xm, x2);
            var(cy1, cy2) = GetBezierFromQuadratic(y1, ym, y2);
            return(new RibbonParameters(x1, y1, cx1, cy1, cx2, cy2, x2, y2));
        }
Exemple #8
0
 private static float GetNoteYByTransformedTime(double transformedTime, NoteAnimationMetrics animationMetrics)
 {
     return(animationMetrics.Bottom - (animationMetrics.Bottom - animationMetrics.Top) * NoteYTransform(transformedTime));
 }
Exemple #9
0
        protected override void OnDraw(GameTime gameTime, RenderContext context)
        {
            base.OnDraw(gameTime, context);

            var settings = Program.Settings;

            var motionIcon = settings.Style.SlideMotionIcon;

            if (motionIcon == SlideMotionIcon.None)
            {
                return;
            }

            if (_score == null)
            {
                return;
            }

            var notes       = _score.Notes;
            var theaterDays = Game.AsTheaterDays();

            var syncTimer = theaterDays.FindSingleElement <SyncTimer>();

            if (syncTimer == null)
            {
                return;
            }

            var tapPoints = theaterDays.FindSingleElement <TapPoints>();

            if (tapPoints == null)
            {
                throw new InvalidOperationException();
            }

            var notesLayer = theaterDays.FindSingleElement <NotesLayer>();

            if (notesLayer == null)
            {
                throw new InvalidOperationException();
            }

            var gamingArea = theaterDays.FindSingleElement <GamingArea>();

            if (gamingArea == null)
            {
                throw new InvalidOperationException();
            }

            var now              = syncTimer.CurrentTime.TotalSeconds;
            var tapPointsLayout  = settings.UI.TapPoints.Layout;
            var notesLayerLayout = settings.UI.NotesLayer.Layout;
            var clientSize       = context.ClientSize;

            var traceCalculator = notesLayer.TraceCalculator;

            var commonNoteMetrics = new NoteMetrics {
                StartRadius = gamingArea.ScaleResults.Note.Start,
                EndRadius   = gamingArea.ScaleResults.Note.End
            };

            var animationMetrics = new NoteAnimationMetrics {
                GlobalSpeedScale = notesLayer.GlobalSpeedScale,
                Width            = clientSize.Width,
                Height           = clientSize.Height,
                Top              = notesLayerLayout.Y.IsPercentage ? notesLayerLayout.Y.Value * clientSize.Height : notesLayerLayout.Y.Value,
                Bottom           = tapPointsLayout.Y.IsPercentage ? tapPointsLayout.Y.Value * clientSize.Height : tapPointsLayout.Y.Value,
                NoteStartXRatios = tapPoints.StartXRatios,
                NoteEndXRatios   = tapPoints.EndXRatios,
                TrackCount       = tapPoints.EndXRatios.Length
            };

            context.Begin2D();

            foreach (var note in notes)
            {
                if (!note.IsSlide() || !note.HasNextSlide())
                {
                    continue;
                }

                var thisStatus = NoteAnimationHelper.GetOnStageStatusOf(note, now, animationMetrics);
                if (thisStatus < OnStageStatus.Passed)
                {
                    continue;
                }

                var nextStatus = NoteAnimationHelper.GetOnStageStatusOf(note.NextSlide, now, animationMetrics);
                if (nextStatus >= OnStageStatus.Passed)
                {
                    continue;
                }

                var x = traceCalculator.GetNoteX(note, now, commonNoteMetrics, animationMetrics);
                var y = traceCalculator.GetNoteY(note, now, commonNoteMetrics, animationMetrics);

                SizeF imageSize;
                switch (motionIcon)
                {
                case SlideMotionIcon.None:
                    // Not possible.
                    throw new InvalidOperationException();

                case SlideMotionIcon.Tap:
                    if (_tapPointImage != null)
                    {
                        imageSize = gamingArea.ScaleResults.TapPoint.Start;
                        context.DrawBitmap(_tapPointImage, x - imageSize.Width / 2, y - imageSize.Height / 2, imageSize.Width, imageSize.Height);
                    }
                    break;

                case SlideMotionIcon.Slide:
                    if (_noteImages?[0] != null)
                    {
                        var(imageIndex, _) = NotesLayer.GetImageIndex(NoteType.Slide, NoteSize.Small, FlickDirection.None, false, false, false, false);
                        imageSize          = gamingArea.ScaleResults.Note.End;
                        context.DrawImageStripUnit(_noteImages[0], imageIndex, x - imageSize.Width / 2, y - imageSize.Height / 2, imageSize.Width, imageSize.Height);
                    }
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            context.End2D();
        }
        public override float GetNoteY(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var timePoints    = NoteAnimationHelper.CalculateNoteTimePoints(note, animationMetrics);
            var onStageStatus = NoteAnimationHelper.GetOnStageStatusOf(note, now, timePoints);

            float y;

            switch (onStageStatus)
            {
            case OnStageStatus.Incoming:
                y = animationMetrics.Top;
                break;

            case OnStageStatus.Visible:
                y = GetNoteOnStageY(note, now, timePoints, animationMetrics);
                break;

            case OnStageStatus.Passed:
                y = animationMetrics.Bottom;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(y);
        }
Exemple #11
0
        public override Vector2 GetNoteRadius(RuntimeNote note, float now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var onStageStatus = NoteAnimationHelper.GetOnStageStatusOf(note, now, animationMetrics);

            switch (onStageStatus)
            {
            case OnStageStatus.Incoming:
                return(Vector2.Zero);

            case OnStageStatus.Passed:
                return(noteMetrics.EndRadius);
            }

            var timeRemaining   = note.HitTime - now;
            var timePoints      = NoteAnimationHelper.CalculateNoteTimePoints(note, animationMetrics);
            var timeTransformed = NoteTimeTransform(timeRemaining / timePoints.Duration);
            var endRadius       = noteMetrics.EndRadius;

            if (timeTransformed < 0.75f)
            {
                if (timeTransformed < 0f)
                {
                    return(endRadius);
                }
                else
                {
                    var r = 1 - timeTransformed * 0.933333333f;
                    return(new Vector2(endRadius.X * r, endRadius.Y * r));
                }
            }
            else
            {
                if (timeTransformed < 1f)
                {
                    var r = (1 - timeTransformed) * 1.2f;
                    return(new Vector2(endRadius.X * r, endRadius.Y * r));
                }
                else
                {
                    return(Vector2.Zero);
                }
            }
        }
Exemple #12
0
 public override Vector2 GetSpecialNoteRadius(RuntimeNote note, float now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
 {
     return(GetNoteRadius(note, now, noteMetrics, animationMetrics));
 }
Exemple #13
0
        public override float GetNoteX(RuntimeNote note, float now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var trackCount       = animationMetrics.TrackCount;
            var trackXRatioStart = animationMetrics.NoteEndXRatios[0];
            var trackXRatioEnd   = animationMetrics.NoteEndXRatios[trackCount - 1];

            var endXRatio = trackXRatioStart + (trackXRatioEnd - trackXRatioStart) * (note.EndX / (trackCount - 1));

            var   onStage = NoteAnimationHelper.GetOnStageStatusOf(note, now, animationMetrics);
            float xRatio;

            switch (onStage)
            {
            case OnStageStatus.Incoming:
                if (note.HasPrevHold())
                {
                    xRatio = GetIncomingNoteXRatio(note.PrevHold, note, now, noteMetrics, animationMetrics);
                }
                else if (note.HasPrevSlide())
                {
                    xRatio = GetIncomingNoteXRatio(note.PrevSlide, note, now, noteMetrics, animationMetrics);
                }
                else
                {
                    xRatio = endXRatio;
                }
                break;

            case OnStageStatus.Passed when note.HasNextSlide():
                var destXRatio = trackXRatioStart + (trackXRatioEnd - trackXRatioStart) * (note.NextSlide.EndX / (trackCount - 1));

                var nextPerc = (now - note.HitTime) / (note.NextSlide.HitTime - note.HitTime);
                xRatio = MathHelperEx.Lerp(endXRatio, destXRatio, nextPerc);
                break;

            default:
                xRatio = endXRatio;
                break;
            }

            return(animationMetrics.Width * xRatio);
        }
Exemple #14
0
        public override RibbonParameters GetSlideRibbonParameters(RuntimeNote startNote, RuntimeNote endNote, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var startStatus = NoteAnimationHelper.GetOnStageStatusOf(startNote, now, animationMetrics);

            if (startNote.IsSlideEnd() || startStatus < OnStageStatus.Passed)
            {
                return(GetHoldRibbonParameters(startNote, endNote, now, noteMetrics, animationMetrics));
            }

            var startX1 = GetEndXByNotePosition(startNote.EndX, animationMetrics);
            var startX2 = GetEndXByNotePosition(endNote.EndX, animationMetrics);

            var y1 = animationMetrics.Bottom;
            var x1 = (float)((now - startNote.HitTime) / (endNote.HitTime - startNote.HitTime)) * (startX2 - startX1) + startX1;

            var t1   = GetTransformedTime(startNote, now, animationMetrics);
            var t2   = GetTransformedTime(endNote, now, animationMetrics);
            var tmid = (t1 + t2) * 0.5f;

            var x2   = GetNoteXByTransformedTime(endNote, t2, animationMetrics);
            var xmid = GetNoteXByTransformedTime(endNote, tmid, animationMetrics);

            var y2   = GetNoteYByTransformedTime(t2, animationMetrics);
            var ymid = GetNoteYByTransformedTime(tmid, animationMetrics);

            var(controlX1, controlX2) = GetBezierFromQuadratic(x1, xmid, x2);
            var(controlY1, controlY2) = GetBezierFromQuadratic(y1, ymid, y2);

            return(new RibbonParameters(x1, y1, controlX1, controlY1, controlX2, controlY2, x2, y2));
        }
 public override RibbonParameters GetFlickRibbonParameters(RuntimeNote startNote, RuntimeNote endNote, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
 {
     return(new RibbonParameters {
         Visible = false
     });
 }
Exemple #16
0
        private static float GetNoteXByTransformedTime(RuntimeNote note, double transformedTime, NoteAnimationMetrics animationMetrics)
        {
            var trackCount            = animationMetrics.TrackCount;
            var startLeftMarginRatio  = animationMetrics.NoteStartXRatios[0];
            var startRightMarginRatio = animationMetrics.NoteStartXRatios[trackCount - 1];
            var endLeftMarginRatio    = animationMetrics.NoteEndXRatios[0];
            var endRightMarginRatio   = animationMetrics.NoteEndXRatios[trackCount - 1];

            var startXRatio = startLeftMarginRatio + (startRightMarginRatio - startLeftMarginRatio) * (note.StartX / (trackCount - 1));
            var endXRatio   = endLeftMarginRatio + (endRightMarginRatio - endLeftMarginRatio) * (note.EndX / (trackCount - 1));

            var startX = animationMetrics.Width * startXRatio;
            var endX   = animationMetrics.Width * endXRatio;

            return(endX - (endX - startX) * NoteXTransform(transformedTime));
        }
        public override RibbonParameters GetSlideRibbonParameters(RuntimeNote startNote, RuntimeNote endNote, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var tp1        = NoteAnimationHelper.CalculateNoteTimePoints(startNote, animationMetrics);
            var thisStatus = NoteAnimationHelper.GetOnStageStatusOf(startNote, now, tp1);

            if (thisStatus < OnStageStatus.Passed)
            {
                return(GetHoldRibbonParameters(startNote, endNote, now, noteMetrics, animationMetrics));
            }

            var tp2 = NoteAnimationHelper.CalculateNoteTimePoints(endNote, animationMetrics);

            var t1    = GetTransformedTime(startNote, now, tp1);
            var t2    = GetTransformedTime(endNote, now, tp2);
            var tperc = startNote.IsHold() ? 0.5 : 0.4;
            var tm    = MathHelper.Lerp(t1, t2, tperc);

            var trackCount       = animationMetrics.TrackCount;
            var leftMarginRatio  = animationMetrics.NoteEndXRatios[0];
            var rightMarginRatio = animationMetrics.NoteEndXRatios[trackCount - 1];
            var startXRatio      = leftMarginRatio + (rightMarginRatio - leftMarginRatio) * (startNote.EndX / (trackCount - 1));
            var endXRatio        = leftMarginRatio + (rightMarginRatio - leftMarginRatio) * (endNote.EndX / (trackCount - 1));

            var perc    = (float)((now - startNote.HitTime) / (endNote.HitTime - startNote.HitTime));
            var x1Ratio = MathHelper.Lerp(startXRatio, endXRatio, perc);

            var x1 = animationMetrics.Width * x1Ratio;
            var y1 = animationMetrics.Bottom;
            var x2 = GetNoteX(endNote, now, noteMetrics, animationMetrics);
            var y2 = GetNoteOnStageY(t2, animationMetrics);

            // CGSS-like
            //var xm = GetNoteOnStageX(endNote.StartX, endNote.EndX, tm, animationMetrics);
            // Naive guess
            //var xm = (x1 + x2) / 2;
            var xm = MathHelper.Lerp(x1, x2, 0.5f);

            if (startNote.IsSlide())
            {
                if (endNote.EndX < startNote.EndX)
                {
                    xm -= animationMetrics.Width * 0.02f * (float)((tp2.Leave - now) / (tp2.Leave - tp1.Enter));
                }
                else if (endNote.EndX > startNote.EndX)
                {
                    xm += animationMetrics.Width * 0.02f * (float)((tp2.Leave - now) / (tp2.Leave - tp1.Enter));
                }
            }
            var ym = GetNoteOnStageY(tm, animationMetrics);

            var(cx1, cx2) = GetBezierFromQuadratic(x1, xm, x2);
            var(cy1, cy2) = GetBezierFromQuadratic(y1, ym, y2);
            return(new RibbonParameters(x1, y1, cx1, cy1, cx2, cy2, x2, y2));
        }
Exemple #18
0
        public override SizeF GetNoteRadius(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var timeRemaining   = note.HitTime - now;
            var timePoints      = NoteAnimationHelper.CalculateNoteTimePoints(note, animationMetrics);
            var timeTransformed = NoteTimeTransform((float)timeRemaining / timePoints.Duration);
            var endRadius       = noteMetrics.EndRadius;

            if (timeTransformed < 0.75f)
            {
                if (timeTransformed < 0f)
                {
                    return(endRadius);
                }
                else
                {
                    var r = 1 - (float)timeTransformed * 0.933333333f;
                    return(new SizeF(endRadius.Width * r, endRadius.Height * r));
                }
            }
            else
            {
                if (timeTransformed < 1f)
                {
                    var r = (1 - (float)timeTransformed) * 1.2f;
                    return(new SizeF(endRadius.Width * r, endRadius.Height * r));
                }
                else
                {
                    return(SizeF.Empty);
                }
            }
        }
        public override SizeF GetNoteRadius(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var timePoints    = NoteAnimationHelper.CalculateNoteTimePoints(note, animationMetrics);
            var onStageStatus = NoteAnimationHelper.GetOnStageStatusOf(note, now, timePoints);

            switch (onStageStatus)
            {
            case OnStageStatus.Incoming:
                return(noteMetrics.StartRadius);

            case OnStageStatus.Visible:
                var passed = now - timePoints.Enter;
                var perc   = passed / timePoints.Duration;
                var w      = (float)MathHelper.Lerp(noteMetrics.StartRadius.Width, noteMetrics.EndRadius.Width, perc);
                var h      = (float)MathHelper.Lerp(noteMetrics.StartRadius.Height, noteMetrics.EndRadius.Height, perc);
                return(new SizeF(w, h));

            case OnStageStatus.Passed:
                return(noteMetrics.EndRadius);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemple #20
0
        public override float GetNoteY(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            if (now >= note.HitTime)
            {
                return(animationMetrics.Bottom);
            }

            var transformedTime = GetTransformedTime(note, now, animationMetrics);

            return(GetNoteYByTransformedTime(transformedTime, animationMetrics));
        }
        private static float GetIncomingNoteXRatio(RuntimeNote prevNote, RuntimeNote thisNote, double now, NoteAnimationMetrics animationMetrics)
        {
            var trackCount            = animationMetrics.TrackCount;
            var startLeftMarginRatio  = animationMetrics.NoteStartXRatios[0];
            var startRightMarginRatio = animationMetrics.NoteStartXRatios[trackCount - 1];

            float xRatio;

            if (thisNote.IsSlide())
            {
                var thisXRatio = startLeftMarginRatio + (startRightMarginRatio - startLeftMarginRatio) * (prevNote.EndX / (trackCount - 1));
                var nextXRatio = startLeftMarginRatio + (startRightMarginRatio - startLeftMarginRatio) * (thisNote.EndX / (trackCount - 1));

                var thisTimePoints = NoteAnimationHelper.CalculateNoteTimePoints(prevNote, animationMetrics);
                var nextTimePoints = NoteAnimationHelper.CalculateNoteTimePoints(thisNote, animationMetrics);

                var perc = (float)(now - thisTimePoints.Enter) / (float)(nextTimePoints.Enter - thisTimePoints.Enter);
                xRatio = MathHelper.Lerp(thisXRatio, nextXRatio, perc);
            }
            else
            {
                float nextStartX;
                if (thisNote.StartX < 0)
                {
                    nextStartX = thisNote.StartX * 0.5f;
                }
                else if (thisNote.StartX > trackCount - 1)
                {
                    nextStartX = (trackCount - 1) + (thisNote.StartX - (trackCount - 1)) * 0.5f;
                }
                else
                {
                    nextStartX = thisNote.StartX;
                }
                xRatio = startLeftMarginRatio + (startRightMarginRatio - startLeftMarginRatio) * (nextStartX / (trackCount - 1));
            }

            return(xRatio);
        }
Exemple #22
0
        public override float GetSpecialNoteX(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var leftRatio  = animationMetrics.NoteEndXRatios[0];
            var rightRatio = animationMetrics.NoteEndXRatios[animationMetrics.TrackCount - 1];
            var xRatio     = (leftRatio + rightRatio) / 2;

            return(animationMetrics.Width * xRatio);
        }
        private static float GetNoteOnStageY(RuntimeNote note, double now, NoteTimePoints timePoints, NoteAnimationMetrics animationMetrics)
        {
            var transformedTime = GetTransformedTime(note, now, timePoints);

            return(GetNoteOnStageY(transformedTime, animationMetrics));
        }
Exemple #24
0
        public override RibbonParameters GetFlickRibbonParameters(RuntimeNote startNote, RuntimeNote endNote, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var x1 = GetNoteX(startNote, now, noteMetrics, animationMetrics);
            var y1 = GetNoteY(startNote, now, noteMetrics, animationMetrics);
            var x2 = GetNoteX(endNote, now, noteMetrics, animationMetrics);
            var y2 = GetNoteY(endNote, now, noteMetrics, animationMetrics);

            return(new RibbonParameters(x1, y1, x2, y2));
        }
Exemple #25
0
        private static float GetIncomingNoteXRatio([NotNull] RuntimeNote prevNote, RuntimeNote thisNote, float now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics)
        {
            var trackCount       = animationMetrics.TrackCount;
            var trackXRatioStart = animationMetrics.NoteEndXRatios[0];
            var trackXRatioEnd   = animationMetrics.NoteEndXRatios[trackCount - 1];

            var thisXRatio = trackXRatioStart + (trackXRatioEnd - trackXRatioStart) * (prevNote.EndX / (trackCount - 1));
            var nextXRatio = trackXRatioStart + (trackXRatioEnd - trackXRatioStart) * (thisNote.EndX / (trackCount - 1));

            var thisTimePoints = NoteAnimationHelper.CalculateNoteTimePoints(prevNote, animationMetrics);
            var nextTimePoints = NoteAnimationHelper.CalculateNoteTimePoints(thisNote, animationMetrics);

            var perc = (now - thisTimePoints.Enter) / (nextTimePoints.Enter - thisTimePoints.Enter);

            return(MathHelperEx.Lerp(thisXRatio, nextXRatio, perc));
        }