62 lines
2.1 KiB
C#
62 lines
2.1 KiB
C#
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
* Copyright (c) 2017-2019 Swan & The Quaver Team <support@quavergame.com>.
|
|
*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Quaver.API.Maps.Structures
|
|
{
|
|
/// <summary>
|
|
/// SoundEffects section of the .qua
|
|
/// </summary>
|
|
[Serializable]
|
|
public class SoundEffectInfo
|
|
{
|
|
/// <summary>
|
|
/// The time at which to play the sound sample.
|
|
/// </summary>
|
|
public float StartTime { get; set; }
|
|
|
|
/// <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<SoundEffectInfo>
|
|
{
|
|
public bool Equals(SoundEffectInfo x, SoundEffectInfo 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.StartTime.Equals(y.StartTime) && x.Sample == y.Sample && x.Volume == y.Volume;
|
|
}
|
|
|
|
public int GetHashCode(SoundEffectInfo obj)
|
|
{
|
|
unchecked
|
|
{
|
|
var hashCode = obj.StartTime.GetHashCode();
|
|
hashCode = (hashCode * 397) ^ obj.Sample;
|
|
hashCode = (hashCode * 397) ^ obj.Volume;
|
|
return hashCode;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static IEqualityComparer<SoundEffectInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
|
|
}
|
|
} |