/* * 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 . */ using System; using System.Collections.Generic; //using MoonSharp.Interpreter; //using MoonSharp.Interpreter.Interop; using Quaver.API.Enums; using YamlDotNet.Serialization; namespace Quaver.API.Maps.Structures { /// /// TimingPoints section of the .qua /// [Serializable] /*[MoonSharpUserData]*/ public class TimingPointInfo { /// /// The time in milliseconds for when this timing point begins /// public float StartTime { get; /*[MoonSharpVisible(false)]*/ set; } /// /// The BPM during this timing point /// public float Bpm { get; /*[MoonSharpVisible(false)]*/ set; } /// /// The signature during this timing point /// public TimeSignature Signature { get; /*[MoonSharpVisible(false)]*/ set; } /// /// Whether timing lines during this timing point should be hidden or not /// public bool Hidden { get; /*[MoonSharpVisible(false)]*/ set; } [YamlIgnore] public bool IsEditableInLuaScript { get; /*[MoonSharpVisible(false)]*/ set; } /// /// The amount of milliseconds per beat this one takes up. /// [YamlIgnore] public float MillisecondsPerBeat => 60000 / Bpm; /// /// By-value comparer, auto-generated by Rider. /// private sealed class ByValueEqualityComparer : IEqualityComparer { public bool Equals(TimingPointInfo x, TimingPointInfo 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.Bpm.Equals(y.Bpm) && x.Signature == y.Signature && x.Hidden == y.Hidden; } public int GetHashCode(TimingPointInfo obj) { unchecked { var hashCode = obj.StartTime.GetHashCode(); hashCode = (hashCode * 397) ^ obj.Bpm.GetHashCode(); hashCode = (hashCode * 397) ^ (int) obj.Signature; hashCode = (hashCode * 397) ^ (obj.Hidden ? 1 : 0); return hashCode; } } } public static IEqualityComparer ByValueComparer { get; } = new ByValueEqualityComparer(); } }