示例#1
0
 public HitObject(Vector2 position, int startTime, int endTime, HitSoundType hitSound, Extras extras, bool isNewCombo, int comboOffset)
 {
     Position    = position;
     StartTime   = startTime;
     EndTime     = endTime;
     HitSound    = hitSound;
     Extras      = extras;
     IsNewCombo  = isNewCombo;
     ComboOffset = comboOffset;
 }
示例#2
0
        /// <summary>
        ///     Converts osu! hit sound type to Quaver hit sound type.
        /// </summary>
        /// <param name="hitSoundType"></param>
        /// <returns></returns>
        public static HitSounds ToQuaverHitSounds(this HitSoundType hitSoundType)
        {
            var value = (int)hitSoundType & 15;  // Clear any higher bits.

            if (value == 0)
            {
                return(HitSounds.Normal);
            }

            // HitSounds happens to have the same values.
            return((HitSounds)hitSoundType);
        }
示例#3
0
 public Slider(Point position, int startTime, int endTime, HitSoundType hitSound, CurveType type, List <Point> points,
               int repeats, double pixelLength, List <HitSoundType> edgeHitSounds, List <Tuple <SampleSet, SampleSet> > edgeAdditions,
               Extras extras, bool isNewCombo, int comboOffset)
     : base(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset)
 {
     CurveType     = type;
     SliderPoints  = points;
     Repeats       = repeats;
     PixelLength   = pixelLength;
     EdgeHitSounds = edgeHitSounds;
     EdgeAdditions = edgeAdditions;
 }
示例#4
0
 public TaikoHit(Point position, int startTime, int endTime, HitSoundType hitSound, Extras extras, bool isNewCombo, int comboOffset)
     : base(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset)
 {
 }
示例#5
0
 public ManiaNote(Vector2 position, int startTime, int endTime, HitSoundType hitSound, Extras extras, bool isNewCombo, int comboOffset)
     : base(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset)
 {
 }
