From 64b0c04cd5bbfdc1ef45a9a48b7429e3f8dbdea1 Mon Sep 17 00:00:00 2001 From: yanghua <1475658476@qq.com> Date: Tue, 8 Apr 2025 17:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E8=BD=BDPPT?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Bootstrap.cs | 2 +- Assets/Scripts/Test/LoadPPTTest.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Bootstrap.cs b/Assets/Scripts/Bootstrap.cs index aa381ef..cf334f0 100644 --- a/Assets/Scripts/Bootstrap.cs +++ b/Assets/Scripts/Bootstrap.cs @@ -31,7 +31,7 @@ public class Bootstrap : SingletonMono { uiManager.ShowPanel(this, E_UI_Layer.Bot, (panel) => { - //LoadPPTTest.PPTFiles(pptFolderName); + LoadPPTTest.PPTFiles(pptFolderName); uiManager.ShowPanel(this, E_UI_Layer.Top, (panel) => { ppts = LoadPPTTest.PPTName(); diff --git a/Assets/Scripts/Test/LoadPPTTest.cs b/Assets/Scripts/Test/LoadPPTTest.cs index bd36edc..36e0992 100644 --- a/Assets/Scripts/Test/LoadPPTTest.cs +++ b/Assets/Scripts/Test/LoadPPTTest.cs @@ -79,6 +79,7 @@ public static class LoadPPTTest for (int i = 0; i < pptsPath.Length; i++) { string pptName = PathName(pptsPath[i]); + await UniTask.Yield(); await LoadAllPPTFiles(pptName, pptsPath[i]); } } @@ -91,6 +92,7 @@ public static class LoadPPTTest // 遍历文档(只做示例使用自己根据需求拓展) for (int i = 0; i < presentation.Slides.Count; i++) { + await UniTask.Yield(); ISlide slide = presentation.Slides[i]; var bitmap = slide.GetThumbnail(1f, 1f); // 声明内存流,将图片转换为内存流,再由流转换为byte数组,然后用texture2d加载byte数组 @@ -100,9 +102,7 @@ public static class LoadPPTTest byte[] buff = new byte[ms.Length]; ms.Seek(0, SeekOrigin.Begin); await ms.ReadAsync(buff, 0, (int)ms.Length); - // 注意这个image的命名空间为system.drawing不是unity.ui,这个图片的目的是提供图片的宽高 - System.Drawing.Image sizeImage = System.Drawing.Image.FromStream(ms); - Texture2D texture2D = new Texture2D(sizeImage.Width, sizeImage.Height); + Texture2D texture2D = new Texture2D(2, 2); texture2D.LoadImage(buff); texture2Ds.Add(texture2D); }