mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09:00
More closely replicate osu!'s parsing code.
This commit is contained in:
parent
c315c8690b
commit
c2d80936cf
@ -16,21 +16,22 @@ namespace osu.Game.Modes.Objects
|
||||
public override HitObject Parse(string text)
|
||||
{
|
||||
string[] split = text.Split(',');
|
||||
var type = (HitObjectType)int.Parse(split[3]);
|
||||
var type = (HitObjectType)int.Parse(split[3]) & ~HitObjectType.ColourHax;
|
||||
bool combo = type.HasFlag(HitObjectType.NewCombo);
|
||||
type &= ~HitObjectType.NewCombo;
|
||||
|
||||
HitObject result;
|
||||
switch (type)
|
||||
|
||||
if ((type & HitObjectType.Circle) > 0)
|
||||
{
|
||||
case HitObjectType.Circle:
|
||||
result = new LegacyHit
|
||||
{
|
||||
Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])),
|
||||
NewCombo = combo
|
||||
};
|
||||
break;
|
||||
case HitObjectType.Slider:
|
||||
}
|
||||
else if ((type & HitObjectType.Slider) > 0)
|
||||
{
|
||||
CurveType curveType = CurveType.Catmull;
|
||||
double length = 0;
|
||||
List<Vector2> points = new List<Vector2> { new Vector2(int.Parse(split[0]), int.Parse(split[1])) };
|
||||
@ -83,24 +84,26 @@ namespace osu.Game.Modes.Objects
|
||||
Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])),
|
||||
NewCombo = combo
|
||||
};
|
||||
break;
|
||||
case HitObjectType.Spinner:
|
||||
}
|
||||
else if ((type & HitObjectType.Spinner) > 0)
|
||||
{
|
||||
result = new LegacySpinner
|
||||
{
|
||||
EndTime = Convert.ToDouble(split[5], CultureInfo.InvariantCulture)
|
||||
};
|
||||
break;
|
||||
case HitObjectType.Hold:
|
||||
}
|
||||
else if ((type & HitObjectType.Hold) > 0)
|
||||
{
|
||||
// Note: Hold is generated by BMS converts
|
||||
result = new LegacyHold
|
||||
{
|
||||
Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])),
|
||||
NewCombo = combo
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException($@"Unknown hit object type {type}");
|
||||
}
|
||||
else
|
||||
throw new InvalidOperationException($@"Unknown hit object type {type}");
|
||||
|
||||
result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture);
|
||||
result.Sample = new HitSampleInfo
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user