sinmai-mods/MoreChartFormats/ParserUtilities.cs
2024-05-27 10:59:40 +07:00

48 lines
1.1 KiB
C#

using Manager;
using MoreChartFormats.Simai.Structures;
namespace MoreChartFormats;
public class ParserUtilities
{
internal static NoteData.BeatType GetBeatType(int grid)
{
if (grid % 96 == 0)
{
return NoteData.BeatType.BeatType04;
}
if (grid % 48 == 0)
{
return NoteData.BeatType.BeatType08;
}
if (grid % 24 == 0)
{
return NoteData.BeatType.BeatType16;
}
if (grid % 16 == 0)
{
return NoteData.BeatType.BeatType24;
}
return NoteData.BeatType.BeatTypeOther;
}
internal static NotesTime NotesTimeFromBars(NotesReferences refs, float bars)
{
var bar = (int)bars;
var grid = (int)((bars - bar) * refs.Header._resolutionTime);
return new NotesTime(bar, grid, refs.Reader);
}
internal static NotesTime NotesTimeFromGrids(NotesReferences refs, int grids)
{
var nt = new NotesTime(grids);
nt.calcMsec(refs.Reader);
return nt;
}
}