2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
2017-04-21 07:18:00 +00:00
|
|
|
|
using osu.Game.Audio;
|
2017-04-18 00:13:36 +00:00
|
|
|
|
using System.Collections.Generic;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-04-18 07:05:58 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
2017-04-17 08:23:11 +00:00
|
|
|
|
{
|
2017-04-18 00:13:36 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A HitObjectParser to parse legacy osu!catch Beatmaps.
|
|
|
|
|
/// </summary>
|
2017-11-21 02:49:42 +00:00
|
|
|
|
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
|
2017-04-17 08:23:11 +00:00
|
|
|
|
{
|
2023-11-23 04:41:01 +00:00
|
|
|
|
private ConvertHitObject lastObject;
|
|
|
|
|
|
2018-08-15 01:24:56 +00:00
|
|
|
|
public ConvertHitObjectParser(double offset, int formatVersion)
|
|
|
|
|
: base(offset, formatVersion)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-15 01:48:42 +00:00
|
|
|
|
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
|
2017-04-17 08:23:11 +00:00
|
|
|
|
{
|
2023-11-23 04:41:01 +00:00
|
|
|
|
return lastObject = new ConvertHit
|
2017-04-17 08:23:11 +00:00
|
|
|
|
{
|
2021-07-14 05:38:38 +00:00
|
|
|
|
Position = position,
|
2023-11-23 04:41:01 +00:00
|
|
|
|
NewCombo = FirstObject || lastObject is ConvertSpinner || newCombo,
|
2023-11-24 00:46:06 +00:00
|
|
|
|
ComboOffset = newCombo ? comboOffset : 0
|
2017-04-17 08:23:11 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-12-05 10:53:31 +00:00
|
|
|
|
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, PathControlPoint[] controlPoints, double? length, int repeatCount,
|
2021-10-23 08:59:07 +00:00
|
|
|
|
IList<IList<HitSampleInfo>> nodeSamples)
|
2017-04-17 08:23:11 +00:00
|
|
|
|
{
|
2023-11-23 04:41:01 +00:00
|
|
|
|
return lastObject = new ConvertSlider
|
2017-04-17 08:23:11 +00:00
|
|
|
|
{
|
2021-07-14 05:38:38 +00:00
|
|
|
|
Position = position,
|
2023-11-23 04:41:01 +00:00
|
|
|
|
NewCombo = FirstObject || lastObject is ConvertSpinner || newCombo,
|
2023-11-24 00:46:06 +00:00
|
|
|
|
ComboOffset = newCombo ? comboOffset : 0,
|
2019-12-05 10:53:31 +00:00
|
|
|
|
Path = new SliderPath(controlPoints, length),
|
2018-10-16 08:10:24 +00:00
|
|
|
|
NodeSamples = nodeSamples,
|
2017-04-21 11:29:27 +00:00
|
|
|
|
RepeatCount = repeatCount
|
2017-04-17 08:23:11 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2020-05-27 03:37:44 +00:00
|
|
|
|
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
2017-04-17 08:23:11 +00:00
|
|
|
|
{
|
2023-11-23 04:41:01 +00:00
|
|
|
|
return lastObject = new ConvertSpinner
|
2017-04-17 08:23:11 +00:00
|
|
|
|
{
|
2023-11-23 04:41:01 +00:00
|
|
|
|
Duration = duration,
|
|
|
|
|
NewCombo = newCombo
|
|
|
|
|
// Spinners cannot have combo offset.
|
2017-04-17 08:23:11 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2020-05-27 03:37:44 +00:00
|
|
|
|
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
2017-05-12 07:35:57 +00:00
|
|
|
|
{
|
2023-11-23 04:41:01 +00:00
|
|
|
|
return lastObject = null;
|
2017-05-12 07:35:57 +00:00
|
|
|
|
}
|
2017-04-17 08:23:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|