修复短音符延迟
This commit is contained in:
@@ -321,11 +321,24 @@ public class HoldNote : BaseNote
|
||||
if (GameConfig.verboseLogs) Debug.Log($"[HoldNote] KeyDown detected for {noteID} key={keyToPress} time={Time.time:F3} hitTime={hitTime:F3} hasEnteredLine={hasEnteredLine}");
|
||||
float pressTimeLocal = Time.time;
|
||||
float maxWindow = (judgeConfig?.missRange ?? 0.5f) * holdWindowMultiplier;
|
||||
|
||||
// prevent multiple notes on same track being judged by a single press
|
||||
if (TrackKeyManager.Instance != null && !TrackKeyManager.Instance.TryLockTrackForJudge(trackIndex, noteID))
|
||||
return;
|
||||
|
||||
if (Mathf.Abs(pressTimeLocal - hitTime) <= maxWindow)
|
||||
{
|
||||
HandleStart(false);
|
||||
// do not mark isJudged here; Start remains active for hold
|
||||
}
|
||||
else
|
||||
{
|
||||
// Press is outside window, release the lock
|
||||
if (TrackKeyManager.Instance != null)
|
||||
{
|
||||
TrackKeyManager.Instance.UnlockTrackForJudge(trackIndex, noteID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (segment == NoteSegment.Start && hasEnteredLine)
|
||||
@@ -360,6 +373,10 @@ public class HoldNote : BaseNote
|
||||
{
|
||||
if (Input.GetKeyUp(keyToPress))
|
||||
{
|
||||
// protect end handling with track lock so a single release doesn't trigger multiple ends
|
||||
if (TrackKeyManager.Instance != null && !TrackKeyManager.Instance.TryLockTrackForJudge(trackIndex, noteID))
|
||||
return;
|
||||
|
||||
HandleEnd();
|
||||
isJudged = true;
|
||||
}
|
||||
@@ -806,6 +823,8 @@ public class HoldNote : BaseNote
|
||||
AnimationController.Global?.StopHoldParticles();
|
||||
|
||||
isJudged = true;
|
||||
// notify global judge manager that one final note (hold end) has been judged
|
||||
JudgeManager.Instance?.NotifyNoteJudged();
|
||||
ScheduleReturnToPool(0.2f);
|
||||
}
|
||||
|
||||
@@ -846,6 +865,13 @@ public class HoldNote : BaseNote
|
||||
}
|
||||
|
||||
if (GameConfig.verboseLogs) Debug.Log($"[HoldNote] ReturnToPool called for {noteID} segment={segment} time={Time.time:F3}");
|
||||
|
||||
// Release lock if still held
|
||||
if (TrackKeyManager.Instance != null)
|
||||
{
|
||||
TrackKeyManager.Instance.UnlockTrackForJudge(trackIndex, noteID);
|
||||
}
|
||||
|
||||
gameObject.SetActive(false);
|
||||
|
||||
if (segment == NoteSegment.Start)
|
||||
|
||||
Reference in New Issue
Block a user