47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Quaver.API.Maps.Structures
|
|
{
|
|
/// <summary>
|
|
/// KeySounds property of hit objects.
|
|
/// </summary>
|
|
[Serializable]
|
|
public class KeySoundInfo
|
|
{
|
|
/// <summary>
|
|
/// The one-based index of the sound sample in the CustomAudioSamples array.
|
|
/// </summary>
|
|
public int Sample { get; set; }
|
|
|
|
/// <summary>
|
|
/// The volume of the sound sample. Defaults to 100.
|
|
/// </summary>
|
|
public int Volume { get; set; }
|
|
|
|
/// <summary>
|
|
/// By-value comparer, auto-generated by Rider.
|
|
/// </summary>
|
|
private sealed class ByValueEqualityComparer : IEqualityComparer<KeySoundInfo>
|
|
{
|
|
public bool Equals(KeySoundInfo x, KeySoundInfo y)
|
|
{
|
|
if (ReferenceEquals(x, y)) return true;
|
|
if (ReferenceEquals(x, null)) return false;
|
|
if (ReferenceEquals(y, null)) return false;
|
|
if (x.GetType() != y.GetType()) return false;
|
|
return x.Sample == y.Sample && x.Volume == y.Volume;
|
|
}
|
|
|
|
public int GetHashCode(KeySoundInfo obj)
|
|
{
|
|
unchecked
|
|
{
|
|
return (obj.Sample * 397) ^ obj.Volume;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static IEqualityComparer<KeySoundInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
|
|
}
|
|
} |