diff --git a/Assets/Scripts/Core/ExamFlowManager.cs b/Assets/Scripts/Core/ExamFlowManager.cs index a45bf2f..df81bc3 100644 --- a/Assets/Scripts/Core/ExamFlowManager.cs +++ b/Assets/Scripts/Core/ExamFlowManager.cs @@ -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()) { - foreach (var ping in Resources.FindObjectsOfTypeAll()) + if (ping == null || !ping.gameObject.scene.IsValid()) continue; + if (ping.name == "ping.004" || ping.pingIndex == 0) { - if (ping != null && ping.gameObject.scene.IsValid() && ping.pingIndex == 0) - { - firstPing = ping.gameObject; - break; - } + firstHandler = ping; + break; } } - if (firstPing != null) + if (firstHandler != null) { - firstPing.SetActive(true); - var handler = firstPing.GetComponent(); - 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(); + 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(); + if (fitter == null) fitter = content.gameObject.AddComponent(); + 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(); - if (image != null) image.raycastTarget = false; + Graphic[] graphics = child.GetComponentsInChildren(true); + for (int j = 0; j < graphics.Length; j++) + { + Graphic graphic = graphics[j]; + if (graphic == null) continue; + if (graphic.GetComponentInParent() != null) continue; + graphic.raycastTarget = false; + } + } + } + + private void RefreshGradeContentLayout() + { + if (_gradeContent == null) return; + + RectTransform textRect = _gradeContent.GetComponent(); + 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(true) : null; + if (scrollRect != null) + { + Canvas.ForceUpdateCanvases(); + scrollRect.verticalNormalizedPosition = 1f; + LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content); } } diff --git a/Assets/Scripts/Interaction/ShoseClickHandler.cs b/Assets/Scripts/Interaction/ShoseClickHandler.cs index 0b1df98..50fbac3 100644 --- a/Assets/Scripts/Interaction/ShoseClickHandler.cs +++ b/Assets/Scripts/Interaction/ShoseClickHandler.cs @@ -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; } }