녹화 및 캡처 파일 저장 기능 수정
This commit is contained in:
@@ -4,26 +4,24 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using WI;
|
||||
using System.Windows.Forms;
|
||||
using RenderHeads.Media.AVProMovieCapture;
|
||||
using System.IO;
|
||||
using SFB;
|
||||
|
||||
public class Panel_ToolBar : PanelBase
|
||||
{
|
||||
private UnityEngine.UI.Button Button_TopView;
|
||||
private UnityEngine.UI.Button Button_QuarterView;
|
||||
private UnityEngine.UI.Button Button_SholuderView;
|
||||
private UnityEngine.UI.Button Button_DashBoard;
|
||||
private UnityEngine.UI.Button Button_CustomView;
|
||||
private UnityEngine.UI.Button Button_Minimap;
|
||||
private UnityEngine.UI.Button Button_Record;
|
||||
private UnityEngine.UI.Image Image_Record_Play;
|
||||
private UnityEngine.UI.Button Button_Capture;
|
||||
private UnityEngine.UI.Button Button_InnerWall;
|
||||
private Button Button_TopView;
|
||||
private Button Button_QuarterView;
|
||||
private Button Button_SholuderView;
|
||||
private Button Button_DashBoard;
|
||||
private Button Button_CustomView;
|
||||
private Button Button_Minimap;
|
||||
private Button Button_Record;
|
||||
private Image Image_Record_Play;
|
||||
private Button Button_Capture;
|
||||
private Button Button_InnerWall;
|
||||
|
||||
private CaptureBase capture;
|
||||
private SaveFileDialog record_saveFileDialog;
|
||||
private SaveFileDialog capture_saveFileDialog;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
@@ -43,42 +41,32 @@ public class Panel_ToolBar : PanelBase
|
||||
|
||||
private void RecordSetting()
|
||||
{
|
||||
record_saveFileDialog = new();
|
||||
var filePath = Path.GetFullPath(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyVideos));
|
||||
record_saveFileDialog.InitialDirectory = filePath;
|
||||
record_saveFileDialog.Filter = "mp4 files (*.mp4) |*.mp4|All files (*.*)|*.*";
|
||||
var filePath = Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
|
||||
|
||||
capture = GameObject.FindObjectOfType<CaptureBase>();
|
||||
capture.CameraRenderResolution = CaptureBase.Resolution.Custom;
|
||||
capture.CompletedFileWritingAction += OnCompleted;
|
||||
}
|
||||
|
||||
private void CaptureSetting()
|
||||
{
|
||||
capture_saveFileDialog = new();
|
||||
var filePath = Path.GetFullPath(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures));
|
||||
capture_saveFileDialog.InitialDirectory = filePath;
|
||||
capture_saveFileDialog.Filter = "jpg files (*.jpg) |*.jpg|png files (*.png) |*.jpg|All files (*.*)|*.*";
|
||||
var filePath = Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
|
||||
}
|
||||
|
||||
private void OnCompleted(FileWritingHandler handler)
|
||||
{
|
||||
var path = handler.FinalPath;
|
||||
if (record_saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
var sourcePath = handler.FinalPath;
|
||||
|
||||
var destFilePath = StandaloneFileBrowser.SaveFilePanel("Save File", "", "", "mp4");
|
||||
|
||||
if (!string.IsNullOrEmpty(destFilePath))
|
||||
{
|
||||
//if (File.Exists(path))
|
||||
//{
|
||||
// Debug.Log("File is Already");
|
||||
//}
|
||||
//else
|
||||
File.Move(path, record_saveFileDialog.FileName);
|
||||
File.Move(sourcePath, destFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Delete(path);
|
||||
File.Delete(sourcePath);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickInnerWall()
|
||||
{
|
||||
Debug.Log("³»º®");
|
||||
@@ -86,9 +74,11 @@ public class Panel_ToolBar : PanelBase
|
||||
|
||||
private void OnClickCapture()
|
||||
{
|
||||
if (record_saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
var destFilePath = StandaloneFileBrowser.SaveFilePanel("Save File", "", "", "png");
|
||||
|
||||
if (!string.IsNullOrEmpty(destFilePath))
|
||||
{
|
||||
ScreenCapture.CaptureScreenshot(record_saveFileDialog.FileName);
|
||||
ScreenCapture.CaptureScreenshot(destFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user