长音符再修复 加入了关卡连接 优化了一些默认加载
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
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 readonly Dictionary<string, HoldInfo> pool = new Dictionary<string, HoldInfo>();
|
||||
|
||||
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;
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user