修改加载PPT逻辑
This commit is contained in:
parent
ac9acefe98
commit
64b0c04cd5
|
@ -31,7 +31,7 @@ public class Bootstrap : SingletonMono<Bootstrap>
|
|||
{
|
||||
uiManager.ShowPanel<UI_BGPanel>(this, E_UI_Layer.Bot, (panel) =>
|
||||
{
|
||||
//LoadPPTTest.PPTFiles(pptFolderName);
|
||||
LoadPPTTest.PPTFiles(pptFolderName);
|
||||
uiManager.ShowPanel<UI_SelectModePanel>(this, E_UI_Layer.Top, (panel) =>
|
||||
{
|
||||
ppts = LoadPPTTest.PPTName();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue