修复一堆bug 加入粒子系统代替原击打特效 焕新长音符逻辑 修复多重计分 更新判定管理和音符生成器 搞了一个免费包

This commit is contained in:
2025-12-18 03:26:52 +08:00
parent 1dd6c95ec9
commit a7d8d71d10
1572 changed files with 1658779 additions and 527 deletions
+26 -9
View File
@@ -8,6 +8,8 @@ public class Note : BaseNote
private NoteController controller;
private bool isJudged = false;
private NoteData noteData;
[Header("判定区间配置")]
public NoteJudgeConfig judgeConfig; // 判定区间配置,需在预制体或生成时赋值
@@ -17,7 +19,7 @@ public class Note : BaseNote
controller = GetComponent<NoteController>();
}
public void Setup(KeyCode key, int trackIndex, float speed, float hitTime, string color, NoteJudgeConfig judgeConfig)
public void Setup(KeyCode key, int trackIndex, float speed, float hitTime, string color, NoteJudgeConfig judgeConfig, NoteData data)
{
keyToPress = key;
noteColor = color;
@@ -26,6 +28,7 @@ public class Note : BaseNote
this.hitTime = hitTime;
isJudged = false;
this.judgeConfig = judgeConfig;
this.noteData = data;
if (controller != null)
{
@@ -53,6 +56,8 @@ public class Note : BaseNote
return;
float timeDifference = Mathf.Abs(Time.time - hitTime);
// 计算正负偏差:正值提前,负值落后
float rawOffsetMs = (hitTime - Time.time) * 1000f;
string judgeResult = null;
if (judgeConfig != null)
@@ -61,22 +66,29 @@ public class Note : BaseNote
{
Debug.Log($"{keyToPress}: Perfect");
judgeResult = "Perfect";
ScoreManager.Instance.countPerfect += 1;
if (noteData != null) noteData.judgeOffsetMs = rawOffsetMs;
}
else if (timeDifference <= judgeConfig.greatRange)
{
Debug.Log($"{keyToPress}: Great");
judgeResult = "Great";
ScoreManager.Instance.countGreat += 1;
if (noteData != null) noteData.judgeOffsetMs = rawOffsetMs;
}
else if (timeDifference <= judgeConfig.goodRange)
{
Debug.Log($"{keyToPress}: Good");
judgeResult = "Good";
ScoreManager.Instance.countGood += 1;
if (noteData != null) noteData.judgeOffsetMs = rawOffsetMs;
}
else if (timeDifference <= judgeConfig.missRange)
{
Debug.Log($"{keyToPress}: Miss");
judgeResult = "Miss";
// Do not return here - let shared post-judge logic run so NotifyNoteHit is invoked for Miss as well
/*ScoreManager.Instance.countMiss += 1;
if (noteData != null) noteData.judgeOffsetMs = rawOffsetMs;*/
}
else
{
@@ -112,6 +124,7 @@ public class Note : BaseNote
InputManager.Instance?.ShowJudgeResult(TrackIndex, judgeResult);
JudgeSoundManager.Instance?.PlayJudgeSound(judgeResult);
teamUIController.Instance?.OnJudgeResult(judgeResult); // 更新combo计数
Animation_GenerateJudgementSituationPrefab.Instance?.SpawnJudgePrefab(noteColor, judgeResult);
// Calculate score addition via AllyCombatant and add to per-track pm sums
try
@@ -123,7 +136,8 @@ public class Note : BaseNote
if (ally != null)
{
int added = ally.AddScoreForJudge(judgeResult);
ScoreManager.Instance?.AddPmScoreForTrack(TrackIndex, added);
float efficiency = ally.scoreEfficiency;
ScoreManager.Instance?.AddPmScoreForTrack(TrackIndex, added, efficiency);
}
}
}
@@ -145,32 +159,34 @@ public class Note : BaseNote
public void Judge()
{
if (isJudged)
if (isJudged)
return;
isJudged = true;
if (controller != null)
{
controller.StopMovement();
controller.PlayHitEffect();
controller.PlayHitEffect();
}
ReturnToPool();
if (anim !=null)
if (anim != null)
{
anim.PlayDestroyAnimation(noteColor);
}
}
public void JudgeMiss()
{
if (isJudged) return;
isJudged = true;
ScoreManager.Instance.countMiss += 1;
Debug.Log($"{keyToPress} Miss");
// Ensure UI shows Miss and combo is updated when a note auto-misses
InputManager.Instance?.ShowJudgeResult(TrackIndex, "Miss");
JudgeSoundManager.Instance?.PlayJudgeSound("Miss");
teamUIController.Instance?.OnJudgeResult("Miss");
Animation_GenerateJudgementSituationPrefab.Instance?.SpawnJudgePrefab(noteColor, "Miss");
// Add score for Miss as well (some systems may give 0)
try
@@ -182,7 +198,8 @@ public class Note : BaseNote
if (ally != null)
{
int added = ally.AddScoreForJudge("Miss");
ScoreManager.Instance?.AddPmScoreForTrack(TrackIndex, added);
float efficiency = ally.scoreEfficiency;
ScoreManager.Instance?.AddPmScoreForTrack(TrackIndex, added, efficiency);
}
}
}
@@ -233,4 +250,4 @@ public class Note : BaseNote
JudgeMiss();
}
}
}
}