diff --git a/Assets/Scripts/Project/UI/UI_Panel/UI_PPTForPracticePanel.cs b/Assets/Scripts/Project/UI/UI_Panel/UI_PPTForPracticePanel.cs index 3733b94..b5279b0 100644 --- a/Assets/Scripts/Project/UI/UI_Panel/UI_PPTForPracticePanel.cs +++ b/Assets/Scripts/Project/UI/UI_Panel/UI_PPTForPracticePanel.cs @@ -24,6 +24,8 @@ public class UI_PPTForPracticePanel : BasePanel public UI_SelectDevicePanel UI_SelectDevice; + protected bool isPPTLoading = false; + protected override void Awake() { canvasGroup.alpha = 1f; @@ -136,7 +138,9 @@ public class UI_PPTForPracticePanel : BasePanel } protected override void OnChangeToggle(string togglePath, bool isOn) { + base.OnChangeToggle(togglePath, isOn); + if (isPPTLoading) return;//PPT正在加载中,不处理其他切换 switch (togglePath) { default: @@ -146,6 +150,7 @@ public class UI_PPTForPracticePanel : BasePanel { DestroyImmediate(child.gameObject); } + isPPTLoading = true; // 启动协程异步加载PPT StartCoroutine(LoadPPTAsync(togglePath, textures => { @@ -181,6 +186,7 @@ public class UI_PPTForPracticePanel : BasePanel image.texture = texture; image.rectTransform.sizeDelta = new Vector2(1608, 940); } + isPPTLoading = false;//完成加载 } private void DisplaySinglePage(Texture2D texture)