Add QuaverChartConverter.

This commit is contained in:
2022-12-13 10:51:29 +08:00
parent f5df56687b
commit 251f92532d
30 changed files with 2389 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 82458af35dc0eff4f9f5bcfc7ffd9482
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 81c3fbb9e3606dd40908ceb861f822ea
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
/*
* 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-2018 Swan & The Quaver Team <support@quavergame.com>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Quaver.API.Enums
{
public enum GameMode
{
Keys4 = 1,
Keys7 = 2
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e80eaf8c181728041aefa03ada870aed
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
/*
* 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-2018 Swan & The Quaver Team <support@quavergame.com>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Quaver.API.Enums
{
[Flags]
public enum HitSounds
{
Normal = 1 << 0, // This is 1, but Normal should be played regardless if it's 0 or 1.
Whistle = 1 << 1, // 2
Finish = 1 << 2, // 4
Clap = 1 << 3 // 8
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4d483d5965d754445b9a330ba2e8dfbc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using System;
namespace Quaver.API.Enums
{
/// <summary>
/// Signature of a timing point
/// </summary>
[Serializable]
public enum TimeSignature
{
Quadruple = 4,
Triple = 3,
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bb27bc1bd269d214b8d8b95b91992955
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 15da1854a8e5270489fd79b20f741c1a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 07f411a2b58802d408e547b9f1cf7ca7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0cdc2cff3891fb34d91ee006bafca3a9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,54 @@
/*
* 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>
/// CustomAudioSamples section of the .qua
/// </summary>
[Serializable]
public class CustomAudioSampleInfo
{
/// <summary>
/// The path to the audio sample.
/// </summary>
public string Path { get; set; }
/// <summary>
/// If true, the audio sample is always played back at 1.0x speed, regardless of the rate.
/// </summary>
public bool UnaffectedByRate { get; set; }
/// <summary>
/// By-value comparer, auto-generated by Rider.
/// </summary>
private sealed class ByValueEqualityComparer : IEqualityComparer<CustomAudioSampleInfo>
{
public bool Equals(CustomAudioSampleInfo x, CustomAudioSampleInfo 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 string.Equals(x.Path, y.Path) && x.UnaffectedByRate == y.UnaffectedByRate;
}
public int GetHashCode(CustomAudioSampleInfo obj)
{
unchecked
{
return ((obj.Path != null ? obj.Path.GetHashCode() : 0) * 397) ^ obj.UnaffectedByRate.GetHashCode();
}
}
}
public static IEqualityComparer<CustomAudioSampleInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0690882ce72359c409a12dfa0b4999ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Drawing;
//using MoonSharp.Interpreter;
//using MoonSharp.Interpreter.Interop;
using YamlDotNet.Serialization;
namespace Quaver.API.Maps.Structures
{
[Serializable]
/*[MoonSharpUserData]*/
public class EditorLayerInfo
{
/// <summary>
/// The name of the layer
/// </summary>
public string Name { get; /*[MoonSharpVisible(false)]*/ set; }
/// <summary>
/// Is the layer hidden in the editor?
/// </summary>
public bool Hidden { get; /*[MoonSharpVisible(false)]*/ set; }
/// <summary>
/// The color of the layer (default is white)
/// </summary>
public string ColorRgb { get; /*[MoonSharpVisible(false)]*/ set; }
/// <summary>
/// Converts the stringified color to a System.Drawing color
/// </summary>
/// <returns></returns>
/*[MoonSharpVisible(false)]*/
public Color GetColor()
{
if (ColorRgb == null)
return Color.White;
var split = ColorRgb.Split(',');
try
{
return Color.FromArgb(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]));
}
catch (Exception)
{
return Color.White;
}
}
/// <summary>
/// By-value comparer, auto-generated by Rider.
/// </summary>
private sealed class ByValueEqualityComparer : IEqualityComparer<EditorLayerInfo>
{
public bool Equals(EditorLayerInfo x, EditorLayerInfo 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 string.Equals(x.Name, y.Name) && x.Hidden == y.Hidden && string.Equals(x.ColorRgb, y.ColorRgb);
}
public int GetHashCode(EditorLayerInfo obj)
{
unchecked
{
var hashCode = obj.Name.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Hidden.GetHashCode();
hashCode = (hashCode * 397) ^ obj.ColorRgb.GetHashCode();
return hashCode;
}
}
}
public static IEqualityComparer<EditorLayerInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f5d19ab23108e3d41a2d77670afbab10
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,187 @@
/*
* 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;
using System.Linq;
//using MoonSharp.Interpreter;
//using MoonSharp.Interpreter.Interop;
using Quaver.API.Enums;
using YamlDotNet.Serialization;
namespace Quaver.API.Maps.Structures
{
/// <summary>
/// HitObjects section of the .qua
/// </summary>
/*[MoonSharpUserData]*/
[Serializable]
public class HitObjectInfo
{
/// <summary>
/// The time in milliseconds when the HitObject is supposed to be hit.
/// </summary>
public int StartTime
{
get;
/*[MoonSharpVisible(false)]*/ set;
}
/// <summary>
/// The lane the HitObject falls in
/// </summary>
public int Lane
{
get;
/*MoonSharpVisible(false)]*/ set;
}
/// <summary>
/// The endtime of the HitObject (if greater than 0, it's considered a hold note.)
/// </summary>
public int EndTime
{
get;
/*[MoonSharpVisible(false)]*/ set;
}
/// <summary>
/// Bitwise combination of hit sounds for this object
/// </summary>
public HitSounds HitSound
{
get;
/*[MoonSharpVisible(false)]*/ set;
}
/// <summary>
/// Key sounds to play when this object is hit.
/// </summary>
/*[MoonSharpVisible(false)]*/
public List<KeySoundInfo> KeySounds { get; set; } = new List<KeySoundInfo>();
/// <summary>
/// The layer in the editor that the object belongs to.
/// </summary>
public int EditorLayer
{
get;
/*[MoonSharpVisible(false)]*/ set;
}
/// <summary>
/// If the object is a long note. (EndTime > 0)
/// </summary>
[YamlIgnore]
public bool IsLongNote => EndTime > 0;
/// <summary>
/// Returns if the object is allowed to be edited in lua scripts
/// </summary>
[YamlIgnore]
public bool IsEditableInLuaScript
{
get;
/*[MoonSharpVisible(false)]*/ set;
}
/// <summary>
/// Gets the timing point this object is in range of.
/// </summary>
/// <returns></returns>
public TimingPointInfo GetTimingPoint(List<TimingPointInfo> timingPoints)
{
// Search through the entire list for the correct point
for (var i = timingPoints.Count - 1; i >= 0; i--)
{
if (StartTime >= timingPoints[i].StartTime)
return timingPoints[i];
}
return timingPoints.First();
}
/// <summary>
/// </summary>
/// <param name="time"></param>
/// <exception cref="InvalidOperationException"></exception>
public void SetStartTime(int time)
{
ThrowUneditableException();
StartTime = time;
}
/// <summary>
/// </summary>
/// <exception cref="InvalidOperationException"></exception>
public void SetEndTime(int time)
{
ThrowUneditableException();
EndTime = time;
}
/// <summary>
/// </summary>
/// <param name="lane"></param>
public void SetLane(int lane)
{
ThrowUneditableException();
Lane = lane;
}
/// <summary>
/// </summary>
/// <param name="hitsounds"></param>
public void SetHitSounds(HitSounds hitsounds)
{
ThrowUneditableException();
HitSound = hitsounds;
}
/// <summary>
/// </summary>
/// <exception cref="InvalidOperationException"></exception>
private void ThrowUneditableException()
{
if (!IsEditableInLuaScript)
throw new InvalidOperationException("Value is not allowed to be edited in lua scripts.");
}
/// <summary>
/// By-value comparer, mostly auto-generated by Rider: KeySounds-related code is changed to by-value.
/// </summary>
private sealed class ByValueEqualityComparer : IEqualityComparer<HitObjectInfo>
{
public bool Equals(HitObjectInfo x, HitObjectInfo 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 == y.StartTime && x.Lane == y.Lane && x.EndTime == y.EndTime && x.HitSound == y.HitSound && x.KeySounds.SequenceEqual(y.KeySounds, KeySoundInfo.ByValueComparer) && x.EditorLayer == y.EditorLayer;
}
public int GetHashCode(HitObjectInfo obj)
{
unchecked
{
var hashCode = obj.StartTime;
hashCode = (hashCode * 397) ^ obj.Lane;
hashCode = (hashCode * 397) ^ obj.EndTime;
hashCode = (hashCode * 397) ^ (int) obj.HitSound;
foreach (var keySound in obj.KeySounds)
hashCode = (hashCode * 397) ^ KeySoundInfo.ByValueComparer.GetHashCode(keySound);
hashCode = (hashCode * 397) ^ obj.EditorLayer;
return hashCode;
}
}
}
public static IEqualityComparer<HitObjectInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 14fc15101f91a2c439d64f27a699da09
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,47 @@
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();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad94e179dbb3a5e47b47c8475e3e707f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,109 @@
/*
* 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;
//using MoonSharp.Interpreter;
//using MoonSharp.Interpreter.Interop;
using YamlDotNet.Serialization;
namespace Quaver.API.Maps.Structures
{
/// <summary>
/// SliderVelocities section of the .qua
/// </summary>
[Serializable]
/*[MoonSharpUserData]*/
public class SliderVelocityInfo
{
/// <summary>
/// The time in milliseconds when the new SliderVelocity section begins
/// </summary>
public float StartTime
{
get;
/*[MoonSharpVisible(false)]*/ set;
}
/// <summary>
/// The velocity multiplier relative to the current timing section's BPM
/// </summary>
public float Multiplier
{
get;
/*[MoonSharpVisible(false)]*/ set;
}
/// <summary>
/// Returns if the SV is allowed to be edited in lua scripts
/// </summary>
[YamlIgnore]
public bool IsEditableInLuaScript
{
get;
/*[MoonSharpVisible(false)]*/ set;
}
/// <summary>
/// Sets the start time of the SV.
/// FOR USE IN LUA SCRIPTS ONLY.
/// </summary>
/// <param name="time"></param>
/// <exception cref="InvalidOperationException"></exception>
public void SetStartTime(float time)
{
ThrowUneditableException();
StartTime = time;
}
/// <summary>
/// Sets the multiplier of the SV.
/// FOR USE IN LUA SCRIPTS ONLY.
/// </summary>
/// <param name="multiplier"></param>
/// <exception cref="InvalidOperationException"></exception>
public void SetMultiplier(float multiplier)
{
ThrowUneditableException();
Multiplier = multiplier;
}
/// <summary>
/// </summary>
/// <exception cref="InvalidOperationException"></exception>
private void ThrowUneditableException()
{
if (!IsEditableInLuaScript)
throw new InvalidOperationException("Value is not allowed to be edited in lua scripts.");
}
/// <summary>
/// By-value comparer, auto-generated by Rider.
/// </summary>
private sealed class ByValueEqualityComparer : IEqualityComparer<SliderVelocityInfo>
{
public bool Equals(SliderVelocityInfo x, SliderVelocityInfo 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.Multiplier.Equals(y.Multiplier);
}
public int GetHashCode(SliderVelocityInfo obj)
{
unchecked
{
return (obj.StartTime.GetHashCode() * 397) ^ obj.Multiplier.GetHashCode();
}
}
}
public static IEqualityComparer<SliderVelocityInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cebb7330d6e4d9b4da4ceb367c1a2fd4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,62 @@
/*
* 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();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2f1502b1df0fdb9459d43358ed857875
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 02c7f0a85b74dc34cad4f1e3dea4dbbc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: