mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08:00
Remove ControlPoint.EquivalentTo
This commit is contained in:
parent
7e38aabe75
commit
7a56fe84f2
@ -19,15 +19,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
|
||||
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
||||
|
||||
/// <summary>
|
||||
/// 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"/> is equivalent to <paramref name="other"/>.</returns>
|
||||
public virtual bool EquivalentTo(ControlPoint other) => true;
|
||||
|
||||
public bool Equals(ControlPoint other)
|
||||
=> EquivalentTo(other) && Time.Equals(other?.Time);
|
||||
=> Time.Equals(other?.Time);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Beatmaps.ControlPoints
|
||||
{
|
||||
public class DifficultyControlPoint : ControlPoint
|
||||
public class DifficultyControlPoint : ControlPoint, IEquatable<DifficultyControlPoint>
|
||||
{
|
||||
/// <summary>
|
||||
/// The speed multiplier at this control point.
|
||||
@ -18,9 +19,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
|
||||
private double speedMultiplier = 1;
|
||||
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is DifficultyControlPoint difficulty
|
||||
&& SpeedMultiplier.Equals(difficulty.SpeedMultiplier);
|
||||
public bool Equals(DifficultyControlPoint other)
|
||||
=> base.Equals(other)
|
||||
&& SpeedMultiplier.Equals(other?.SpeedMultiplier);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Beatmaps.ControlPoints
|
||||
{
|
||||
public class EffectControlPoint : ControlPoint
|
||||
public class EffectControlPoint : ControlPoint, IEquatable<EffectControlPoint>
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether this control point enables Kiai mode.
|
||||
@ -15,10 +17,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// </summary>
|
||||
public bool OmitFirstBarLine;
|
||||
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is EffectControlPoint effect
|
||||
&& KiaiMode.Equals(effect.KiaiMode)
|
||||
&& OmitFirstBarLine.Equals(effect.OmitFirstBarLine);
|
||||
public bool Equals(EffectControlPoint other)
|
||||
=> base.Equals(other)
|
||||
&& KiaiMode == other?.KiaiMode && OmitFirstBarLine == other.OmitFirstBarLine;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Audio;
|
||||
|
||||
namespace osu.Game.Beatmaps.ControlPoints
|
||||
{
|
||||
public class SampleControlPoint : ControlPoint
|
||||
public class SampleControlPoint : ControlPoint, IEquatable<SampleControlPoint>
|
||||
{
|
||||
public const string DEFAULT_BANK = "normal";
|
||||
|
||||
@ -44,10 +45,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
return newSampleInfo;
|
||||
}
|
||||
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is SampleControlPoint sample
|
||||
&& SampleBank.Equals(sample.SampleBank)
|
||||
&& SampleVolume.Equals(sample.SampleVolume);
|
||||
public bool Equals(SampleControlPoint other)
|
||||
=> base.Equals(other)
|
||||
&& string.Equals(SampleBank, other?.SampleBank) && SampleVolume == other?.SampleVolume;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osuTK;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
|
||||
namespace osu.Game.Beatmaps.ControlPoints
|
||||
{
|
||||
public class TimingControlPoint : ControlPoint
|
||||
public class TimingControlPoint : ControlPoint, IEquatable<TimingControlPoint>
|
||||
{
|
||||
/// <summary>
|
||||
/// The time signature at this control point.
|
||||
@ -24,10 +25,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
|
||||
private double beatLength = 1000;
|
||||
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is TimingControlPoint timing
|
||||
&& TimeSignature.Equals(timing.TimeSignature)
|
||||
&& BeatLength.Equals(timing.BeatLength);
|
||||
public bool Equals(TimingControlPoint other)
|
||||
=> base.Equals(other)
|
||||
&& TimeSignature == other?.TimeSignature && beatLength.Equals(other.beatLength);
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
Foreground = 3
|
||||
}
|
||||
|
||||
internal class LegacySampleControlPoint : SampleControlPoint
|
||||
internal class LegacySampleControlPoint : SampleControlPoint, IEquatable<LegacySampleControlPoint>
|
||||
{
|
||||
public int CustomSampleBank;
|
||||
|
||||
@ -203,10 +203,9 @@ namespace osu.Game.Beatmaps.Formats
|
||||
return baseInfo;
|
||||
}
|
||||
|
||||
public override bool EquivalentTo(ControlPoint other)
|
||||
=> base.EquivalentTo(other)
|
||||
&& other is LegacySampleControlPoint legacy
|
||||
&& CustomSampleBank == legacy.CustomSampleBank;
|
||||
public bool Equals(LegacySampleControlPoint other)
|
||||
=> base.Equals(other)
|
||||
&& CustomSampleBank == other?.CustomSampleBank;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user