示例#6
0
        private void ParseHitObjects(string line)
        {
            string[] tokens = line.Split(',');

            Point position = new Point(Convert.ToInt32(tokens[0]), Convert.ToInt32(tokens[1]));

            int startTime = Convert.ToInt32(tokens[2]);

            HitObjectType type = (HitObjectType)int.Parse(tokens[3]);

            int comboOffset = (int)(type & HitObjectType.ComboOffset) >> 4;

            type &= ~HitObjectType.ComboOffset;

            bool isNewCombo = type.HasFlag(HitObjectType.NewCombo);

            type &= ~HitObjectType.NewCombo;

            HitSoundType hitSound = (HitSoundType)Convert.ToInt32(tokens[4]);

            HitObject hitObject = null;

            string[] extrasSplit  = tokens.Last().Split(':');
            int      extrasOffset = type.HasFlag(HitObjectType.Hold) ? 1 : 0;
            Extras   extras       = tokens.Last().Contains(":") ? new Extras
            {
                SampleSet      = (SampleSet)Convert.ToInt32(extrasSplit[0 + extrasOffset]),
                AdditionSet    = (SampleSet)Convert.ToInt32(extrasSplit[1 + extrasOffset]),
                CustomIndex    = Convert.ToInt32(extrasSplit[2 + extrasOffset]),
                Volume         = Convert.ToInt32(extrasSplit[3 + extrasOffset]),
                SampleFileName = string.IsNullOrEmpty(extrasSplit[4 + extrasOffset]) ? null : extrasSplit[4 + extrasOffset]
            } : new Extras();

            switch (type)
            {
            case HitObjectType.Circle:
            {
                if (Beatmap.GeneralSection.Mode == Ruleset.Standard)
                {
                    hitObject = new Circle(position, startTime, startTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Taiko)
                {
                    hitObject = new TaikoHit(position, startTime, startTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Fruits)
                {
                    hitObject = new CatchFruit(position, startTime, startTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Mania)
                {
                    hitObject = new ManiaHit(position, startTime, startTime, hitSound, extras, isNewCombo, comboOffset);
                }
            }
            break;

            case HitObjectType.Slider:
            {
                CurveType    curveType    = ParseHelper.GetCurveType(tokens[5].Split('|')[0][0]);
                List <Point> sliderPoints = ParseHelper.GetSliderPoints(tokens[5].Split('|'));

                int    repeats     = Convert.ToInt32(tokens[6]);
                double pixelLength = ParseHelper.ToDouble(tokens[7]);

                int endTime = CalculateEndTime(startTime, repeats, pixelLength);

                List <HitSoundType> edgeHitSounds = new List <HitSoundType>();
                if (tokens.Length > 8 && tokens[8].Length > 0)
                {
                    edgeHitSounds = new List <HitSoundType>();
                    edgeHitSounds = Array.ConvertAll(tokens[8].Split('|'), s => (HitSoundType)Convert.ToInt32(s)).ToList();
                }

                List <Tuple <SampleSet, SampleSet> > edgeAdditions = new List <Tuple <SampleSet, SampleSet> >();
                if (tokens.Length > 9 && tokens[9].Length > 0)
                {
                    edgeAdditions = new List <Tuple <SampleSet, SampleSet> >();
                    foreach (var s in tokens[9].Split('|'))
                    {
                        edgeAdditions.Add(new Tuple <SampleSet, SampleSet>((SampleSet)Convert.ToInt32(s.Split(':').First()), (SampleSet)Convert.ToInt32(s.Split(':').Last())));
                    }
                }

                if (Beatmap.GeneralSection.Mode == Ruleset.Standard)
                {
                    hitObject = new Slider(position, startTime, endTime, hitSound, curveType, sliderPoints, repeats,
                                           pixelLength, edgeHitSounds, edgeAdditions, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Taiko)
                {
                    hitObject = new TaikoDrumroll(position, startTime, endTime, hitSound, curveType, sliderPoints,
                                                  repeats, pixelLength, edgeHitSounds, edgeAdditions, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Fruits)
                {
                    hitObject = new CatchDroplets(position, startTime, endTime, hitSound, curveType, sliderPoints,
                                                  repeats, pixelLength, edgeHitSounds, edgeAdditions, extras, isNewCombo, comboOffset);
                }
            }
            break;

            case HitObjectType.Spinner:
            {
                int endTime = Convert.ToInt32(tokens[5].Trim());

                if (Beatmap.GeneralSection.Mode == Ruleset.Standard)
                {
                    hitObject = new Spinner(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Taiko)
                {
                    hitObject = new TaikoSpinner(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Fruits)
                {
                    hitObject = new CatchSpinner(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset);
                }
            }
            break;

            case HitObjectType.Hold:
            {
                string[] additions = tokens[5].Split(':');
                int      endTime   = Convert.ToInt32(additions[0].Trim());
                hitObject = new ManiaHold(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset);
            }
            break;
            }

            Beatmap.HitObjects.Add(hitObject);
        }
示例#7
0
 public CatchDroplets(Point position, int startTime, int endTime, HitSoundType hitSound, CurveType type,
                      List <Point> points, int repeats, double pixelLength, List <HitSoundType> edgeHitSounds,
                      List <Tuple <SampleSet, SampleSet> > edgeAdditions, Extras extras, bool isNewCombo, int comboOffset)
     : base(position, startTime, endTime, hitSound, type, points, repeats, pixelLength, edgeHitSounds, edgeAdditions, extras, isNewCombo, comboOffset)
 {
 }
示例#8
0
 public TaikoDrumroll(Vector2 position, int startTime, int endTime, HitSoundType hitSound, CurveType type,
                      List <Vector2> points, int repeats, double pixelLength, bool isNewCombo, int comboOffset)
     : base(position, startTime, endTime, hitSound, type, points, repeats, pixelLength, isNewCombo, comboOffset)
 {
 }
示例#9
0
 public TaikoDrumroll(Vector2 position, int startTime, int endTime, HitSoundType hitSound, CurveType type,
                      List <Vector2> points, int repeats, double pixelLength, List <HitSoundType> edgeHitSounds,
                      List <Tuple <SampleSet, SampleSet> > edgeAdditions, Extras extras, bool isNewCombo, int comboOffset)
     : base(position, startTime, endTime, hitSound, type, points, repeats, pixelLength, isNewCombo, comboOffset, edgeHitSounds, edgeAdditions, extras)
 {
 }
示例#10
0
 public CatchJuiceStream(Vector2 position, int startTime, int endTime, HitSoundType hitSound, CurveType type,
                         List <Vector2> points, int repeats, double pixelLength, bool isNewCombo, int comboOffset, List <HitSoundType> edgeHitSounds = null,
                         List <Tuple <SampleSet, SampleSet> > edgeAdditions = null, Extras extras = null)
     : base(position, startTime, endTime, hitSound, type, points, repeats, pixelLength, isNewCombo, comboOffset, edgeHitSounds, edgeAdditions, extras)
 {
 }