From 246882573fa30ad9b98d243d57cf9936387021f3 Mon Sep 17 00:00:00 2001 From: Yogi <1273750265@qq.com> Date: Wed, 4 Dec 2024 18:32:30 +0800 Subject: [PATCH] Fixed Bug Jump Last Video --- Assets/Scripts/GameManager.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index ef01676..715f0ad 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -196,15 +196,19 @@ public class GameManager : MonoBehaviour if (videoControl.IsCanPlayMP4()) { videoControl.PlayMP4(); - if (!videoControl.IsCanPlayMP4())// 播放到了最后一个视频, 自动播放End动画 - { - brainTrans.gameObject.SetActive(false); - videoControl.PlayEndVideo(); - videoControl.OnPlayFinished += ResetToGameStart; - } + videoControl.OnPlayFinished += TryToPlayEndAnim; } } } + private void TryToPlayEndAnim() + { + videoControl.OnPlayFinished -= TryToPlayEndAnim; + if (videoControl.IsCanPlayMP4())// 播放到了最后一个视频, 自动播放End动画 + return; + brainTrans.gameObject.SetActive(false); + videoControl.PlayEndVideo(); + videoControl.OnPlayFinished += ResetToGameStart; + } private void ResetToGameStart() { videoControl.OnPlayFinished -= ResetToGameStart;