//开始播放录屏 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> /// 创建录制文档 /// </summary> public void createRecordDoc() { rd = new RecordDoc(); rd.initCamPos = PublicTools.Vector32Str(Camera.main.transform.position); rd.initCamRot = PublicTools.Vector32Str(Camera.main.transform.rotation.eulerAngles); rd.initCamParentPos = PublicTools.Vector32Str(Camera.main.transform.parent.position); rd.initCamParentRot = PublicTools.Vector32Str(Camera.main.transform.parent.rotation.eulerAngles); rd.fieldOfView = Camera.main.fieldOfView; }
/// <summary> /// 保存录制文档 /// </summary> public void writeRecordDoc() { Debug.Log("writeRecordDoc"); if (rd == null) { return; } Debug.Log("start save RecordDoc -"); Debug.Log("start save RecordDoc -" + rd.initCamParentPos); rd.ris = this.tempRecordQueue; string time = PublicTools.getTime(); string xmlPath = PPTGlobal.PPTPath + this.pageNum + "/" + me.fileName; Debug.Log(xmlPath); if (File.Exists(xmlPath)) { File.Move(xmlPath, PPTGlobal.PPTPath + this.pageNum + "/" + time + me.fileName); } PublicTools.SaveObject(xmlPath, rd); Debug.Log("RecordDoc end!"); rd = null; }