mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Rename method to EquivalentTo
This commit is contained in:
parent
d11ba2df0e
commit
44aecdc3a0
@ -15,15 +15,14 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="ControlPoint"/> provides the same changes to gameplay as another <see cref="ControlPoint"/>.
|
||||
/// Whether this <see cref="ControlPoint"/> provides the same parametric changes as another <see cref="ControlPoint"/>.
|
||||
/// Basically an equality check without considering the <see cref="Time"/>.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="ControlPoint"/> to compare to.</param>
|
||||
/// <returns>Whether this <see cref="ControlPoint"/> provides the same changes to gameplay as <paramref name="other"/>.</returns>
|
||||
public virtual bool ChangeEquals(ControlPoint other) => !ReferenceEquals(null, other);
|
||||
/// <returns>Whether this <see cref="ControlPoint"/> is equivalent to <paramref name="other"/>.</returns>
|
||||
public virtual bool EquivalentTo(ControlPoint other) => true;
|
||||
|
||||
public bool Equals(ControlPoint other)
|
||||
=> ChangeEquals(other)
|
||||
&& !ReferenceEquals(null, other)
|
||||
&& Time.Equals(other.Time);
|
||||
=> EquivalentTo(other) && Time.Equals(other?.Time);
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
|
||||
private double speedMultiplier = 1;
|
||||
|
||||
public override bool ChangeEquals(ControlPoint other)
|
||||
=> base.ChangeEquals(other)
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is DifficultyControlPoint difficulty
|
||||
&& SpeedMultiplier.Equals(difficulty.SpeedMultiplier);
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// </summary>
|
||||
public bool OmitFirstBarLine;
|
||||
|
||||
public override bool ChangeEquals(ControlPoint other)
|
||||
=> base.ChangeEquals(other)
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is EffectControlPoint effect
|
||||
&& KiaiMode.Equals(effect.KiaiMode)
|
||||
&& OmitFirstBarLine.Equals(effect.OmitFirstBarLine);
|
||||
|
@ -45,8 +45,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
return newSampleInfo;
|
||||
}
|
||||
|
||||
public override bool ChangeEquals(ControlPoint other)
|
||||
=> base.ChangeEquals(other)
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is SampleControlPoint sample
|
||||
&& SampleBank.Equals(sample.SampleBank)
|
||||
&& SampleVolume.Equals(sample.SampleVolume);
|
||||
|
@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
|
||||
private double beatLength = 1000;
|
||||
|
||||
public override bool ChangeEquals(ControlPoint other)
|
||||
=> base.ChangeEquals(other)
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is TimingControlPoint timing
|
||||
&& TimeSignature.Equals(timing.TimeSignature)
|
||||
&& BeatLength.Equals(timing.BeatLength);
|
||||
|
@ -359,7 +359,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time);
|
||||
|
||||
if (newPoint.ChangeEquals(existing))
|
||||
if (newPoint.EquivalentTo(existing))
|
||||
return;
|
||||
|
||||
beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time);
|
||||
@ -370,7 +370,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
var existing = beatmap.ControlPointInfo.EffectPointAt(newPoint.Time);
|
||||
|
||||
if (newPoint.ChangeEquals(existing))
|
||||
if (newPoint.EquivalentTo(existing))
|
||||
return;
|
||||
|
||||
beatmap.ControlPointInfo.EffectPoints.Add(newPoint);
|
||||
@ -380,7 +380,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time);
|
||||
|
||||
if (newPoint.ChangeEquals(existing))
|
||||
if (newPoint.EquivalentTo(existing))
|
||||
return;
|
||||
|
||||
beatmap.ControlPointInfo.SamplePoints.Add(newPoint);
|
||||
|
@ -184,8 +184,8 @@ namespace osu.Game.Beatmaps.Formats
|
||||
return baseInfo;
|
||||
}
|
||||
|
||||
public override bool ChangeEquals(ControlPoint other)
|
||||
=> base.ChangeEquals(other)
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is LegacySampleControlPoint legacy
|
||||
&& CustomSampleBank == legacy.CustomSampleBank;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user