using System.Collections.Generic; using UnityEngine; public static class HoldNoteJudgePool { public class HoldInfo { public string noteID; public float pressTime; // real-time when player pressed start public float hitTime; // scheduled hit time (real-time) public float scheduledEnd; // scheduled end time (real-time) public float length; // scheduledEnd - hitTime public string color; public int trackIndex; public object noteData; // store as object to avoid type dependency } private static Dictionary pool = new Dictionary(); public static void RegisterStart(string noteID, float pressTime, float hitTime, float scheduledEnd, string color, int trackIndex, object noteData) { if (string.IsNullOrEmpty(noteID)) return; HoldInfo info = new HoldInfo { noteID = noteID, pressTime = pressTime, hitTime = hitTime, scheduledEnd = scheduledEnd, length = Mathf.Max(0.0001f, scheduledEnd - hitTime), color = color, trackIndex = trackIndex, noteData = noteData }; pool[noteID] = info; if (JudgeManager.IsDebugEnabled) Debug.Log($"[HoldNoteJudgePool] Registered start for {noteID} press={pressTime:F3} hit={hitTime:F3} end={scheduledEnd:F3}"); } public static bool TryGet(string noteID, out HoldInfo info) { if (string.IsNullOrEmpty(noteID)) { info = null; return false; } return pool.TryGetValue(noteID, out info); } public static void Unregister(string noteID) { if (string.IsNullOrEmpty(noteID)) return; pool.Remove(noteID); } public static void ClearAll() { pool.Clear(); } }