fix: 片头动画改为用户触发而非自动播放
- OpeningFlowController: Start() 不再自动播放动画,新增 PlayOpeningFlow(Action onComplete) 公开方法 - PageController: OnFixationSelected() 先隐藏所有UI面板,调用 PlayOpeningFlow,动画结束后再显示 ExperimentPanel - 新增 HideAllPages() 方法用于片头动画期间清空UI - 所有按钮回调均保留 Debug.Log 输出
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
|
||||
/// <summary>
|
||||
/// 片头动画流程控制器:控制 man 的 Idle → Shoot → Fall 流程,
|
||||
/// 摔倒后黑幕转场,显示 woman 和 maninjury。
|
||||
/// 挂在一个独立的空 GameObject 上(如 SceneRoot)。
|
||||
/// </summary>
|
||||
public class OpeningFlowController : MonoBehaviour
|
||||
{
|
||||
[Header("=== 角色引用 ===")]
|
||||
[SerializeField] private Animator _manAnimator;
|
||||
[SerializeField] private Animator _man2Animator;
|
||||
[SerializeField] private GameObject _man2Object;
|
||||
[SerializeField] private GameObject _womanObject;
|
||||
[SerializeField] private GameObject _manInjuryObject;
|
||||
|
||||
[Header("=== 黑幕 UI ===")]
|
||||
[SerializeField] private GameObject _blackScreenPanel;
|
||||
[SerializeField] private Image _blackScreenImage;
|
||||
|
||||
[Header("=== 时间配置 ===")]
|
||||
[SerializeField] private float _idleDuration = 2f;
|
||||
[SerializeField] private float _fadeDuration = 1f;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// 自动查找引用
|
||||
AutoAssignReferences();
|
||||
|
||||
// 初始状态确认:woman 和 maninjury 应该隐藏
|
||||
if (_womanObject != null) _womanObject.SetActive(false);
|
||||
if (_manInjuryObject != null) _manInjuryObject.SetActive(false);
|
||||
if (_blackScreenPanel != null) _blackScreenPanel.SetActive(false);
|
||||
|
||||
// 不自动启动动画流程 —— 等待用户选择模式和固定方式后由 PageController 触发
|
||||
Debug.Log("[OpeningFlow] 就绪,等待用户选择模式和固定方式。");
|
||||
}
|
||||
|
||||
private void AutoAssignReferences()
|
||||
{
|
||||
var manGo = GameObject.Find("man");
|
||||
if (manGo != null && _manAnimator == null)
|
||||
_manAnimator = manGo.GetComponent<Animator>();
|
||||
|
||||
var man2Go = GameObject.Find("man2");
|
||||
if (man2Go != null)
|
||||
{
|
||||
if (_man2Animator == null) _man2Animator = man2Go.GetComponent<Animator>();
|
||||
if (_man2Object == null) _man2Object = man2Go;
|
||||
}
|
||||
|
||||
if (_womanObject == null) _womanObject = GameObject.Find("woman");
|
||||
if (_manInjuryObject == null) _manInjuryObject = GameObject.Find("maninjury");
|
||||
if (_blackScreenPanel == null) _blackScreenPanel = GameObject.Find("BlackScreenPanel");
|
||||
if (_blackScreenImage == null && _blackScreenPanel != null)
|
||||
_blackScreenImage = _blackScreenPanel.GetComponent<Image>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 公开方法:由 PageController 在用户选定固定方式后调用。
|
||||
/// 播放片头动画(man Idle→Shoot→Fall→黑幕转场→显示woman+maninjury),
|
||||
/// 完成后回调 onComplete。
|
||||
/// </summary>
|
||||
public void PlayOpeningFlow(System.Action onComplete)
|
||||
{
|
||||
Debug.Log("[OpeningFlow] PlayOpeningFlow() 被调用,开始播放片头动画。");
|
||||
StartCoroutine(RunOpeningFlow(onComplete));
|
||||
}
|
||||
|
||||
private IEnumerator RunOpeningFlow(System.Action onComplete)
|
||||
{
|
||||
Debug.Log("=== [OpeningFlow] 片头动画流程开始 ===");
|
||||
|
||||
// Step 1: man 和 man2 同时 Idle,持续 _idleDuration 秒
|
||||
Debug.Log($"[OpeningFlow] Step1: man + man2 Idle ({_idleDuration}s)");
|
||||
yield return new WaitForSeconds(_idleDuration);
|
||||
|
||||
// Step 2: man 投篮动画 Shoot (3.15s)
|
||||
Debug.Log("[OpeningFlow] Step2: man Shoot 动画开始");
|
||||
if (_manAnimator != null)
|
||||
{
|
||||
_manAnimator.SetBool("IsStart", true);
|
||||
yield return new WaitForSeconds(3.15f);
|
||||
_manAnimator.SetBool("IsStart", false);
|
||||
Debug.Log("[OpeningFlow] Step2: man Shoot 动画结束");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[OpeningFlow] _manAnimator 为空,跳过 Step2");
|
||||
}
|
||||
|
||||
// Step 3: man 摔倒动画 manfull (2.1s)
|
||||
Debug.Log("[OpeningFlow] Step3: man Fall 动画开始");
|
||||
if (_manAnimator != null)
|
||||
{
|
||||
_manAnimator.SetBool("IsFull", true);
|
||||
yield return new WaitForSeconds(2.1f);
|
||||
Debug.Log("[OpeningFlow] Step3: man Fall 动画结束");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[OpeningFlow] _manAnimator 为空,跳过 Step3");
|
||||
}
|
||||
|
||||
// Step 4: 黑幕转场 —— 渐入 -> 切换角色 -> 渐出
|
||||
Debug.Log("[OpeningFlow] Step4: 黑幕转场开始");
|
||||
yield return StartCoroutine(FadeBlackScreen(0f, 1f));
|
||||
|
||||
// 切换角色
|
||||
if (_man2Object != null) { _man2Object.SetActive(false); Debug.Log("[OpeningFlow] man2 已隐藏"); }
|
||||
if (_womanObject != null) { _womanObject.SetActive(true); Debug.Log("[OpeningFlow] woman 已显示"); }
|
||||
if (_manInjuryObject != null) { _manInjuryObject.SetActive(true); Debug.Log("[OpeningFlow] maninjury 已显示"); }
|
||||
|
||||
yield return new WaitForSeconds(0.3f);
|
||||
yield return StartCoroutine(FadeBlackScreen(1f, 0f));
|
||||
|
||||
Debug.Log("=== [OpeningFlow] 片头动画流程完成 ===");
|
||||
onComplete?.Invoke();
|
||||
}
|
||||
|
||||
private IEnumerator FadeBlackScreen(float fromAlpha, float toAlpha)
|
||||
{
|
||||
if (_blackScreenPanel == null || _blackScreenImage == null)
|
||||
{
|
||||
Debug.LogWarning("[OpeningFlow] BlackScreenPanel 或 Image 为空,跳过转场");
|
||||
yield break;
|
||||
}
|
||||
|
||||
_blackScreenPanel.SetActive(true);
|
||||
|
||||
float elapsed = 0f;
|
||||
while (elapsed < _fadeDuration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
float t = Mathf.Clamp01(elapsed / _fadeDuration);
|
||||
_blackScreenImage.color = new Color(0, 0, 0, Mathf.Lerp(fromAlpha, toAlpha, t));
|
||||
yield return null;
|
||||
}
|
||||
|
||||
_blackScreenImage.color = new Color(0, 0, 0, toAlpha);
|
||||
if (toAlpha <= 0.01f)
|
||||
_blackScreenPanel.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4aaf3f536776e4baa98839960d122cff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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() 已调用");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+165
-15
@@ -3,7 +3,8 @@ using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// UI 中央调度器:引用所有子面板,绑定 StepManager 事件。
|
||||
/// 挂在 Canvas GameObject 上。使用原生 Text(非 TMP)。
|
||||
/// 按钮策略:同时绑定 Inspector 引用(旧 RightButtons)和 ExperimentPanel/Navbar 按钮(新 UI),
|
||||
/// 两者均可触发,互不冲突。
|
||||
/// </summary>
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
@@ -26,7 +27,7 @@ public class UIManager : MonoBehaviour
|
||||
[Header("=== 画中画视频 ===")]
|
||||
[SerializeField] private VideoController _videoController;
|
||||
|
||||
[Header("=== 右侧功能按钮 ===")]
|
||||
[Header("=== 仿真导航栏按钮(旧引用 + Navbar)===")]
|
||||
[SerializeField] private Button _btnFullScreen;
|
||||
[SerializeField] private Button _btnPrevious;
|
||||
[SerializeField] private Button _btnNext;
|
||||
@@ -56,15 +57,117 @@ public class UIManager : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Debug.Log("=== UIManager 初始化开始 ===");
|
||||
|
||||
if (_stepManager == null)
|
||||
{
|
||||
_stepManager = FindObjectOfType<StepManager>();
|
||||
if (_stepManager != null) Debug.Log("UIManager: _stepManager 自动查找成功");
|
||||
else Debug.LogError("UIManager: _stepManager 未找到!");
|
||||
}
|
||||
|
||||
if (_interactionSystem == null)
|
||||
{
|
||||
_interactionSystem = FindObjectOfType<InteractionSystem>();
|
||||
if (_interactionSystem != null) Debug.Log("UIManager: _interactionSystem 自动查找成功");
|
||||
}
|
||||
|
||||
BindEvents();
|
||||
BindButtons();
|
||||
BindButtons(); // 旧引用(RightButtons 等)
|
||||
BindNavbarButtons(); // 新 Navbar 按钮
|
||||
Debug.Log("=== UIManager 初始化完成 ===");
|
||||
}
|
||||
|
||||
#region Navbar 按钮绑定(始终执行,不依赖 Inspector 引用)
|
||||
|
||||
private void BindNavbarButtons()
|
||||
{
|
||||
Debug.Log("--- UIManager: 开始绑定 Navbar 按钮 ---");
|
||||
|
||||
var experimentPanel = GameObject.Find("ExperimentPanel");
|
||||
if (experimentPanel == null)
|
||||
{
|
||||
Debug.LogError("UIManager: ExperimentPanel 未找到!无法绑定 Navbar 按钮!");
|
||||
return;
|
||||
}
|
||||
|
||||
var navbar = experimentPanel.transform.Find("Navbar");
|
||||
if (navbar == null)
|
||||
{
|
||||
Debug.LogError("UIManager: ExperimentPanel/Navbar 未找到!无法绑定 Navbar 按钮!");
|
||||
return;
|
||||
}
|
||||
|
||||
// FullScreen
|
||||
var btnFS = navbar.Find("FullScreen");
|
||||
if (btnFS != null)
|
||||
{
|
||||
var btn = btnFS.GetComponent<Button>();
|
||||
if (btn != null)
|
||||
{
|
||||
btn.onClick.AddListener(ToggleFullScreen);
|
||||
Debug.Log("UIManager: Navbar/FullScreen 绑定成功 -> ToggleFullScreen");
|
||||
}
|
||||
}
|
||||
else Debug.LogWarning("UIManager: Navbar/FullScreen 未找到");
|
||||
|
||||
// Previous
|
||||
var btnPrev = navbar.Find("Previous");
|
||||
if (btnPrev != null)
|
||||
{
|
||||
var btn = btnPrev.GetComponent<Button>();
|
||||
if (btn != null)
|
||||
{
|
||||
btn.onClick.AddListener(OnPreviousClicked);
|
||||
Debug.Log("UIManager: Navbar/Previous 绑定成功 -> OnPreviousClicked");
|
||||
}
|
||||
}
|
||||
else Debug.LogWarning("UIManager: Navbar/Previous 未找到");
|
||||
|
||||
// Next
|
||||
var btnNext = navbar.Find("Next");
|
||||
if (btnNext != null)
|
||||
{
|
||||
var btn = btnNext.GetComponent<Button>();
|
||||
if (btn != null)
|
||||
{
|
||||
btn.onClick.AddListener(OnNextClicked);
|
||||
Debug.Log("UIManager: Navbar/Next 绑定成功 -> OnNextClicked");
|
||||
}
|
||||
}
|
||||
else Debug.LogWarning("UIManager: Navbar/Next 未找到");
|
||||
|
||||
// PracticeMode
|
||||
var btnMode = navbar.Find("PracticeMode");
|
||||
if (btnMode != null)
|
||||
{
|
||||
var btn = btnMode.GetComponent<Button>();
|
||||
if (btn != null)
|
||||
{
|
||||
btn.onClick.AddListener(OnSwitchModeClicked);
|
||||
Debug.Log("UIManager: Navbar/PracticeMode 绑定成功 -> OnSwitchModeClicked");
|
||||
}
|
||||
}
|
||||
else Debug.LogWarning("UIManager: Navbar/PracticeMode 未找到");
|
||||
|
||||
// BtnBack(返回按钮)
|
||||
var btnBack = navbar.Find("BtnBack");
|
||||
if (btnBack != null)
|
||||
{
|
||||
var btn = btnBack.GetComponent<Button>();
|
||||
if (btn != null)
|
||||
{
|
||||
btn.onClick.AddListener(OnReturnClicked);
|
||||
Debug.Log("UIManager: Navbar/BtnBack 绑定成功 -> OnReturnClicked");
|
||||
}
|
||||
}
|
||||
else Debug.LogWarning("UIManager: Navbar/BtnBack 未找到");
|
||||
|
||||
Debug.Log("--- UIManager: Navbar 按钮绑定完成 ---");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 事件绑定
|
||||
|
||||
private void BindEvents()
|
||||
@@ -78,17 +181,54 @@ public class UIManager : MonoBehaviour
|
||||
_stepManager.OnExamPopup.AddListener(ShowExamPopup);
|
||||
_stepManager.OnExperimentComplete.AddListener(OnExperimentComplete);
|
||||
_stepManager.OnVideoToggle.AddListener(ToggleVideo);
|
||||
Debug.Log("UIManager: StepManager 事件绑定完成");
|
||||
}
|
||||
|
||||
private void BindButtons()
|
||||
{
|
||||
if (_btnFullScreen) _btnFullScreen.onClick.AddListener(ToggleFullScreen);
|
||||
if (_btnPrevious) _btnPrevious.onClick.AddListener(OnPreviousClicked);
|
||||
if (_btnNext) _btnNext.onClick.AddListener(OnNextClicked);
|
||||
if (_btnSwitchMode) _btnSwitchMode.onClick.AddListener(OnSwitchModeClicked);
|
||||
if (_btnReturn) _btnReturn.onClick.AddListener(OnReturnClicked);
|
||||
if (_btnLimbFixation) _btnLimbFixation.onClick.AddListener(() => _stepManager?.SwitchFixation(FixationMethod.LimbFixation));
|
||||
if (_btnSplintFixation) _btnSplintFixation.onClick.AddListener(() => _stepManager?.SwitchFixation(FixationMethod.SplintFixation));
|
||||
if (_btnFullScreen != null)
|
||||
{
|
||||
_btnFullScreen.onClick.AddListener(ToggleFullScreen);
|
||||
Debug.Log("UIManager: _btnFullScreen 绑定成功");
|
||||
}
|
||||
if (_btnPrevious != null)
|
||||
{
|
||||
_btnPrevious.onClick.AddListener(OnPreviousClicked);
|
||||
Debug.Log("UIManager: _btnPrevious 绑定成功");
|
||||
}
|
||||
if (_btnNext != null)
|
||||
{
|
||||
_btnNext.onClick.AddListener(OnNextClicked);
|
||||
Debug.Log("UIManager: _btnNext 绑定成功");
|
||||
}
|
||||
if (_btnSwitchMode != null)
|
||||
{
|
||||
_btnSwitchMode.onClick.AddListener(OnSwitchModeClicked);
|
||||
Debug.Log("UIManager: _btnSwitchMode 绑定成功");
|
||||
}
|
||||
if (_btnReturn != null)
|
||||
{
|
||||
_btnReturn.onClick.AddListener(OnReturnClicked);
|
||||
Debug.Log("UIManager: _btnReturn 绑定成功");
|
||||
}
|
||||
|
||||
if (_btnLimbFixation != null)
|
||||
{
|
||||
_btnLimbFixation.onClick.AddListener(() => {
|
||||
Debug.Log("UIManager: [BtnLimbFixation] 点击 -> 肢体固定");
|
||||
_stepManager?.SwitchFixation(FixationMethod.LimbFixation);
|
||||
});
|
||||
Debug.Log("UIManager: _btnLimbFixation 绑定成功");
|
||||
}
|
||||
|
||||
if (_btnSplintFixation != null)
|
||||
{
|
||||
_btnSplintFixation.onClick.AddListener(() => {
|
||||
Debug.Log("UIManager: [BtnSplintFixation] 点击 -> 夹板固定");
|
||||
_stepManager?.SwitchFixation(FixationMethod.SplintFixation);
|
||||
});
|
||||
Debug.Log("UIManager: _btnSplintFixation 绑定成功");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -97,6 +237,7 @@ public class UIManager : MonoBehaviour
|
||||
|
||||
private void OnStepChanged(int index)
|
||||
{
|
||||
Debug.Log($"UIManager: [OnStepChanged] 步骤 = {index + 1}");
|
||||
UpdateProgressBar();
|
||||
UpdateNavigationButtons();
|
||||
}
|
||||
@@ -121,6 +262,7 @@ public class UIManager : MonoBehaviour
|
||||
|
||||
private void ToggleVideo(string fileName, bool active)
|
||||
{
|
||||
Debug.Log($"UIManager: [ToggleVideo] file={fileName}, active={active}");
|
||||
if (_videoController == null) return;
|
||||
if (active && !string.IsNullOrEmpty(fileName))
|
||||
_videoController.PlayVideo(fileName);
|
||||
@@ -140,8 +282,8 @@ public class UIManager : MonoBehaviour
|
||||
private void UpdateNavigationButtons()
|
||||
{
|
||||
if (_stepManager == null) return;
|
||||
if (_btnPrevious) _btnPrevious.interactable = _stepManager.CurrentStepIndex > 0;
|
||||
if (_btnNext)
|
||||
if (_btnPrevious != null) _btnPrevious.interactable = _stepManager.CurrentStepIndex > 0;
|
||||
if (_btnNext != null)
|
||||
{
|
||||
var label = _btnNext.GetComponentInChildren<Text>();
|
||||
bool isLast = _stepManager.CurrentStepIndex >= _stepManager.TotalSteps - 1;
|
||||
@@ -155,12 +297,14 @@ public class UIManager : MonoBehaviour
|
||||
|
||||
private void ShowExamPopup(StepData step)
|
||||
{
|
||||
Debug.Log($"UIManager: [ShowExamPopup] 题目={step.ExamQuestionText}");
|
||||
if (_examPopup == null) return;
|
||||
_examPopup.Show(step, OnExamAnswer);
|
||||
}
|
||||
|
||||
private void OnExamAnswer(float proportion, string feedback)
|
||||
{
|
||||
Debug.Log($"UIManager: [OnExamAnswer] proportion={proportion}, feedback={feedback}");
|
||||
_stepManager?.OnStepInteractionComplete(proportion, feedback);
|
||||
_stepManager?.NextStep();
|
||||
}
|
||||
@@ -171,6 +315,7 @@ public class UIManager : MonoBehaviour
|
||||
|
||||
private void OnExperimentComplete()
|
||||
{
|
||||
Debug.Log("UIManager: [OnExperimentComplete] 实验完成");
|
||||
var gm = GameManager.Instance;
|
||||
if (gm == null) return;
|
||||
if (gm.CurrentMode == ExperimentMode.Exam)
|
||||
@@ -186,15 +331,18 @@ public class UIManager : MonoBehaviour
|
||||
private void ToggleFullScreen()
|
||||
{
|
||||
Screen.fullScreen = !Screen.fullScreen;
|
||||
Debug.Log($"UIManager: [ToggleFullScreen] 全屏 = {Screen.fullScreen}");
|
||||
}
|
||||
|
||||
private void OnPreviousClicked()
|
||||
{
|
||||
Debug.Log("UIManager: [OnPreviousClicked] -> 上一步");
|
||||
_stepManager?.PreviousStep();
|
||||
}
|
||||
|
||||
private void OnNextClicked()
|
||||
{
|
||||
Debug.Log("UIManager: [OnNextClicked] -> 下一步");
|
||||
if (_stepManager != null && _stepManager.Mode == ExperimentMode.Exam)
|
||||
{
|
||||
var step = _stepManager.GetCurrentStep();
|
||||
@@ -207,18 +355,20 @@ public class UIManager : MonoBehaviour
|
||||
private void OnSwitchModeClicked()
|
||||
{
|
||||
if (_stepManager == null) return;
|
||||
var newMode = _stepManager.Mode == ExperimentMode.Learn
|
||||
? ExperimentMode.Exam : ExperimentMode.Learn;
|
||||
var oldMode = _stepManager.Mode;
|
||||
var newMode = oldMode == ExperimentMode.Learn ? ExperimentMode.Exam : ExperimentMode.Learn;
|
||||
Debug.Log($"UIManager: [OnSwitchModeClicked] 切换 {oldMode} -> {newMode}");
|
||||
_stepManager.SwitchMode(newMode);
|
||||
}
|
||||
|
||||
private void OnReturnClicked()
|
||||
{
|
||||
Debug.Log("UIManager: [OnReturnClicked] -> 返回首页");
|
||||
var pageCtrl = FindObjectOfType<PageController>();
|
||||
if (pageCtrl != null)
|
||||
pageCtrl.ReturnToHome();
|
||||
else
|
||||
Debug.LogWarning("UIManager: 未找到 PageController,无法返回首页。");
|
||||
Debug.LogWarning("UIManager: 未找到 PageController。");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user