成就系统 巨大修改 新的ui 黑白效果 等一堆
This commit is contained in:
@@ -134,11 +134,7 @@ public class Note : BaseNote
|
||||
if (Mathf.Abs(pressTime - hitTime) > maxWindow)
|
||||
{
|
||||
// outside allowed window and not in judge zone -> release lock and ignore the press
|
||||
if (hasLock)
|
||||
{
|
||||
TrackKeyManager.Instance?.UnlockTrackForJudge(TrackIndex, myId);
|
||||
hasLock = false;
|
||||
}
|
||||
ReleaseTrackLock(myId);
|
||||
if (GameConfig.verboseLogs) Debug.Log($"[Note] {noteColor} press rejected: outside timing window and not in judge zone");
|
||||
return;
|
||||
}
|
||||
@@ -157,26 +153,32 @@ public class Note : BaseNote
|
||||
if (GameConfig.verboseLogs) Debug.Log($"{keyToPress}: Perfect");
|
||||
judgeResult = "Perfect";
|
||||
ScoreManager.Instance.countPerfect += 1;
|
||||
if (TrackIndex >= 0 && TrackIndex < 5) ScoreManager.Instance.trackPerfectCounts[TrackIndex]++;
|
||||
if (noteData != null) noteData.judgeOffsetMs = rawOffsetMs;
|
||||
ScoreManager.Instance.RecordOffset(rawOffsetMs);
|
||||
}
|
||||
else if (timeDifference <= judgeConfig.greatRange)
|
||||
{
|
||||
if (GameConfig.verboseLogs) Debug.Log($"{keyToPress}: Great");
|
||||
judgeResult = "Great";
|
||||
ScoreManager.Instance.countGreat += 1;
|
||||
if (TrackIndex >= 0 && TrackIndex < 5) ScoreManager.Instance.trackGreatCounts[TrackIndex]++;
|
||||
if (noteData != null) noteData.judgeOffsetMs = rawOffsetMs;
|
||||
ScoreManager.Instance.RecordOffset(rawOffsetMs);
|
||||
}
|
||||
else if (timeDifference <= judgeConfig.goodRange)
|
||||
{
|
||||
if (GameConfig.verboseLogs) Debug.Log($"{keyToPress}: Good");
|
||||
judgeResult = "Good";
|
||||
ScoreManager.Instance.countGood += 1;
|
||||
if (TrackIndex >= 0 && TrackIndex < 5) ScoreManager.Instance.trackGoodCounts[TrackIndex]++;
|
||||
if (noteData != null) noteData.judgeOffsetMs = rawOffsetMs;
|
||||
ScoreManager.Instance.RecordOffset(rawOffsetMs);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameConfig.verboseLogs) Debug.Log($"{keyToPress}: Miss (timeout)");
|
||||
judgeResult = "Miss";
|
||||
JudgeMiss();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -186,16 +188,21 @@ public class Note : BaseNote
|
||||
{
|
||||
if (GameConfig.verboseLogs) Debug.Log($"{keyToPress}: Perfect");
|
||||
judgeResult = "Perfect";
|
||||
ScoreManager.Instance.countPerfect += 1;
|
||||
// Add missing offset record for fallback path too if possible
|
||||
ScoreManager.Instance.RecordOffset(0);
|
||||
}
|
||||
else if (timeDifference <= 0.15f)
|
||||
{
|
||||
if (GameConfig.verboseLogs) Debug.Log($"{keyToPress}: Great");
|
||||
judgeResult = "Great";
|
||||
ScoreManager.Instance.countGreat += 1;
|
||||
ScoreManager.Instance.RecordOffset(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameConfig.verboseLogs) Debug.Log($"{keyToPress}: Miss (timeout)");
|
||||
judgeResult = "Miss";
|
||||
JudgeMiss();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,6 +282,11 @@ public class Note : BaseNote
|
||||
|
||||
isJudged = true;
|
||||
ScoreManager.Instance.countMiss += 1;
|
||||
if (TrackIndex >= 0 && TrackIndex < 5) ScoreManager.Instance.trackMissCounts[TrackIndex]++;
|
||||
|
||||
// Record a 0 offset for Miss to ensure total Offset Count matches note count
|
||||
ScoreManager.Instance?.RecordOffset(0);
|
||||
|
||||
if (GameConfig.verboseLogs) Debug.Log($"{keyToPress} Miss");
|
||||
|
||||
InputManager.Instance?.ShowJudgeResult(TrackIndex, "Miss");
|
||||
@@ -305,35 +317,36 @@ public class Note : BaseNote
|
||||
// notify global judge manager that this note has been finally judged (miss)
|
||||
JudgeManager.Instance?.NotifyNoteJudged();
|
||||
|
||||
// Remove from per-track queue and release lock immediately so next note can be judged
|
||||
string myId = gameObject.GetInstanceID().ToString();
|
||||
TrackKeyManager.Instance?.UnregisterKey(TrackIndex, myId);
|
||||
ReturnToPool();
|
||||
}
|
||||
|
||||
private void ReleaseTrackLock(string myId)
|
||||
{
|
||||
if (hasLock)
|
||||
{
|
||||
TrackKeyManager.Instance?.UnlockTrackForJudge(TrackIndex, myId);
|
||||
hasLock = false;
|
||||
}
|
||||
|
||||
ReturnToPool();
|
||||
}
|
||||
|
||||
private void ReturnToPool()
|
||||
{
|
||||
InputManager.OnKeyPressed -= HandlePress;
|
||||
|
||||
// CRITICAL: Always release lock and unregister before deactivating
|
||||
string myId = gameObject.GetInstanceID().ToString();
|
||||
|
||||
// Release lock if we still hold it
|
||||
if (hasLock)
|
||||
{
|
||||
TrackKeyManager.Instance?.UnlockTrackForJudge(TrackIndex, gameObject.GetInstanceID().ToString());
|
||||
hasLock = false;
|
||||
}
|
||||
ReleaseTrackLock(myId);
|
||||
|
||||
// Remove from per-track queue to avoid stale entries
|
||||
TrackKeyManager.Instance?.UnregisterKey(TrackIndex, myId);
|
||||
|
||||
if (controller != null)
|
||||
{
|
||||
controller.ResetState();
|
||||
}
|
||||
|
||||
// Ensure we are removed from per-track queue to avoid stale entries
|
||||
TrackKeyManager.Instance?.UnregisterKey(TrackIndex, gameObject.GetInstanceID().ToString());
|
||||
|
||||
gameObject.SetActive(false);
|
||||
NotePool.Instance.ReturnNote(gameObject, noteColor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user