mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Add JuiceStreamPath
to allow editing JuiceStream
in catch editor
A `JuiceStream` holds a legacy `SliderPath` as the representation of the path. However, the `SliderPath` representation is difficult to work with because `SliderPath` works in 2D position, while osu!catch works in `(time, x)` coordinates. This `JuiceStreamPath` represents the path in a more convenient way, a polyline connecting list of `(distance, x)` vertices.
This commit is contained in:
33
osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs
Normal file
33
osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs
Normal file
@ -0,0 +1,33 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// A vertex of a <see cref="JuiceStreamPath"/>.
|
||||
/// </summary>
|
||||
public readonly struct JuiceStreamPathVertex : IComparable<JuiceStreamPathVertex>
|
||||
{
|
||||
public readonly double Distance;
|
||||
|
||||
public readonly float X;
|
||||
|
||||
public JuiceStreamPathVertex(double distance, float x)
|
||||
{
|
||||
Distance = distance;
|
||||
X = x;
|
||||
}
|
||||
|
||||
public int CompareTo(JuiceStreamPathVertex other)
|
||||
{
|
||||
int c = Distance.CompareTo(other.Distance);
|
||||
return c != 0 ? c : X.CompareTo(other.X);
|
||||
}
|
||||
|
||||
public override string ToString() => $"({Distance}, {X})";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user