Remove HeadSamples and TailSamples, combine into RepeatSamples.

This commit is contained in:
smoogipooo 2017-04-21 20:04:40 +09:00
parent 382e656e9f
commit 748f13501a
9 changed files with 6 additions and 48 deletions

View File

@ -34,8 +34,6 @@ public class Slider : OsuHitObject, IHasCurve
public int RepeatAt(double progress) => CurveObject.RepeatAt(progress);
public List<List<SampleInfo>> RepeatSamples => CurveObject.RepeatSamples;
public List<SampleInfo> HeadSamples => CurveObject.HeadSamples;
public List<SampleInfo> TailSamples => CurveObject.TailSamples;
public List<Vector2> ControlPoints => CurveObject.ControlPoints;
public CurveType CurveType => CurveObject.CurveType;

View File

@ -37,9 +37,6 @@ public double Distance
public List<List<SampleInfo>> RepeatSamples { get; set; } = new List<List<SampleInfo>>();
public List<SampleInfo> HeadSamples { get; set; } = new List<SampleInfo>();
public List<SampleInfo> TailSamples { get; set; } = new List<SampleInfo>();
public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress));
public double ProgressAt(double progress)

View File

@ -49,11 +49,6 @@ public virtual void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficult
// Initialize any repeat samples
var repeatData = this as IHasRepeats;
repeatData?.RepeatSamples?.ForEach(r => r.ForEach(s => initializeSampleInfo(s, samplePoint)));
// Initialize any curved object samples
var curvedObject = this as CurvedHitObject;
curvedObject?.HeadSamples.ForEach(s => initializeSampleInfo(s, samplePoint));
curvedObject?.TailSamples.ForEach(s => initializeSampleInfo(s, samplePoint));
}
private void initializeSampleInfo(SampleInfo sample, ControlPoint controlPoint)

View File

@ -22,8 +22,7 @@ protected override HitObject CreateHit(Vector2 position, bool newCombo)
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType,
int repeatCount, List<SampleInfo> headSamples, List<SampleInfo> tailSamples, List<List<SampleInfo>> repeatSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{
return new Slider
{
@ -33,8 +32,6 @@ protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<
Distance = length,
CurveType = curveType,
RepeatCount = repeatCount,
HeadSamples = headSamples,
TailSamples = tailSamples,
RepeatSamples = repeatSamples
};
}

View File

@ -8,7 +8,6 @@
using System.Globalization;
using osu.Game.Beatmaps.Formats;
using osu.Game.Audio;
using System.Linq;
namespace osu.Game.Rulesets.Objects.Legacy
{
@ -127,14 +126,7 @@ public override HitObject Parse(string text)
for (int i = 0; i <= repeatCount; i++)
nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
// Extract the first and last samples for the head and tail respectively
List<SampleInfo> headSamples = nodeSamples.First();
List<SampleInfo> tailSamples = nodeSamples.Last();
// Repeat samples are all the samples between head and tail
var repeatSamples = nodeSamples.Skip(1).TakeWhile(s => s != tailSamples).ToList();
result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, headSamples, tailSamples, repeatSamples);
result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, nodeSamples);
}
else if ((type & HitObjectType.Spinner) > 0)
{
@ -213,8 +205,7 @@ private void readCustomSampleBanks(string str, SampleBankInfo bankInfo)
/// <param name="tailSamples">The samples to be played when the tail of the slider is hit.</param>
/// <param name="repeatSamples">The samples to be played when the repeat nodes are hit.</param>
/// <returns>The hit object.</returns>
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType,
int repeatCount, List<SampleInfo> headSamples, List<SampleInfo> tailSamples, List<List<SampleInfo>> repeatSamples);
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples);
/// <summary>
/// Creates a legacy Spinner-type hit object.

View File

@ -22,8 +22,7 @@ protected override HitObject CreateHit(Vector2 position, bool newCombo)
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType,
int repeatCount, List<SampleInfo> headSamples, List<SampleInfo> tailSamples, List<List<SampleInfo>> repeatSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{
return new Slider
{
@ -33,8 +32,6 @@ protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<
Distance = length,
CurveType = curveType,
RepeatCount = repeatCount,
HeadSamples = headSamples,
TailSamples = tailSamples,
RepeatSamples = repeatSamples
};
}

View File

@ -22,8 +22,7 @@ protected override HitObject CreateHit(Vector2 position, bool newCombo)
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType,
int repeatCount, List<SampleInfo> headSamples, List<SampleInfo> tailSamples, List<List<SampleInfo>> repeatSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{
return new Slider
{
@ -33,8 +32,6 @@ protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<
Distance = length,
CurveType = curveType,
RepeatCount = repeatCount,
HeadSamples = headSamples,
TailSamples = tailSamples,
RepeatSamples = repeatSamples
};
}

View File

@ -21,8 +21,7 @@ protected override HitObject CreateHit(Vector2 position, bool newCombo)
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType,
int repeatCount, List<SampleInfo> headSamples, List<SampleInfo> tailSamples, List<List<SampleInfo>> repeatSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{
return new Slider
{
@ -31,8 +30,6 @@ protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<
Distance = length,
CurveType = curveType,
RepeatCount = repeatCount,
HeadSamples = headSamples,
TailSamples = tailSamples,
RepeatSamples = repeatSamples
};
}

View File

@ -3,7 +3,6 @@
using System.Collections.Generic;
using OpenTK;
using osu.Game.Audio;
namespace osu.Game.Rulesets.Objects.Types
{
@ -27,16 +26,6 @@ public interface IHasCurve : IHasDistance, IHasRepeats
/// </summary>
CurveType CurveType { get; }
/// <summary>
/// The samples to be played when the head of the hit object is hit.
/// </summary>
List<SampleInfo> HeadSamples { get; }
/// <summary>
/// The samples to be played when the tail of the hit object is hit.
/// </summary>
List<SampleInfo> TailSamples { get; }
/// <summary>
/// Computes the position on the curve at a given progress, accounting for repeat logic.
/// <para>