녹화 및 캡처 파일 저장 기능 수정

This commit is contained in:
정영민
2025-03-11 14:03:04 +09:00
parent a9bc8aff8b
commit 60dd620204
6 changed files with 269 additions and 321 deletions

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b71a25bf47def884c9ab0252decfcd8d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b578110b1da1f104a9ade6951ad732b4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f190283d20cbf9548a4e12a2eabab97c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e563fbb3c6913574abff9e2b74d7631e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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);
}
}