repaired the motherfucking hold note problem which troubled us longer than 2 months

added some UI
This commit is contained in:
2025-08-02 00:28:35 +08:00
parent 373f0511e3
commit 774d3aeb7f
160 changed files with 5472 additions and 841 deletions
@@ -6,15 +6,8 @@ public class InputManager : MonoBehaviour
public static event Action<KeyCode> OnKeyPressed;
public static event Action<KeyCode> OnKeyReleased;
// 存储当前帧所有按下的按键
private KeyCode[] pressedKeysThisFrame = new KeyCode[5];
private int pressedKeyCount = 0;
private void Update()
{
pressedKeyCount = 0;
// 检查所有可能的按键
foreach (string color in new string[] { "red", "green", "yellow", "purple", "blue" })
{
KeyCode key = KeyBindingManager.GetKeyForColor(color);
@@ -22,31 +15,12 @@ public class InputManager : MonoBehaviour
if (Input.GetKeyDown(key))
{
// 记录当前帧按下的所有按键
pressedKeysThisFrame[pressedKeyCount++] = key;
OnKeyPressed?.Invoke(key);
// 调用 JudgeManager 统一判断最早的音符
JudgeManager.Instance.JudgeEarliestNote(key);
}
if (Input.GetKeyUp(key))
{
OnKeyReleased?.Invoke(key);
}
}
// 处理多键同时按下
if (pressedKeyCount > 1)
{
HandleMultiKeyPress();
}
}
private void HandleMultiKeyPress()
{
// 对当前帧所有按下的按键进行处理
for (int i = 0; i < pressedKeyCount; i++)
{
KeyCode key = pressedKeysThisFrame[i];
// 调用 JudgeManager 统一判断对应按键的音符
JudgeManager.Instance.JudgeEarliestNote(key);
}
}
}
}