mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 16:06:06 +08:00
Remove EquivalentTo() and Equals()
This commit is contained in:
parent
eb968d2bdb
commit
69fb984e71
@ -5,7 +5,7 @@ using System;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps.ControlPoints
|
namespace osu.Game.Beatmaps.ControlPoints
|
||||||
{
|
{
|
||||||
public abstract class ControlPoint : IComparable<ControlPoint>, IEquatable<ControlPoint>
|
public abstract class ControlPoint : IComparable<ControlPoint>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The time at which the control point takes effect.
|
/// The time at which the control point takes effect.
|
||||||
@ -18,13 +18,6 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
|
|
||||||
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this control point is equivalent to another, ignoring time.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="other">Another control point to compare with.</param>
|
|
||||||
/// <returns>Whether equivalent.</returns>
|
|
||||||
public abstract bool EquivalentTo(ControlPoint other);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this control point results in a meaningful change when placed after another.
|
/// Whether this control point results in a meaningful change when placed after another.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -32,7 +25,5 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// <param name="time">The time this control point will be placed at if it is added.</param>
|
/// <param name="time">The time this control point will be placed at if it is added.</param>
|
||||||
/// <returns>Whether redundant.</returns>
|
/// <returns>Whether redundant.</returns>
|
||||||
public abstract bool IsRedundant(ControlPoint existing, double time);
|
public abstract bool IsRedundant(ControlPoint existing, double time);
|
||||||
|
|
||||||
public bool Equals(ControlPoint other) => Time == other?.Time && EquivalentTo(other);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
set => SpeedMultiplierBindable.Value = value;
|
set => SpeedMultiplierBindable.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool EquivalentTo(ControlPoint other) =>
|
public override bool IsRedundant(ControlPoint existing, double time)
|
||||||
other is DifficultyControlPoint otherTyped && otherTyped.SpeedMultiplier.Equals(SpeedMultiplier);
|
=> existing is DifficultyControlPoint existingDifficulty
|
||||||
|
&& SpeedMultiplier == existingDifficulty.SpeedMultiplier;
|
||||||
public override bool IsRedundant(ControlPoint existing, double time) => EquivalentTo(existing);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,10 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
set => KiaiModeBindable.Value = value;
|
set => KiaiModeBindable.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool EquivalentTo(ControlPoint other) =>
|
public override bool IsRedundant(ControlPoint existing, double time)
|
||||||
other is EffectControlPoint otherTyped &&
|
=> !OmitFirstBarLine
|
||||||
KiaiMode == otherTyped.KiaiMode && OmitFirstBarLine == otherTyped.OmitFirstBarLine;
|
&& existing is EffectControlPoint existingEffect
|
||||||
|
&& KiaiMode == existingEffect.KiaiMode
|
||||||
public override bool IsRedundant(ControlPoint existing, double time) => !OmitFirstBarLine && EquivalentTo(existing);
|
&& OmitFirstBarLine == existingEffect.OmitFirstBarLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,10 +68,9 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
return newSampleInfo;
|
return newSampleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool EquivalentTo(ControlPoint other) =>
|
public override bool IsRedundant(ControlPoint existing, double time)
|
||||||
other is SampleControlPoint otherTyped &&
|
=> existing is SampleControlPoint existingSample
|
||||||
SampleBank == otherTyped.SampleBank && SampleVolume == otherTyped.SampleVolume;
|
&& SampleBank == existingSample.SampleBank
|
||||||
|
&& SampleVolume == existingSample.SampleVolume;
|
||||||
public override bool IsRedundant(ControlPoint existing, double time) => EquivalentTo(existing);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double BPM => 60000 / BeatLength;
|
public double BPM => 60000 / BeatLength;
|
||||||
|
|
||||||
public override bool EquivalentTo(ControlPoint other) =>
|
// Timing points are never redundant as they can change the time signature.
|
||||||
other is TimingControlPoint otherTyped
|
public override bool IsRedundant(ControlPoint existing, double time) => false;
|
||||||
&& TimeSignature == otherTyped.TimeSignature && BeatLength.Equals(otherTyped.BeatLength);
|
|
||||||
|
|
||||||
public override bool IsRedundant(ControlPoint existing, double time) =>
|
|
||||||
EquivalentTo(existing)
|
|
||||||
&& existing.Time == time;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,9 +174,10 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
return baseInfo;
|
return baseInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool EquivalentTo(ControlPoint other) =>
|
public override bool IsRedundant(ControlPoint existing, double time)
|
||||||
base.EquivalentTo(other) && other is LegacySampleControlPoint otherTyped &&
|
=> base.IsRedundant(existing, time)
|
||||||
CustomSampleBank == otherTyped.CustomSampleBank;
|
&& existing is LegacySampleControlPoint existingSample
|
||||||
|
&& CustomSampleBank == existingSample.CustomSampleBank;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
TimeSinceLastBeat = beatLength - TimeUntilNextBeat;
|
TimeSinceLastBeat = beatLength - TimeUntilNextBeat;
|
||||||
|
|
||||||
if (timingPoint.Equals(lastTimingPoint) && beatIndex == lastBeat)
|
if (timingPoint == lastTimingPoint && beatIndex == lastBeat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using (BeginDelayedSequence(-TimeSinceLastBeat, true))
|
using (BeginDelayedSequence(-TimeSinceLastBeat, true))
|
||||||
|
Loading…
Reference in New Issue
Block a user