/// <summary> /// 录制文件导出协程 /// </summary> /// <returns></returns> public IEnumerator exportRecord() { saveWaitPanelText.text = "正在导出录制文件"; exportButton.interactable = false; yield return(null); try { List <Slide> tempslides = new List <Slide>(); SlideDoc tmpDoc = PublicTools.DeepCopy(PPTResourcePool.slideDoc); string xmlpath; foreach (Slide tempSlide in tmpDoc.slides) { int tempPageNum = tempSlide.pageNum; xmlpath = PPTGlobal.PPTPath + tempPageNum + "/control_" + tempPageNum + ".xml"; if (File.Exists(xmlpath)) { try { SlideDoc tempPageDoc = PublicTools.Deserialize <SlideDoc>(xmlpath); tempslides.Add(tempPageDoc.slides[0]); } catch { Debug.Log("格式转换失败" + xmlpath); } } else { //如果此页没有录制,默认保存PPT导出记录 tempslides.Add(tempSlide); } } xmlpath = PPTGlobal.PPTPath + "control.xml"; if (File.Exists(xmlpath)) { File.Delete(xmlpath); } tmpDoc.slides = tempslides; PublicTools.SaveObject(xmlpath, tmpDoc); string sourcePath = PPTGlobal.PPTPath.Replace("\\", "/"); if (sourcePath.EndsWith("/")) { sourcePath = sourcePath.Substring(0, sourcePath.Length - 1); } string DirectName = sourcePath.Substring(sourcePath.LastIndexOf("/") + 1); Debug.Log(@"EXPORT:" + PPTGlobal.PPTPath); if (!Directory.Exists(exportPath)) { Vesal_DirFiles.CreateDir(exportPath); } Vesal_DirFiles.ZipDirectory(PPTGlobal.PPTPath.Substring(0, PPTGlobal.PPTPath.Length - 1), @"" + exportPath + DirectName + ".vsl"); //Debug.LogError("压缩文件"); Debug.Log(@"EXPORT:" + exportPath + DirectName + ".vsl"); //打开文件夹 OpenWeiKePlayer(exportPath, DirectName); //打开播放器加载资源 } catch (Exception e) { Debug.Log(e.Message); Debug.Log(e.StackTrace); } yield return(null); exportButton.interactable = true; saveWaitPanelText.text = "导出完成!"; //saveWaitPanel.SetActive(false); //quitCanvas.SetActive(false); }