コード例 #1
0
        public void FormGroup(List <HitObject> hitObjects)
        {
            this.hitObjects = hitObjects;
            startX          = hitObjects[0].x;
            startY          = hitObjects[0].y;
            endX            = hitObjects[hitObjects.Count - 1].x;
            endY            = hitObjects[hitObjects.Count - 1].y;

            minX            = maxX = startX;
            minY            = maxY = startY;
            length          = 0f;
            minNoteDistance = float.PositiveInfinity;
            maxNoteDistance = 0f;
            for (int i = 1; i < hitObjects.Count; i++)
            {
                HitObject currentHitObject = hitObjects[i];
                HitObject prevHitObject    = hitObjects[i - 1];

                minX = Math.Min(minX, currentHitObject.x);
                maxX = Math.Max(maxX, currentHitObject.x);
                minY = Math.Min(minY, currentHitObject.y);
                maxY = Math.Max(maxY, currentHitObject.y);

                float noteDistance = OsuUtility.EuclideanDistance(prevHitObject.x, prevHitObject.y, currentHitObject.x, currentHitObject.y);
                length         += noteDistance;
                minNoteDistance = Math.Min(minNoteDistance, noteDistance);
                maxNoteDistance = Math.Max(maxNoteDistance, noteDistance);
            }
        }
コード例 #2
0
        public static void SetCuePos(Cue cue, Coordinate2D pos)
        {
            AudicaDataPos newAudicaPos = OsuUtility.CoordinateToAudicaPos(pos);

            cue.pitch      = newAudicaPos.pitch;
            cue.gridOffset = newAudicaPos.offset;
        }
コード例 #3
0
        private void DetectStreams()
        {
            float streamTimeThres     = Config.parameters.streamOptions.streamTimeThres;
            float streamDistanceThres = Config.parameters.streamOptions.streamDistanceThres;

            List <HitObject> streamHitObjects = new List <HitObject>();

            if (hitObjects.Count > 0)
            {
                streamHitObjects.Add(hitObjects[0]);
            }

            for (int i = 1; i < hitObjects.Count; i++)
            {
                HitObject currentHitObject = hitObjects[i];
                HitObject prevHitObject    = hitObjects[i - 1];

                if (currentHitObject.time - prevHitObject.time <= streamTimeThres &&
                    OsuUtility.EuclideanDistance(prevHitObject.x, prevHitObject.y, currentHitObject.x, currentHitObject.y) <= streamDistanceThres)
                {
                    streamHitObjects.Add(currentHitObject);
                }
                else
                {
                    ConsiderStream(streamHitObjects);

                    streamHitObjects = new List <HitObject>();
                    streamHitObjects.Add(currentHitObject);
                }
            }
            ConsiderStream(streamHitObjects);
        }
コード例 #4
0
 private void CalculateSliderEndTimes()
 {
     foreach (HitObject hitObject in hitObjects)
     {
         if (hitObject.type == 2 || hitObject.type == 6)
         {
             TimingPoint prevTimingPoint = OsuUtility.GetPrevTimingPointFromMs(hitObject.time, mergedTimingPoints);
             hitObject.endTime = hitObject.time + hitObject.pixelLength * hitObject.repeats / (100 * difficulty.sliderMultiplier * prevTimingPoint.sliderVelocity) * (float)prevTimingPoint.beatTime;
         }
     }
 }
コード例 #5
0
        private void CalculateAudicaTicks()
        {
            foreach (TimingPoint timingPoint in mergedTimingPoints)
            {
                timingPoint.audicaTick = OsuUtility.MsToTick(timingPoint.ms, timingPoints, roundingPrecision: 1);
            }

            foreach (HitObject hitObject in hitObjects)
            {
                hitObject.audicaTick    = OsuUtility.MsToTick(hitObject.time, timingPoints, roundingPrecision: 10);
                hitObject.audicaEndTick = OsuUtility.MsToTick(hitObject.endTime, timingPoints, roundingPrecision: 10);
            }
        }