From f46e6939d6767baf062121ce454f685e802c9d52 Mon Sep 17 00:00:00 2001 From: Jiangqvweihuan <15987148+jiangqvweihuan@user.noreply.gitee.com> Date: Sun, 20 Jul 2025 03:03:45 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Assets/s?= =?UTF-8?q?cripts/gamePlay=5Fgameplay/JudgeManager.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/gamePlay_gameplay/JudgeManager.cs | 122 ------------------ 1 file changed, 122 deletions(-) delete mode 100644 Assets/scripts/gamePlay_gameplay/JudgeManager.cs diff --git a/Assets/scripts/gamePlay_gameplay/JudgeManager.cs b/Assets/scripts/gamePlay_gameplay/JudgeManager.cs deleted file mode 100644 index bfea7595..00000000 --- a/Assets/scripts/gamePlay_gameplay/JudgeManager.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -public class JudgeManager : MonoBehaviour -{ - public static JudgeManager Instance { get; private set; } - - private Dictionary> judgeQueues = new Dictionary>(); - private Dictionary startJudgedNotes = new Dictionary(); - private Dictionary releasedNotes = new Dictionary(); - // 记录 End 段的 scheduledEndTime(防止 End 被回收后仍然能判定) - private Dictionary noteEndTimes = new Dictionary(); - - - private void Awake() - { - if (Instance == null) - { - Instance = this; - } - else - { - Destroy(gameObject); - return; - } - } - - /// - /// 记录某个颜色的长音符 End 段的 scheduledEndTime - /// - public void RegisterScheduledEndTime(string noteColor, float endTime) - { - noteEndTimes[noteColor] = endTime; - } - - /// - /// 获取某个颜色的 End 段的 scheduledEndTime - /// - public float GetScheduledEndTime(string noteColor) - { - return noteEndTimes.ContainsKey(noteColor) ? noteEndTimes[noteColor] : 0f; - } - - public void RegisterStartJudged(string noteID, bool state) - { - startJudgedNotes[noteID] = state; - } - - public bool IsStartJudged(string noteID) - { - return startJudgedNotes.ContainsKey(noteID) && startJudgedNotes[noteID]; - } - - public void RegisterNoteReleased(string noteID, bool state) - { - releasedNotes[noteID] = state; - Debug.Log($"[JudgeManager] RegisterNoteReleased: {noteID} = {state}"); - } - - public bool HasNoteReleased(string noteID) - { - return releasedNotes.ContainsKey(noteID) && releasedNotes[noteID]; - } - - /// - /// 当音符进入判定区域时调用 - /// - public void RegisterNote(KeyCode key, Note note) - { - if (!judgeQueues.ContainsKey(key)) - judgeQueues[key] = new Queue(); - - if (!judgeQueues[key].Contains(note)) - { - judgeQueues[key].Enqueue(note); - } - } - - /// - /// 当音符离开判定区域时调用 - /// - public void UnregisterNote(KeyCode key, Note note) - { - if (!judgeQueues.ContainsKey(key)) return; - - Queue newQueue = new Queue(); - while (judgeQueues[key].Count > 0) - { - Note n = judgeQueues[key].Dequeue(); - if (n != note) - { - newQueue.Enqueue(n); - } - else - { - // **如果音符未被判定,则触发 Miss** - if (!n.IsJudged()) - { - n.JudgeMiss(); - } - } - } - judgeQueues[key] = newQueue; - } - - /// - /// 按键按下时,判定队列中最早进入的音符 - /// - public void JudgeEarliestNote(KeyCode key) - { - if (judgeQueues.ContainsKey(key) && judgeQueues[key].Count > 0) - { - Note note = judgeQueues[key].Dequeue(); // 只取最早的音符 - if (note != null && !note.IsJudged()) - { - note.Judge(); - } - } - } - - -} \ No newline at end of file