Improve exam flow and WebGL build
This commit is contained in:
@@ -2,6 +2,8 @@ using UnityEngine;
|
||||
|
||||
public class PingClickHandler : MonoBehaviour
|
||||
{
|
||||
private const float ScreenHitRadius = 160f;
|
||||
|
||||
public GameObject chanraoObject, nextPing;
|
||||
public int pingIndex;
|
||||
private MeshRenderer _modelRenderer, _outlineMesh;
|
||||
@@ -129,7 +131,7 @@ public class PingClickHandler : MonoBehaviour
|
||||
if (otherDist < myDist) return;
|
||||
}
|
||||
|
||||
if (myDist < 120f)
|
||||
if (myDist < ScreenHitRadius)
|
||||
{
|
||||
Debug.Log($"[PingClick] 屏幕坐标命中: {name} (距离={myDist:F1}px)");
|
||||
_lastClickedFrame = Time.frameCount;
|
||||
@@ -140,6 +142,8 @@ public class PingClickHandler : MonoBehaviour
|
||||
|
||||
public void PerformClick()
|
||||
{
|
||||
InteractionClickGuard.MarkHandled();
|
||||
|
||||
if (!_modelShown)
|
||||
{
|
||||
_modelShown = true;
|
||||
@@ -152,27 +156,47 @@ public class PingClickHandler : MonoBehaviour
|
||||
if (nextPing != null) nextPing.SetActive(true);
|
||||
else
|
||||
{
|
||||
var chanraotuibu = GameObject.Find("chanraotuibu");
|
||||
if (chanraotuibu == null)
|
||||
bool handledBySplintPractice = false;
|
||||
var splintFlow = FindObjectOfType<SplintPracticeFlowManager>();
|
||||
if (splintFlow != null)
|
||||
{
|
||||
var mi = GameObject.Find("manInjury");
|
||||
if (mi != null)
|
||||
{
|
||||
var t = mi.transform.Find("chanraotuibu");
|
||||
if (t != null) chanraotuibu = t.gameObject;
|
||||
}
|
||||
handledBySplintPractice = splintFlow.OnPingFirstClick(this);
|
||||
}
|
||||
|
||||
bool isSplintFixation = GameManager.Instance != null &&
|
||||
GameManager.Instance.CurrentFixationMethod == FixationMethod.SplintFixation;
|
||||
|
||||
if (!handledBySplintPractice && !isSplintFixation)
|
||||
{
|
||||
var chanraotuibu = GameObject.Find("chanraotuibu");
|
||||
if (chanraotuibu == null)
|
||||
{
|
||||
var mi = GameObject.Find("manInjury");
|
||||
if (mi != null)
|
||||
{
|
||||
var t = mi.transform.Find("chanraotuibu");
|
||||
if (t != null) chanraotuibu = t.gameObject;
|
||||
}
|
||||
}
|
||||
if (chanraotuibu != null) chanraotuibu.SetActive(true);
|
||||
Debug.Log($"[PingClick] {name} 是最后一个 ping 模型,现已激活 chanraotuibu");
|
||||
}
|
||||
if (chanraotuibu != null) chanraotuibu.SetActive(true);
|
||||
Debug.Log($"[PingClick] {name} 是最后一个 ping 模型,现已激活 chanraotuibu");
|
||||
}
|
||||
|
||||
if (nextPing != null) Debug.Log($"[PingClick] {name} 模型显示, 激活 {nextPing.name}");
|
||||
else Debug.Log($"[PingClick] {name} 模型显示, 激活下一个");
|
||||
|
||||
ShowLimbFirstStageTip(nextPing != null);
|
||||
|
||||
var sm = FindObjectOfType<StepManager>();
|
||||
if (sm != null) sm.RecordPingStep(pingIndex, false);
|
||||
var examMgr = FindObjectOfType<ExamFlowManager>();
|
||||
if (examMgr != null) examMgr.OnObjectClicked(this);
|
||||
if (nextPing != null)
|
||||
{
|
||||
var splintFlow = FindObjectOfType<SplintPracticeFlowManager>();
|
||||
if (splintFlow != null) splintFlow.OnPingFirstClick(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -183,6 +207,9 @@ public class PingClickHandler : MonoBehaviour
|
||||
if (examMgr != null) examMgr.OnObjectClicked(this);
|
||||
var sm = FindObjectOfType<StepManager>();
|
||||
if (sm != null) sm.RecordPingStep(pingIndex, true);
|
||||
var splintFlow = FindObjectOfType<SplintPracticeFlowManager>();
|
||||
bool handledBySplintPractice = splintFlow != null && splintFlow.OnPingSecondClick(this);
|
||||
if (handledBySplintPractice) return;
|
||||
|
||||
var pings = Object.FindObjectsOfType<PingClickHandler>();
|
||||
int remaining = 0;
|
||||
@@ -195,6 +222,7 @@ public class PingClickHandler : MonoBehaviour
|
||||
bool isExam = GameManager.Instance != null && GameManager.Instance.CurrentMode == ExperimentMode.Exam;
|
||||
if (remaining == 0)
|
||||
{
|
||||
ShowLimbSecondStageTip(true);
|
||||
if (!_hasPlayedFinishVoice)
|
||||
{
|
||||
_hasPlayedFinishVoice = true;
|
||||
@@ -213,14 +241,58 @@ public class PingClickHandler : MonoBehaviour
|
||||
var uiMgr = FindObjectOfType<UIManager>();
|
||||
if (uiMgr != null)
|
||||
{
|
||||
uiMgr.HideVideo();
|
||||
uiMgr.ShowEndPanel();
|
||||
uiMgr.StartCoroutine(ShowEndPanelDelayed(uiMgr));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowLimbSecondStageTip(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowLimbFirstStageTip(bool hasNextPing)
|
||||
{
|
||||
if (GameManager.Instance == null ||
|
||||
GameManager.Instance.CurrentFixationMethod != FixationMethod.LimbFixation)
|
||||
return;
|
||||
|
||||
UIManager uiManager = FindObjectOfType<UIManager>();
|
||||
if (uiManager == null) return;
|
||||
|
||||
if (hasNextPing)
|
||||
{
|
||||
uiManager.ShowTip("继续由远端向近端点击下一个蓝色绑带点,完成绑带摆放。");
|
||||
}
|
||||
else
|
||||
{
|
||||
uiManager.ShowTip("四条绑带已摆放。下一步:点击大腿环绕区域,显示环绕固定带。");
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowLimbSecondStageTip(bool complete)
|
||||
{
|
||||
if (GameManager.Instance == null ||
|
||||
GameManager.Instance.CurrentFixationMethod != FixationMethod.LimbFixation)
|
||||
return;
|
||||
|
||||
UIManager uiManager = FindObjectOfType<UIManager>();
|
||||
if (uiManager == null) return;
|
||||
|
||||
uiManager.ShowTip(complete
|
||||
? "肢体固定已完成,请观察固定效果并点击结束确认。"
|
||||
: "继续点击下一个蓝色绑带点,由远端向近端完成系带固定。");
|
||||
}
|
||||
|
||||
private System.Collections.IEnumerator ShowEndPanelDelayed(UIManager uiMgr)
|
||||
{
|
||||
yield return new WaitForSeconds(1f);
|
||||
if (uiMgr == null) yield break;
|
||||
uiMgr.HideVideo();
|
||||
uiMgr.ShowEndPanel();
|
||||
}
|
||||
|
||||
public void ReEnableBorder()
|
||||
{
|
||||
if (!_modelShown) return;
|
||||
|
||||
Reference in New Issue
Block a user