mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:07:52 +08:00
Remove CurvedHitObject to make RepeatSamples not tied to curve.
This commit is contained in:
parent
b8f9a2be6e
commit
5cdbb226f8
@ -62,15 +62,12 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
add(new DrawableSlider(new Slider
|
||||
{
|
||||
StartTime = framedClock.CurrentTime + 600,
|
||||
CurveObject = new CurvedHitObject
|
||||
ControlPoints = new List<Vector2>
|
||||
{
|
||||
ControlPoints = new List<Vector2>
|
||||
{
|
||||
new Vector2(-200, 0),
|
||||
new Vector2(400, 0),
|
||||
},
|
||||
Distance = 400
|
||||
new Vector2(-200, 0),
|
||||
new Vector2(400, 0),
|
||||
},
|
||||
Distance = 400,
|
||||
Position = new Vector2(-200, 0),
|
||||
Velocity = 1,
|
||||
TickDistance = 100,
|
||||
|
@ -19,10 +19,10 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
||||
|
||||
protected override IEnumerable<OsuHitObject> ConvertHitObject(HitObject original, Beatmap beatmap)
|
||||
{
|
||||
IHasCurve curveData = original as IHasCurve;
|
||||
IHasEndTime endTimeData = original as IHasEndTime;
|
||||
IHasPosition positionData = original as IHasPosition;
|
||||
IHasCombo comboData = original as IHasCombo;
|
||||
var curveData = original as IHasCurve;
|
||||
var endTimeData = original as IHasEndTime;
|
||||
var positionData = original as IHasPosition;
|
||||
var comboData = original as IHasCombo;
|
||||
|
||||
if (curveData != null)
|
||||
{
|
||||
@ -30,7 +30,11 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
Samples = original.Samples,
|
||||
CurveObject = curveData,
|
||||
ControlPoints = curveData?.ControlPoints ?? null,
|
||||
CurveType = curveData?.CurveType ?? CurveType.Catmull,
|
||||
Distance = curveData?.Distance ?? 0,
|
||||
RepeatSamples = curveData?.RepeatSamples ?? null,
|
||||
RepeatCount = curveData?.RepeatCount ?? 1,
|
||||
Position = positionData?.Position ?? Vector2.Zero,
|
||||
NewCombo = comboData?.NewCombo ?? false
|
||||
};
|
||||
|
@ -20,26 +20,33 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
/// </summary>
|
||||
private const float base_scoring_distance = 100;
|
||||
|
||||
public IHasCurve CurveObject { get; set; }
|
||||
|
||||
public SliderCurve Curve => CurveObject.Curve;
|
||||
public SliderCurve Curve { get; } = new SliderCurve();
|
||||
|
||||
public double EndTime => StartTime + RepeatCount * Curve.Distance / Velocity;
|
||||
public double Duration => EndTime - StartTime;
|
||||
|
||||
public override Vector2 EndPosition => PositionAt(1);
|
||||
|
||||
public Vector2 PositionAt(double progress) => CurveObject.PositionAt(progress);
|
||||
public double ProgressAt(double progress) => CurveObject.ProgressAt(progress);
|
||||
public int RepeatAt(double progress) => CurveObject.RepeatAt(progress);
|
||||
public List<Vector2> ControlPoints
|
||||
{
|
||||
get { return Curve.ControlPoints; }
|
||||
set { Curve.ControlPoints = value; }
|
||||
}
|
||||
|
||||
public List<List<SampleInfo>> RepeatSamples => CurveObject.RepeatSamples;
|
||||
public CurveType CurveType
|
||||
{
|
||||
get { return Curve.CurveType; }
|
||||
set { Curve.CurveType = value; }
|
||||
}
|
||||
|
||||
public List<Vector2> ControlPoints => CurveObject.ControlPoints;
|
||||
public CurveType CurveType => CurveObject.CurveType;
|
||||
public double Distance => CurveObject.Distance;
|
||||
public double Distance
|
||||
{
|
||||
get { return Curve.Distance; }
|
||||
set { Curve.Distance = value; }
|
||||
}
|
||||
|
||||
public int RepeatCount => CurveObject.RepeatCount;
|
||||
public List<List<SampleInfo>> RepeatSamples { get; set; } = new List<List<SampleInfo>>();
|
||||
public int RepeatCount { get; set; } = 1;
|
||||
|
||||
private int stackHeight;
|
||||
public override int StackHeight
|
||||
@ -65,6 +72,18 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
TickDistance = scoringDistance / difficulty.SliderTickRate;
|
||||
}
|
||||
|
||||
public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress));
|
||||
|
||||
public double ProgressAt(double progress)
|
||||
{
|
||||
double p = progress * RepeatCount % 1;
|
||||
if (RepeatAt(progress) % 2 == 1)
|
||||
p = 1 - p;
|
||||
return p;
|
||||
}
|
||||
|
||||
public int RepeatAt(double progress) => (int)(progress * RepeatCount);
|
||||
|
||||
public IEnumerable<SliderTick> Ticks
|
||||
{
|
||||
get
|
||||
|
@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
||||
ControlPoints = controlPoints,
|
||||
Distance = length,
|
||||
CurveType = curveType,
|
||||
RepeatCount = repeatCount,
|
||||
RepeatSamples = repeatSamples
|
||||
RepeatSamples = repeatSamples,
|
||||
RepeatCount = repeatCount
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
||||
/// <summary>
|
||||
/// Legacy osu!catch Slider-type, used for parsing Beatmaps.
|
||||
/// </summary>
|
||||
internal sealed class Slider : CurvedHitObject, IHasXPosition, IHasCombo
|
||||
internal sealed class Slider : LegacySlider, IHasXPosition, IHasCombo
|
||||
{
|
||||
public float X { get; set; }
|
||||
|
||||
|
@ -1,21 +1,17 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK;
|
||||
using osu.Game.Audio;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects
|
||||
namespace osu.Game.Rulesets.Objects.Legacy
|
||||
{
|
||||
public class CurvedHitObject : HitObject, IHasCurve
|
||||
internal class LegacySlider : HitObject, IHasCurve
|
||||
{
|
||||
public SliderCurve Curve { get; } = new SliderCurve();
|
||||
|
||||
public int RepeatCount { get; set; } = 1;
|
||||
|
||||
public double EndTime => 0;
|
||||
public double Duration => 0;
|
||||
public SliderCurve Curve { get; set; } = new SliderCurve();
|
||||
|
||||
public List<Vector2> ControlPoints
|
||||
{
|
||||
@ -36,17 +32,24 @@ namespace osu.Game.Rulesets.Objects
|
||||
}
|
||||
|
||||
public List<List<SampleInfo>> RepeatSamples { get; set; } = new List<List<SampleInfo>>();
|
||||
public int RepeatCount { get; set; } = 1;
|
||||
|
||||
public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress));
|
||||
public double EndTime { get; set; }
|
||||
public double Duration { get; set; }
|
||||
|
||||
public Vector2 PositionAt(double progress)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public double ProgressAt(double progress)
|
||||
{
|
||||
var p = progress * RepeatCount % 1;
|
||||
if (RepeatAt(progress) % 2 == 1)
|
||||
p = 1 - p;
|
||||
return p;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int RepeatAt(double progress) => (int)(progress * RepeatCount);
|
||||
public int RepeatAt(double progress)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||
ControlPoints = controlPoints,
|
||||
Distance = length,
|
||||
CurveType = curveType,
|
||||
RepeatCount = repeatCount,
|
||||
RepeatSamples = repeatSamples
|
||||
RepeatSamples = repeatSamples,
|
||||
RepeatCount = repeatCount
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||
/// <summary>
|
||||
/// Legacy osu!mania Slider-type, used for parsing Beatmaps.
|
||||
/// </summary>
|
||||
internal sealed class Slider : CurvedHitObject, IHasXPosition, IHasCombo
|
||||
internal sealed class Slider : LegacySlider, IHasXPosition, IHasCombo
|
||||
{
|
||||
public float X { get; set; }
|
||||
|
||||
|
@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||
ControlPoints = controlPoints,
|
||||
Distance = length,
|
||||
CurveType = curveType,
|
||||
RepeatCount = repeatCount,
|
||||
RepeatSamples = repeatSamples
|
||||
RepeatSamples = repeatSamples,
|
||||
RepeatCount = repeatCount
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||
/// <summary>
|
||||
/// Legacy osu! Slider-type, used for parsing Beatmaps.
|
||||
/// </summary>
|
||||
internal sealed class Slider : CurvedHitObject, IHasPosition, IHasCombo
|
||||
internal sealed class Slider : LegacySlider, IHasPosition, IHasCombo
|
||||
{
|
||||
public Vector2 Position { get; set; }
|
||||
|
||||
|
@ -29,8 +29,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
||||
ControlPoints = controlPoints,
|
||||
Distance = length,
|
||||
CurveType = curveType,
|
||||
RepeatCount = repeatCount,
|
||||
RepeatSamples = repeatSamples
|
||||
RepeatSamples = repeatSamples,
|
||||
RepeatCount = repeatCount
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
||||
/// <summary>
|
||||
/// Legacy osu!taiko Slider-type, used for parsing Beatmaps.
|
||||
/// </summary>
|
||||
internal sealed class Slider : CurvedHitObject, IHasCombo
|
||||
internal sealed class Slider : LegacySlider, IHasCombo
|
||||
{
|
||||
public bool NewCombo { get; set; }
|
||||
}
|
||||
|
@ -113,6 +113,7 @@
|
||||
<Compile Include="Rulesets\Objects\Legacy\Catch\HitObjectParser.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Catch\Slider.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Catch\Spinner.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\LegacySlider.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Mania\Hit.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Mania\HitObjectParser.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Mania\Slider.cs" />
|
||||
@ -134,7 +135,6 @@
|
||||
<Compile Include="Rulesets\Objects\Drawables\HitResult.cs" />
|
||||
<Compile Include="Rulesets\Objects\BezierApproximator.cs" />
|
||||
<Compile Include="Rulesets\Objects\CircularArcApproximator.cs" />
|
||||
<Compile Include="Rulesets\Objects\CurvedHitObject.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Osu\Hit.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\HitObjectParser.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Hold.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user