비트 찍기 완료 및 클로드를 통한 api작업

This commit is contained in:
jongjae0305
2026-05-20 16:44:28 +09:00
commit 2cd1be88d4
1596 changed files with 444234 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class BeatSageRoot
{
public string _version;
public List<BeatSageNote> _notes;
}
[Serializable]
public class BeatSageNote
{
public float _time;
public int _lineIndex;
public int _lineLayer;
public int _type;
public int _cutDirection;
}
public static class BeatSageConverter
{
public static List<NoteData> Convert(string rawJson, float bpm)
{
var result = new List<NoteData>();
BeatSageRoot sageData = JsonUtility.FromJson<BeatSageRoot>(rawJson);
if (sageData?._notes == null)
{
Debug.LogWarning("[BeatSageConverter] 파싱 실패 또는 노트 없음.");
return result;
}
foreach (var note in sageData._notes)
{
// 일반 노트(0: 빨강, 1: 파랑)만 처리, 폭탄(3) 등 제외
if (note._type != 0 && note._type != 1) continue;
result.Add(new NoteData
{
time = (note._time * 60f) / bpm,
position = note._lineIndex,
colorType = note._type
});
}
Debug.Log($"[BeatSageConverter] 변환 완료: {result.Count}개 노트");
return result;
}
public static string ToMapJson(List<NoteData> notes)
{
var mapData = new MapData { target = notes };
return JsonUtility.ToJson(mapData, true);
}
}