mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:12:56 +08:00
Revert "Make SliderPath.ControlPoints read-only"
This reverts commit 3b88d94793
.
# Conflicts:
# osu.Game/Rulesets/Objects/SliderPath.cs
This commit is contained in:
parent
77d16aa968
commit
d594ce3530
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -55,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
Position = slider.StackedPosition + slider.Path.ControlPoints.Span[index];
|
Position = slider.StackedPosition + slider.Path.ControlPoints[index];
|
||||||
|
|
||||||
marker.Colour = isSegmentSeparator ? colours.Red : colours.Yellow;
|
marker.Colour = isSegmentSeparator ? colours.Red : colours.Yellow;
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
if (index != slider.Path.ControlPoints.Length - 1)
|
if (index != slider.Path.ControlPoints.Length - 1)
|
||||||
{
|
{
|
||||||
path.AddVertex(Vector2.Zero);
|
path.AddVertex(Vector2.Zero);
|
||||||
path.AddVertex(slider.Path.ControlPoints.Span[index + 1] - slider.Path.ControlPoints.Span[index]);
|
path.AddVertex(slider.Path.ControlPoints[index + 1] - slider.Path.ControlPoints[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero);
|
path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero);
|
||||||
@ -105,8 +106,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
|
|
||||||
private bool isSegmentSeparator => isSegmentSeparatorWithNext || isSegmentSeparatorWithPrevious;
|
private bool isSegmentSeparator => isSegmentSeparatorWithNext || isSegmentSeparatorWithPrevious;
|
||||||
|
|
||||||
private bool isSegmentSeparatorWithNext => index < slider.Path.ControlPoints.Length - 1 && slider.Path.ControlPoints.Span[index + 1] == slider.Path.ControlPoints.Span[index];
|
private bool isSegmentSeparatorWithNext => index < slider.Path.ControlPoints.Length - 1 && slider.Path.ControlPoints[index + 1] == slider.Path.ControlPoints[index];
|
||||||
|
|
||||||
private bool isSegmentSeparatorWithPrevious => index > 0 && slider.Path.ControlPoints.Span[index - 1] == slider.Path.ControlPoints.Span[index];
|
private bool isSegmentSeparatorWithPrevious => index > 0 && slider.Path.ControlPoints[index - 1] == slider.Path.ControlPoints[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
var newControlPoints = new Vector2[slider.Path.ControlPoints.Length];
|
var newControlPoints = new Vector2[slider.Path.ControlPoints.Length];
|
||||||
for (int i = 0; i < slider.Path.ControlPoints.Length; i++)
|
for (int i = 0; i < slider.Path.ControlPoints.Length; i++)
|
||||||
newControlPoints[i] = new Vector2(slider.Path.ControlPoints.Span[i].X, -slider.Path.ControlPoints.Span[i].Y);
|
newControlPoints[i] = new Vector2(slider.Path.ControlPoints[i].X, -slider.Path.ControlPoints[i].Y);
|
||||||
|
|
||||||
slider.Path = new SliderPath(slider.Path.Type, newControlPoints, slider.Path.ExpectedDistance);
|
slider.Path = new SliderPath(slider.Path.Type, newControlPoints, slider.Path.ExpectedDistance);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The control points of the path.
|
/// The control points of the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ReadOnlyMemory<Vector2> ControlPoints;
|
public readonly Vector2[] ControlPoints;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The type of path.
|
/// The type of path.
|
||||||
@ -137,9 +137,9 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
{
|
{
|
||||||
end++;
|
end++;
|
||||||
|
|
||||||
if (i == ControlPoints.Length - 1 || ControlPoints.Span[i] == ControlPoints.Span[i + 1])
|
if (i == ControlPoints.Length - 1 || ControlPoints[i] == ControlPoints[i + 1])
|
||||||
{
|
{
|
||||||
ReadOnlySpan<Vector2> cpSpan = ControlPoints.Span.Slice(start, end - start);
|
ReadOnlySpan<Vector2> cpSpan = ControlPoints.AsSpan().Slice(start, end - start);
|
||||||
|
|
||||||
foreach (Vector2 t in calculateSubpath(cpSpan))
|
foreach (Vector2 t in calculateSubpath(cpSpan))
|
||||||
if (calculatedPath.Count == 0 || calculatedPath.Last() != t)
|
if (calculatedPath.Count == 0 || calculatedPath.Last() != t)
|
||||||
|
Loading…
Reference in New Issue
Block a user