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