Stabilize limb fixation exam flow

This commit is contained in:
yangbear
2026-07-14 03:46:59 +08:00
parent 5ca24ec3b8
commit 9b4690d396
2 changed files with 62 additions and 18 deletions
+56 -12
View File
@@ -241,6 +241,7 @@ public class ExamFlowManager : MonoBehaviour
if (_gradeResult != null) _gradeResult.SetActive(true);
if (_gradeContent != null) _gradeContent.text = gradeContent;
if (_gradeScoreText != null) _gradeScoreText.text = totalScore.ToString();
RefreshGradeContentLayout();
}
private string BuildGradeContent(out int total)
@@ -294,24 +295,21 @@ public class ExamFlowManager : MonoBehaviour
private void ActivateFirstPing()
{
GameObject firstPing = FindSceneObject("ping.004");
if (firstPing == null)
{
PingClickHandler firstHandler = null;
foreach (var ping in Resources.FindObjectsOfTypeAll<PingClickHandler>())
{
if (ping != null && ping.gameObject.scene.IsValid() && ping.pingIndex == 0)
if (ping == null || !ping.gameObject.scene.IsValid()) continue;
if (ping.name == "ping.004" || ping.pingIndex == 0)
{
firstPing = ping.gameObject;
firstHandler = ping;
break;
}
}
}
if (firstPing != null)
if (firstHandler != null)
{
firstPing.SetActive(true);
var handler = firstPing.GetComponent<PingClickHandler>();
if (handler != null) handler.ResetState(true);
firstHandler.gameObject.SetActive(true);
firstHandler.ResetState(true);
}
}
@@ -390,6 +388,20 @@ public class ExamFlowManager : MonoBehaviour
text.verticalOverflow = VerticalWrapMode.Overflow;
}
RectTransform rect = content.GetComponent<RectTransform>();
if (rect != null)
{
rect.anchorMin = new Vector2(0f, 1f);
rect.anchorMax = new Vector2(1f, 1f);
rect.pivot = new Vector2(0f, 1f);
rect.anchoredPosition = Vector2.zero;
}
ContentSizeFitter fitter = content.GetComponent<ContentSizeFitter>();
if (fitter == null) fitter = content.gameObject.AddComponent<ContentSizeFitter>();
fitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained;
fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
return text;
}
@@ -439,6 +451,8 @@ public class ExamFlowManager : MonoBehaviour
if (yes != null)
{
yes.onClick.RemoveAllListeners();
yes.interactable = true;
yes.enabled = true;
yes.onClick.AddListener(() =>
{
_gradeResult.SetActive(false);
@@ -450,6 +464,8 @@ public class ExamFlowManager : MonoBehaviour
if (back != null)
{
back.onClick.RemoveAllListeners();
back.interactable = true;
back.enabled = true;
back.onClick.AddListener(() => _gradeResult.SetActive(false));
}
}
@@ -462,6 +478,8 @@ public class ExamFlowManager : MonoBehaviour
if (yes != null)
{
yes.onClick.RemoveAllListeners();
yes.interactable = true;
yes.enabled = true;
yes.onClick.AddListener(ReturnToHome);
}
}
@@ -580,8 +598,34 @@ public class ExamFlowManager : MonoBehaviour
Transform child = _dialogueBubble.GetChild(i);
if (!child.name.StartsWith("step")) continue;
Image image = child.GetComponent<Image>();
if (image != null) image.raycastTarget = false;
Graphic[] graphics = child.GetComponentsInChildren<Graphic>(true);
for (int j = 0; j < graphics.Length; j++)
{
Graphic graphic = graphics[j];
if (graphic == null) continue;
if (graphic.GetComponentInParent<Toggle>() != null) continue;
graphic.raycastTarget = false;
}
}
}
private void RefreshGradeContentLayout()
{
if (_gradeContent == null) return;
RectTransform textRect = _gradeContent.GetComponent<RectTransform>();
if (textRect != null)
{
float preferredHeight = _gradeContent.preferredHeight + 32f;
textRect.sizeDelta = new Vector2(textRect.sizeDelta.x, Mathf.Max(preferredHeight, 400f));
}
ScrollRect scrollRect = _gradeResult != null ? _gradeResult.GetComponentInChildren<ScrollRect>(true) : null;
if (scrollRect != null)
{
Canvas.ForceUpdateCanvases();
scrollRect.verticalNormalizedPosition = 1f;
LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content);
}
}
@@ -179,11 +179,11 @@ public class ShoseClickHandler : MonoBehaviour
{
anim.SetBool("isCrouch", false);
}
var point2 = GameObject.Find("womanPointArray/point2");
if (point2 != null)
var point1 = GameObject.Find("womanPointArray/point1");
if (point1 != null)
{
woman.transform.position = point2.transform.position;
woman.transform.rotation = point2.transform.rotation;
woman.transform.position = point1.transform.position;
woman.transform.rotation = point1.transform.rotation;
}
}