mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 04:13:11 +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);
|
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="other">The <see cref="ControlPoint"/> to compare to.</param>
|
/// <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>
|
/// <returns>Whether this <see cref="ControlPoint"/> is equivalent to <paramref name="other"/>.</returns>
|
||||||
public virtual bool ChangeEquals(ControlPoint other) => !ReferenceEquals(null, other);
|
public virtual bool EquivalentTo(ControlPoint other) => true;
|
||||||
|
|
||||||
public bool Equals(ControlPoint other)
|
public bool Equals(ControlPoint other)
|
||||||
=> ChangeEquals(other)
|
=> EquivalentTo(other) && Time.Equals(other?.Time);
|
||||||
&& !ReferenceEquals(null, other)
|
|
||||||
&& Time.Equals(other.Time);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
|
|
||||||
private double speedMultiplier = 1;
|
private double speedMultiplier = 1;
|
||||||
|
|
||||||
public override bool ChangeEquals(ControlPoint other)
|
public override bool EquivalentTo(ControlPoint other)
|
||||||
=> base.ChangeEquals(other)
|
=> base.EquivalentTo(other)
|
||||||
&& other is DifficultyControlPoint difficulty
|
&& other is DifficultyControlPoint difficulty
|
||||||
&& SpeedMultiplier.Equals(difficulty.SpeedMultiplier);
|
&& SpeedMultiplier.Equals(difficulty.SpeedMultiplier);
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool OmitFirstBarLine;
|
public bool OmitFirstBarLine;
|
||||||
|
|
||||||
public override bool ChangeEquals(ControlPoint other)
|
public override bool EquivalentTo(ControlPoint other)
|
||||||
=> base.ChangeEquals(other)
|
=> base.EquivalentTo(other)
|
||||||
&& other is EffectControlPoint effect
|
&& other is EffectControlPoint effect
|
||||||
&& KiaiMode.Equals(effect.KiaiMode)
|
&& KiaiMode.Equals(effect.KiaiMode)
|
||||||
&& OmitFirstBarLine.Equals(effect.OmitFirstBarLine);
|
&& OmitFirstBarLine.Equals(effect.OmitFirstBarLine);
|
||||||
|
@ -45,8 +45,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
return newSampleInfo;
|
return newSampleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ChangeEquals(ControlPoint other)
|
public override bool EquivalentTo(ControlPoint other)
|
||||||
=> base.ChangeEquals(other)
|
=> base.EquivalentTo(other)
|
||||||
&& other is SampleControlPoint sample
|
&& other is SampleControlPoint sample
|
||||||
&& SampleBank.Equals(sample.SampleBank)
|
&& SampleBank.Equals(sample.SampleBank)
|
||||||
&& SampleVolume.Equals(sample.SampleVolume);
|
&& SampleVolume.Equals(sample.SampleVolume);
|
||||||
|
@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
|
|
||||||
private double beatLength = 1000;
|
private double beatLength = 1000;
|
||||||
|
|
||||||
public override bool ChangeEquals(ControlPoint other)
|
public override bool EquivalentTo(ControlPoint other)
|
||||||
=> base.ChangeEquals(other)
|
=> base.EquivalentTo(other)
|
||||||
&& other is TimingControlPoint timing
|
&& other is TimingControlPoint timing
|
||||||
&& TimeSignature.Equals(timing.TimeSignature)
|
&& TimeSignature.Equals(timing.TimeSignature)
|
||||||
&& BeatLength.Equals(timing.BeatLength);
|
&& BeatLength.Equals(timing.BeatLength);
|
||||||
|
@ -359,7 +359,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time);
|
var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time);
|
||||||
|
|
||||||
if (newPoint.ChangeEquals(existing))
|
if (newPoint.EquivalentTo(existing))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time);
|
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);
|
var existing = beatmap.ControlPointInfo.EffectPointAt(newPoint.Time);
|
||||||
|
|
||||||
if (newPoint.ChangeEquals(existing))
|
if (newPoint.EquivalentTo(existing))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmap.ControlPointInfo.EffectPoints.Add(newPoint);
|
beatmap.ControlPointInfo.EffectPoints.Add(newPoint);
|
||||||
@ -380,7 +380,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time);
|
var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time);
|
||||||
|
|
||||||
if (newPoint.ChangeEquals(existing))
|
if (newPoint.EquivalentTo(existing))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmap.ControlPointInfo.SamplePoints.Add(newPoint);
|
beatmap.ControlPointInfo.SamplePoints.Add(newPoint);
|
||||||
|
@ -184,8 +184,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
return baseInfo;
|
return baseInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ChangeEquals(ControlPoint other)
|
public override bool EquivalentTo(ControlPoint other)
|
||||||
=> base.ChangeEquals(other)
|
=> base.EquivalentTo(other)
|
||||||
&& other is LegacySampleControlPoint legacy
|
&& other is LegacySampleControlPoint legacy
|
||||||
&& CustomSampleBank == legacy.CustomSampleBank;
|
&& CustomSampleBank == legacy.CustomSampleBank;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user