From 34287ca203077635580912ca21e5652119ac5cd8 Mon Sep 17 00:00:00 2001 From: yangbear Date: Wed, 1 Jul 2026 20:19:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9F=B3=E9=A2=91=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B8=85=E7=90=86=20-=20=E4=BF=AE=E5=A4=8DTo?= =?UTF-8?q?uchPositionHandler=E5=A4=9A=E4=BD=99}=20+=20=E6=B8=85=E7=90=86?= =?UTF-8?q?=E6=AD=BB=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TouchPositionHandler: 修复sed残留多余},改用PlayClipAtPoint - PageController: StopBgMusic/HideAllPages分行,删除未调用的PlayWomanAudioSequence --- .../Interaction/TouchPositionHandler.cs | 2 +- Assets/Scripts/UI/PageController.cs | 26 ++----------------- Packages/packages-lock.json | 2 +- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/Assets/Scripts/Interaction/TouchPositionHandler.cs b/Assets/Scripts/Interaction/TouchPositionHandler.cs index d238454..18f2899 100644 --- a/Assets/Scripts/Interaction/TouchPositionHandler.cs +++ b/Assets/Scripts/Interaction/TouchPositionHandler.cs @@ -38,7 +38,7 @@ public class TouchPositionHandler : MonoBehaviour womanObject.transform.position = targetPosition.position; womanObject.transform.rotation = targetPosition.rotation; Debug.Log($"[TouchPosition] woman 移动到 {targetPosition.name}"); - if (voiceClip != null) { var asrc = gameObject.AddComponent(); asrc.PlayOneShot(voiceClip); Debug.Log("[TouchPosition] 播放语音: " + voiceClip.name); } } + if (voiceClip != null) { AudioSource.PlayClipAtPoint(voiceClip, transform.position); Debug.Log("[TouchPosition] 播放语音: " + voiceClip.name); // 通知 StepManager 记录步骤 int stepIndex = transform.GetSiblingIndex() + 1; diff --git a/Assets/Scripts/UI/PageController.cs b/Assets/Scripts/UI/PageController.cs index dfa7ba4..b5358de 100644 --- a/Assets/Scripts/UI/PageController.cs +++ b/Assets/Scripts/UI/PageController.cs @@ -191,8 +191,6 @@ public class PageController : MonoBehaviour var dialogue = GameObject.Find("DialogueBubble"); if (dialogue != null) dialogue.SetActive(false); } - - #endregion #region 按钮回调 @@ -259,7 +257,8 @@ public class PageController : MonoBehaviour Debug.Log($"PageController: GameManager 已设置 Mode=[{gm.CurrentMode}] Fixation=[{gm.CurrentFixationMethod}]"); // 隐藏所有UI面板,准备播放片头动画 - StopBgMusic(); HideAllPages(); + StopBgMusic(); + HideAllPages(); // 找到 OpeningFlowController 播放片头动画 var openingFlow = FindObjectOfType(); @@ -318,23 +317,6 @@ public class PageController : MonoBehaviour if (dialogue != null) dialogue.SetActive(true); } - private System.Collections.IEnumerator PlayWomanAudioSequence() - { - if (_womanClips == null || _womanClips.Length == 0) yield break; - var voiceSource = gameObject.AddComponent(); - voiceSource.loop = false; - voiceSource.playOnAwake = false; - foreach (var clip in _womanClips) - { - if (clip == null) continue; - voiceSource.clip = clip; - voiceSource.Play(); - Debug.Log($"PageController: 播放woman语音: {clip.name}"); - yield return new WaitForSeconds(clip.length + 0.5f); - } - } - - public void ReturnToHome() { Debug.Log("PageController: [ReturnToHome] 返回首页并重置场景"); @@ -364,13 +346,9 @@ public class PageController : MonoBehaviour } #endregion - - [Header("=== 音频 ===")] [SerializeField] private AudioClip _homeBgClip; [SerializeField] private AudioClip _experimentBgClip; [SerializeField] private AudioClip[] _womanClips; private AudioSource _bgAudioSource; - - } diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index f2235c1..5cbd133 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -15,7 +15,7 @@ "com.unity.nuget.newtonsoft-json": "3.0.2", "com.unity.test-framework": "1.1.31" }, - "hash": "85c101f5329ec1b0c6f70cba44614166dd78f53c" + "hash": "11836003a5e2ffcb7715ecec7e1fbb9d9cdb5bb8" }, "com.unity.burst": { "version": "1.8.21",