/// <summary> /// 加载问题 /// </summary> /// <param name="fileName">加载关联文件</param> /// <returns></returns> public bool loadVqa(string fileName) { string filePath = PPTGlobal.PPTPath + this.pageNum + "/" + fileName; if (!File.Exists(filePath)) { string tmpName = fileName.Replace("SL_", "").Replace("YL_", ""); filePath = PPTGlobal.PPTPath + this.pageNum + "/SL_" + tmpName; if (!File.Exists(filePath)) { filePath = PPTGlobal.PPTPath + this.pageNum + "/YL_" + tmpName; if (!File.Exists(filePath)) { filePath = PPTGlobal.PPTPath + this.pageNum + "/" + tmpName; } } } if (File.Exists(filePath)) { VqaRoot vqaRoot = PublicTools.Deserialize <VqaRoot>(filePath); currentVqa.vqa = vqaRoot.vqa; return(true); } Debug.Log("loadVqa not exists:" + filePath); return(false); }
//开始播放录屏 private void RecordStart() { if (tempRis != null) { tempRis.Clear(); } if (!File.Exists(PPTGlobal.PPTPath + pageNum + "/" + me.fileName)) { isNoRecord = true; return; } //读取录屏信息 RecordDoc rd = PublicTools.Deserialize <RecordDoc>(PPTGlobal.PPTPath + pageNum + "/" + me.fileName); //初始化摄像机位置 //CamParentPos emptyBox.transform.position = PublicTools.Str2Vector3(rd.initCamParentPos); emptyBox.transform.rotation = Quaternion.Euler(PublicTools.Str2Vector3(rd.initCamParentRot)); MainCam.transform.position = PublicTools.Str2Vector3(rd.initCamPos); MainCam.transform.rotation = Quaternion.Euler(PublicTools.Str2Vector3(rd.initCamRot)); tempRis = rd.ris; if (tempRis == null) { tempRis = new List <RecordItem>(); } Camera.main.fieldOfView = rd.fieldOfView != 0 ? rd.fieldOfView : 10; Debug.Log("records :" + tempRis.Count); recordUpdate = 0; recordPlay = true; isNoRecord = false; }
/// <summary> /// 读取xml,加载资源 /// </summary> /// <returns></returns> public bool readXml() { string xmlpath = string.Empty; if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.PPTPlayer) { xmlpath = PPTGlobal.PPTPath + "ppt_control.xml"; } else { xmlpath = PPTGlobal.PPTPath + "control.xml"; } //Debug.Log(xmlpath); if (File.Exists(xmlpath)) { try { slideDoc = PublicTools.Deserialize <SlideDoc>(xmlpath); } catch { Debug.Log("格式转换失败" + xmlpath); } return(true); } else { if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.PPTPlayer) { Debug.Log("获取文件失败:" + xmlpath); } else { loadingText.text = "获取文件失败:" + xmlpath; Debug.Log(loadingText.text); } return(false); } }
/// <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); }