收拾烂摊子

增加编队初步,改动了判定系统,编队UI组装好
This commit is contained in:
FloatGaming
2025-09-28 00:23:05 +08:00
parent 1d818fa4eb
commit 98510eef0f
53 changed files with 10492 additions and 60 deletions
@@ -1,11 +1,33 @@
using UnityEngine;
using TMPro;
using System;
public class InputManager : MonoBehaviour
{
public static InputManager Instance { get; private set; }
public static event Action<KeyCode> OnKeyPressed;
public static event Action<KeyCode> OnKeyReleased;
[Header("轨道判定显示TMP对象(请在Inspector中连接)")]
public TextMeshProUGUI[] trackJudgeTexts = new TextMeshProUGUI[5];
[Header("是否显示判定文字")]
public bool showJudgeText = true;
// 判定结果对应颜色
public Color perfectColor = Color.yellow;
public Color greatColor = Color.green;
public Color goodColor = Color.cyan;
public Color missColor = Color.red;
private void Awake()
{
if (Instance == null)
Instance = this;
else
Destroy(gameObject);
}
private void Update()
{
foreach (string color in new string[] { "red", "green", "yellow", "purple", "blue" })
@@ -23,4 +45,34 @@ public class InputManager : MonoBehaviour
OnKeyReleased?.Invoke(key);
}
}
/// <summary>
/// 更新指定轨道的判定文本和颜色
/// </summary>
public void ShowJudgeResult(int trackIndex, string result)
{
if (!showJudgeText) return;
if (trackJudgeTexts == null || trackIndex < 0 || trackIndex >= trackJudgeTexts.Length) return;
var textObj = trackJudgeTexts[trackIndex];
if (textObj == null) return;
textObj.text = result;
switch (result)
{
case "Perfect":
textObj.color = perfectColor;
break;
case "Great":
textObj.color = greatColor;
break;
case "Good":
textObj.color = goodColor;
break;
case "Miss":
textObj.color = missColor;
break;
default:
textObj.color = Color.white;
break;
}
}
}