From 9548492391b57b82012eacd10615abcd297753e5 Mon Sep 17 00:00:00 2001 From: yangbear Date: Tue, 30 Jun 2026 23:42:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=95=B4=E9=9F=B3=E9=A2=91?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=20-=20=E9=A6=96=E9=A1=B5/=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E9=9F=B3=E4=B9=90+woman=E8=AF=AD=E9=9F=B3?= =?UTF-8?q?=E5=BA=8F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PageController新增_homeBgClip/_experimentBgClip/_womanClips数组 - Start()创建AudioSource循环播放背景音乐 - ShowPage控制: Home播首页bg, 离开首页停止bg - ActivateExperimentObjects: 停止首页bg→播实验bg→顺序播放3段woman语音 - PlayWomanAudioSequence()协程: 每段播完后等0.5s再播下一段 --- Assets/Scripts/UI/PageController.cs | 200 +++++++++++++--------------- 1 file changed, 93 insertions(+), 107 deletions(-) diff --git a/Assets/Scripts/UI/PageController.cs b/Assets/Scripts/UI/PageController.cs index 545ff55..68748db 100644 --- a/Assets/Scripts/UI/PageController.cs +++ b/Assets/Scripts/UI/PageController.cs @@ -49,108 +49,43 @@ public class PageController : MonoBehaviour { Debug.Log("=== PageController 初始化开始 ==="); + // 背景音乐 AudioSource + _bgAudioSource = gameObject.AddComponent(); + _bgAudioSource.loop = true; + _bgAudioSource.playOnAwake = false; + // 绑定首页按钮 - if (_btnStart != null) - { - _btnStart.onClick.AddListener(OnStartClicked); - Debug.Log("PageController: _btnStart 绑定成功"); - } - else - Debug.LogError("PageController: _btnStart 未赋值!"); + if (_btnStart != null) { _btnStart.onClick.AddListener(OnStartClicked); Debug.Log("PageController: _btnStart 绑定成功"); } + else Debug.LogError("PageController: _btnStart 未赋值!"); - if (_btnExit != null) - { - _btnExit.onClick.AddListener(OnExitClicked); - Debug.Log("PageController: _btnExit 绑定成功"); - } - else - Debug.LogError("PageController: _btnExit 未赋值!"); + if (_btnExit != null) { _btnExit.onClick.AddListener(OnExitClicked); Debug.Log("PageController: _btnExit 绑定成功"); } + else Debug.LogError("PageController: _btnExit 未赋值!"); - // 绑定模式选择页按钮 - if (_btnBack != null) - { - _btnBack.onClick.AddListener(OnModeBackClicked); - Debug.Log("PageController: _btnBack 绑定成功"); - } - else - Debug.LogError("PageController: _btnBack 未赋值!"); + if (_btnBack != null) { _btnBack.onClick.AddListener(OnModeBackClicked); Debug.Log("PageController: _btnBack 绑定成功"); } + else Debug.LogError("PageController: _btnBack 未赋值!"); - if (_btnPracticeMode != null) - { - _btnPracticeMode.onClick.AddListener(() => OnModeSelected(ExperimentMode.Learn)); - Debug.Log("PageController: _btnPracticeMode 绑定成功"); - } - else - Debug.LogError("PageController: _btnPracticeMode 未赋值!"); + if (_btnPracticeMode != null) { _btnPracticeMode.onClick.AddListener(() => OnModeSelected(ExperimentMode.Learn)); Debug.Log("PageController: _btnPracticeMode 绑定成功"); } + else Debug.LogError("PageController: _btnPracticeMode 未赋值!"); - if (_btnExamMode != null) - { - _btnExamMode.onClick.AddListener(() => OnModeSelected(ExperimentMode.Exam)); - Debug.Log("PageController: _btnExamMode 绑定成功"); - } - else - Debug.LogError("PageController: _btnExamMode 未赋值!"); + if (_btnExamMode != null) { _btnExamMode.onClick.AddListener(() => OnModeSelected(ExperimentMode.Exam)); Debug.Log("PageController: _btnExamMode 绑定成功"); } + else Debug.LogError("PageController: _btnExamMode 未赋值!"); - // 绑定固定方式选择页按钮 —— 自动修复 - if (_btnFixationBack == null && _fixationPanel != null) - { - var btnBack = _fixationPanel.transform.Find("BtnBack"); - if (btnBack != null) - { - _btnFixationBack = btnBack.GetComponent