Implement IEquatable on ControlPoint

This commit is contained in:
Dan Balasescu
2022-06-20 14:56:04 +09:00
parent 468e5fcbed
commit 03ab6fc141
7 changed files with 109 additions and 22 deletions

View File

@ -1,15 +1,14 @@
// 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.
#nullable disable
using System;
using osu.Framework.Bindables;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints
{
public class EffectControlPoint : ControlPoint
public class EffectControlPoint : ControlPoint, IEquatable<EffectControlPoint>
{
public static readonly EffectControlPoint DEFAULT = new EffectControlPoint
{
@ -83,5 +82,17 @@ namespace osu.Game.Beatmaps.ControlPoints
base.CopyFrom(other);
}
public override bool Equals(ControlPoint? other)
=> other is EffectControlPoint otherEffectControlPoint
&& Equals(otherEffectControlPoint);
public bool Equals(EffectControlPoint? other)
=> base.Equals(other)
&& OmitFirstBarLine == other.OmitFirstBarLine
&& ScrollSpeed == other.ScrollSpeed
&& KiaiMode == other.KiaiMode;
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), OmitFirstBarLine, ScrollSpeed, KiaiMode);
}
}