[정영민] 아즈텍 프로젝트 OCTOPUS TWIN 템플릿 적용
26.02.26 - XRLib 추가 및 적용 - 아즈텍 프로젝트 OCTOPUS TWIN 템플릿 적용
This commit is contained in:
50
Assets/Scripts/Wrapper/CaptureRecoder.cs
Normal file
50
Assets/Scripts/Wrapper/CaptureRecoder.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using RenderHeads.Media.AVProMovieCapture;
|
||||
using SFB;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AZTECHWB.Management
|
||||
{
|
||||
public class CaptureRecoder
|
||||
{
|
||||
private CaptureBase capture;
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
capture = GameObject.FindFirstObjectByType<CaptureBase>();
|
||||
capture.CameraRenderResolution = CaptureBase.Resolution.Custom;
|
||||
capture.CompletedFileWritingAction += OnCaptureCompleted;
|
||||
}
|
||||
|
||||
public void SetRecordStatus(bool isStart)
|
||||
{
|
||||
if (isStart)
|
||||
{
|
||||
capture.StartCapture();
|
||||
}
|
||||
else
|
||||
{
|
||||
capture.StopCapture();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCaptureCompleted(FileWritingHandler handler)
|
||||
{
|
||||
var sourcePath = handler.FinalPath;
|
||||
var destFilePath = StandaloneFileBrowser.SaveFilePanel("Save File", "", "", "mp4");
|
||||
|
||||
if (!string.IsNullOrEmpty(destFilePath))
|
||||
{
|
||||
if (File.Exists(destFilePath))
|
||||
File.Delete(destFilePath);
|
||||
|
||||
File.Move(sourcePath, destFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Delete(sourcePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user