Exemple #1
0
        private TaikoHitObject convertHitObject(HitObject original)
        {
            // Check if this HitObject is already a TaikoHitObject, and return it if so
            TaikoHitObject originalTaiko = original as TaikoHitObject;

            if (originalTaiko != null)
            {
                return(originalTaiko);
            }

            IHasDistance distanceData = original as IHasDistance;
            IHasRepeats  repeatsData  = original as IHasRepeats;
            IHasEndTime  endTimeData  = original as IHasEndTime;

            bool accented = ((original.Sample?.Type ?? SampleType.None) & SampleType.Finish) > 0;

            if (distanceData != null)
            {
                return(new DrumRoll
                {
                    StartTime = original.StartTime,
                    Sample = original.Sample,
                    Accented = accented,

                    Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1)
                });
            }

            if (endTimeData != null)
            {
                // We compute the end time manually to add in the Bash convert factor
                return(new Bash
                {
                    StartTime = original.StartTime,
                    Sample = original.Sample,
                    Accented = accented,

                    EndTime = original.StartTime + endTimeData.Duration * bash_convert_factor
                });
            }

            return(new Hit
            {
                StartTime = original.StartTime,
                Sample = original.Sample,
                Accented = accented
            });
        }
Exemple #2
0
        private TaikoHitObject convertHitObject(HitObject original)
        {
            // Check if this HitObject is already a TaikoHitObject, and return it if so
            TaikoHitObject originalTaiko = original as TaikoHitObject;

            if (originalTaiko != null)
            {
                return(originalTaiko);
            }

            IHasDistance distanceData = original as IHasDistance;
            IHasRepeats  repeatsData  = original as IHasRepeats;
            IHasEndTime  endTimeData  = original as IHasEndTime;

            // Old osu! used hit sounding to determine various hit type information
            SampleType sample = original.Sample?.Type ?? SampleType.None;

            bool strong = (sample & SampleType.Finish) > 0;

            if (distanceData != null)
            {
                return(new DrumRoll
                {
                    StartTime = original.StartTime,
                    Sample = original.Sample,
                    IsStrong = strong,

                    Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale
                });
            }

            if (endTimeData != null)
            {
                // We compute the end time manually to add in the Bash convert factor
                return(new Swell
                {
                    StartTime = original.StartTime,
                    Sample = original.Sample,
                    IsStrong = strong,

                    EndTime = original.StartTime + endTimeData.Duration,
                    HitRatio = bash_convert_factor
                });
            }

            bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0;

            if (isCentre)
            {
                return(new CentreHit
                {
                    StartTime = original.StartTime,
                    Sample = original.Sample,
                    IsStrong = strong
                });
            }

            return(new RimHit
            {
                StartTime = original.StartTime,
                Sample = original.Sample,
                IsStrong = strong,
            });
        }