2修
This commit is contained in:
@@ -44,6 +44,7 @@ public class InputManager : MonoBehaviour
|
||||
public Color missColor = Color.red;
|
||||
|
||||
private KeyCode[] cachedKeys = new KeyCode[5];
|
||||
private KeyCode cachedSecondaryTrack3Key = KeyCode.V;
|
||||
private bool pauseBlockedLastFrame = false;
|
||||
|
||||
// Per-track held count. Written by both keyboard (Update) and touch (PressTrack/
|
||||
@@ -89,6 +90,7 @@ public class InputManager : MonoBehaviour
|
||||
{
|
||||
cachedKeys[i] = KeyBindingManager.GetKeyForColor(TrackColors[i]);
|
||||
}
|
||||
cachedSecondaryTrack3Key = KeyBindingManager.GetSecondaryKeyForTrack3();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
@@ -137,6 +139,14 @@ public class InputManager : MonoBehaviour
|
||||
if (Input.GetKeyUp(key))
|
||||
ReleaseTrack(i);
|
||||
}
|
||||
|
||||
if (cachedSecondaryTrack3Key != KeyCode.None)
|
||||
{
|
||||
if (Input.GetKeyDown(cachedSecondaryTrack3Key))
|
||||
PressTrack(2, cachedSecondaryTrack3Key);
|
||||
if (Input.GetKeyUp(cachedSecondaryTrack3Key))
|
||||
ReleaseTrack(2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -146,6 +156,12 @@ public class InputManager : MonoBehaviour
|
||||
/// Always fires OnKeyPressed to allow rapid same-track taps even when held.
|
||||
/// </summary>
|
||||
public void PressTrack(int index)
|
||||
{
|
||||
KeyCode sourceKey = index >= 0 && index < cachedKeys.Length ? cachedKeys[index] : KeyCode.None;
|
||||
PressTrack(index, sourceKey);
|
||||
}
|
||||
|
||||
public void PressTrack(int index, KeyCode sourceKey)
|
||||
{
|
||||
if (index < 0 || index >= TrackColors.Length) return;
|
||||
bool wasHeld = trackHeldCount[index] > 0;
|
||||
@@ -156,6 +172,17 @@ public class InputManager : MonoBehaviour
|
||||
if (key != KeyCode.None)
|
||||
OnKeyPressed?.Invoke(key);
|
||||
|
||||
if (trackKeyTexts != null && index < trackKeyTexts.Length)
|
||||
{
|
||||
var txt = trackKeyTexts[index];
|
||||
if (txt != null)
|
||||
{
|
||||
if (sourceKey != KeyCode.None)
|
||||
txt.text = KeyBindingManager.GetDisplayName(sourceKey);
|
||||
txt.color = keyActiveColor;
|
||||
}
|
||||
}
|
||||
|
||||
// Only update visuals on the first press (0→1 transition)
|
||||
if (wasHeld) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user