fix: 片头动画改为用户触发而非自动播放
- OpeningFlowController: Start() 不再自动播放动画,新增 PlayOpeningFlow(Action onComplete) 公开方法 - PageController: OnFixationSelected() 先隐藏所有UI面板,调用 PlayOpeningFlow,动画结束后再显示 ExperimentPanel - 新增 HideAllPages() 方法用于片头动画期间清空UI - 所有按钮回调均保留 Debug.Log 输出
This commit is contained in:
@@ -208,6 +208,19 @@ public class PageController : MonoBehaviour
|
||||
_uiManager.enabled = (page == Page.Experiment);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏所有页面,用于播放片头动画时清空 UI
|
||||
/// </summary>
|
||||
private void HideAllPages()
|
||||
{
|
||||
Debug.Log("PageController: [HideAllPages] 隐藏所有 UI 面板");
|
||||
if (_homePagePanel != null) _homePagePanel.SetActive(false);
|
||||
if (_modeSelectPanel != null) _modeSelectPanel.SetActive(false);
|
||||
if (_fixationPanel != null) _fixationPanel.SetActive(false);
|
||||
if (_experimentPanel != null) _experimentPanel.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 按钮回调
|
||||
@@ -261,7 +274,7 @@ public class PageController : MonoBehaviour
|
||||
|
||||
private void OnFixationSelected(FixationMethod method)
|
||||
{
|
||||
Debug.Log($"PageController: [FixationSelected] 点击 -> 固定方式 [{method}] -> 切换到 Experiment");
|
||||
Debug.Log($"PageController: [FixationSelected] 点击 -> 固定方式 [{method}]");
|
||||
var gm = GameManager.Instance;
|
||||
if (gm == null)
|
||||
{
|
||||
@@ -273,17 +286,42 @@ public class PageController : MonoBehaviour
|
||||
gm.CurrentFixationMethod = method;
|
||||
Debug.Log($"PageController: GameManager 已设置 Mode=[{gm.CurrentMode}] Fixation=[{gm.CurrentFixationMethod}]");
|
||||
|
||||
ShowPage(Page.Experiment);
|
||||
// 隐藏所有UI面板,准备播放片头动画
|
||||
HideAllPages();
|
||||
|
||||
var stepManager = FindObjectOfType<StepManager>();
|
||||
if (stepManager != null)
|
||||
// 找到 OpeningFlowController 播放片头动画
|
||||
var openingFlow = FindObjectOfType<OpeningFlowController>();
|
||||
if (openingFlow != null)
|
||||
{
|
||||
stepManager.InitializeFromGameManager();
|
||||
Debug.Log("PageController: StepManager.InitializeFromGameManager() 已调用");
|
||||
Debug.Log("PageController: 开始播放片头动画,ExperimentPanel 将在动画结束后显示");
|
||||
openingFlow.PlayOpeningFlow(() =>
|
||||
{
|
||||
Debug.Log("PageController: 片头动画完成,显示 ExperimentPanel");
|
||||
ShowPage(Page.Experiment);
|
||||
|
||||
var stepManager = FindObjectOfType<StepManager>();
|
||||
if (stepManager != null)
|
||||
{
|
||||
stepManager.InitializeFromGameManager();
|
||||
Debug.Log("PageController: StepManager.InitializeFromGameManager() 已调用");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("PageController: 未找到 StepManager,实验步骤不会自动初始化");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("PageController: 未找到 StepManager,实验步骤不会自动初始化");
|
||||
Debug.LogWarning("PageController: 未找到 OpeningFlowController,直接显示 ExperimentPanel");
|
||||
ShowPage(Page.Experiment);
|
||||
|
||||
var stepManager = FindObjectOfType<StepManager>();
|
||||
if (stepManager != null)
|
||||
{
|
||||
stepManager.InitializeFromGameManager();
|
||||
Debug.Log("PageController: StepManager.InitializeFromGameManager() 已调用");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user