feat: 场景优化 - 清理重复对象、设置Tags/Colliders、重建Canvas UI、连线Inspector引用

- 删除顶层重复的 GameManager/ExperimentController/InteractionSystem/AnimationController
- 移除Canvas上的旧 HUDController(保留 UIManager)
- 为14个交互定位点设置Tag并添加SphereCollider
- 创建12个自定义Tag(InjuryVisual/Swelling/Pain/VitalSigns/Neuro/BandagePos1-3/Ankle/PaddingPos/SplintLeft/SplintRight)
- 完全重建Canvas UI子对象结构以匹配 UIManager 脚本
- 连线 ExperimentFlowCoordinator 和 UIManager 的所有 serialized fields
- 编译零错误,游戏画面正常显示
This commit is contained in:
yangbear
2026-06-24 02:44:58 +08:00
parent f0a6b96da5
commit bf926165c0
5 changed files with 7161 additions and 735 deletions
+10 -14
View File
@@ -1,6 +1,5 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
/// <summary>
/// 实验结束后的结果展示面板。
@@ -14,14 +13,14 @@ public class ScoreDisplay : MonoBehaviour
[Header("考核模式")]
[SerializeField] private GameObject _examResultRoot;
[SerializeField] private TMP_Text _scoreTitle;
[SerializeField] private TMP_Text _scoreValue;
[SerializeField] private Text _scoreTitle;
[SerializeField] private Text _scoreValue;
[SerializeField] private Transform _analysisListParent;
[SerializeField] private GameObject _analysisItemPrefab;
[Header("学习模式 - 注意事项")]
[SerializeField] private GameObject _notesRoot;
[SerializeField] private TMP_Text _notesText;
[SerializeField] private Text _notesText;
[Header("底部按钮")]
[SerializeField] private Button _confirmButton;
@@ -35,11 +34,10 @@ public class ScoreDisplay : MonoBehaviour
private void Awake()
{
_confirmButton?.onClick.AddListener(OnConfirm);
if (_confirmButton) _confirmButton.onClick.AddListener(OnConfirm);
if (_panelRoot != null) _panelRoot.SetActive(false);
}
/// <summary>考核模式 - 显示加权成绩</summary>
public void ShowExamScore()
{
if (_panelRoot != null) _panelRoot.SetActive(true);
@@ -52,12 +50,11 @@ public class ScoreDisplay : MonoBehaviour
int score = gm.GetExamScoreRounded();
float pct = gm.GetExamPercentage();
if (_scoreTitle != null) _scoreTitle.text = "成绩显示栏";
if (_scoreValue != null) _scoreValue.text = $"考试成绩:{score} 分({pct:F0}%";
if (_scoreValue != null) _scoreValue.text = "考试成绩:" + score + " 分(" + pct.ToString("F0") + "%";
BuildAnalysisList();
}
/// <summary>学习模式 - 显示注意事项</summary>
public void ShowNotesOnly()
{
if (_panelRoot != null) _panelRoot.SetActive(true);
@@ -80,7 +77,7 @@ public class ScoreDisplay : MonoBehaviour
for (int i = 0; i < gm.StepScores.Length; i++)
{
var item = Instantiate(_analysisItemPrefab, _analysisListParent);
var text = item.GetComponentInChildren<TMP_Text>();
var text = item.GetComponentInChildren<Text>();
if (text == null) continue;
float earned = gm.StepScores[i];
@@ -91,19 +88,18 @@ public class ScoreDisplay : MonoBehaviour
string status;
if (fullScore) status = "<color=#00FF00>正确</color>";
else if (zeroScore) status = "<color=#FF0000>错误</color>";
else status = $"<color=#FFAA00>部分正确</color>";
else status = "<color=#FFAA00>部分正确</color>";
string scorePart = $"{earned:F0}/{max:F0} 分)";
string scorePart = "" + earned.ToString("F0") + "/" + max.ToString("F0") + " 分)";
string fbPart = (!fullScore && !string.IsNullOrEmpty(gm.StepFeedback[i]))
? $"{gm.StepFeedback[i]}" : "";
? "" + gm.StepFeedback[i] : "";
text.text = $"第{i + 1}题:{status} {scorePart}{fbPart}";
text.text = "第" + (i + 1) + "题:" + status + " " + scorePart + fbPart;
}
}
private void OnConfirm()
{
if (_panelRoot != null) _panelRoot.SetActive(false);
UnityEngine.SceneManagement.SceneManager.LoadScene("MainMenu");
}
}