2025-03-10 16:42:23 +09:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using WI;
|
|
|
|
|
|
using RenderHeads.Media.AVProMovieCapture;
|
|
|
|
|
|
using System.IO;
|
2025-03-11 14:03:04 +09:00
|
|
|
|
using SFB;
|
2025-03-10 16:42:23 +09:00
|
|
|
|
|
|
|
|
|
|
public class Panel_ToolBar : PanelBase
|
|
|
|
|
|
{
|
2025-03-11 14:03:04 +09:00
|
|
|
|
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;
|
2025-03-10 16:42:23 +09:00
|
|
|
|
|
|
|
|
|
|
private CaptureBase capture;
|
|
|
|
|
|
|
2025-03-13 09:41:50 +09:00
|
|
|
|
public Action onClickMiniMap;
|
|
|
|
|
|
|
2025-03-12 12:04:19 +09:00
|
|
|
|
public Action onClickDashBoard;
|
2025-03-12 18:55:01 +09:00
|
|
|
|
public Action<ViewMode> onClickCameraView;
|
2025-03-14 09:21:26 +09:00
|
|
|
|
public Action onClickCustomView;
|
|
|
|
|
|
|
2025-03-10 16:42:23 +09:00
|
|
|
|
public override void AfterAwake()
|
|
|
|
|
|
{
|
|
|
|
|
|
Button_TopView.onClick.AddListener(OnClickTopView);
|
|
|
|
|
|
Button_QuarterView.onClick.AddListener(OnClickQuaterView);
|
|
|
|
|
|
Button_SholuderView.onClick.AddListener(OnClickShoulderView);
|
|
|
|
|
|
Button_DashBoard.onClick.AddListener(OnClickDashBoard);
|
|
|
|
|
|
Button_CustomView.onClick.AddListener(OnClickCustomView);
|
|
|
|
|
|
Button_Minimap.onClick.AddListener(OnClickMinimap);
|
|
|
|
|
|
Button_Record.onClick.AddListener(OnClickRecord);
|
|
|
|
|
|
Button_Capture.onClick.AddListener(OnClickCapture);
|
|
|
|
|
|
Button_InnerWall.onClick.AddListener(OnClickInnerWall);
|
|
|
|
|
|
|
|
|
|
|
|
RecordSetting();
|
|
|
|
|
|
CaptureSetting();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void RecordSetting()
|
|
|
|
|
|
{
|
2025-03-11 14:03:04 +09:00
|
|
|
|
var filePath = Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
|
2025-03-10 16:42:23 +09:00
|
|
|
|
|
|
|
|
|
|
capture = GameObject.FindObjectOfType<CaptureBase>();
|
|
|
|
|
|
capture.CameraRenderResolution = CaptureBase.Resolution.Custom;
|
|
|
|
|
|
capture.CompletedFileWritingAction += OnCompleted;
|
|
|
|
|
|
}
|
|
|
|
|
|
private void CaptureSetting()
|
|
|
|
|
|
{
|
2025-03-11 14:03:04 +09:00
|
|
|
|
var filePath = Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnCompleted(FileWritingHandler handler)
|
|
|
|
|
|
{
|
2025-03-11 14:03:04 +09:00
|
|
|
|
var sourcePath = handler.FinalPath;
|
|
|
|
|
|
|
|
|
|
|
|
var destFilePath = StandaloneFileBrowser.SaveFilePanel("Save File", "", "", "mp4");
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(destFilePath))
|
2025-03-10 16:42:23 +09:00
|
|
|
|
{
|
2025-03-11 14:03:04 +09:00
|
|
|
|
File.Move(sourcePath, destFilePath);
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-03-11 14:03:04 +09:00
|
|
|
|
File.Delete(sourcePath);
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void OnClickInnerWall()
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnClickCapture()
|
|
|
|
|
|
{
|
2025-03-11 14:03:04 +09:00
|
|
|
|
var destFilePath = StandaloneFileBrowser.SaveFilePanel("Save File", "", "", "png");
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(destFilePath))
|
2025-03-10 16:42:23 +09:00
|
|
|
|
{
|
2025-03-11 14:03:04 +09:00
|
|
|
|
ScreenCapture.CaptureScreenshot(destFilePath);
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private bool isRecordClick = false;
|
|
|
|
|
|
private void OnClickRecord()
|
|
|
|
|
|
{
|
|
|
|
|
|
isRecordClick = !isRecordClick;
|
|
|
|
|
|
if (isRecordClick)
|
|
|
|
|
|
{
|
|
|
|
|
|
StartCoroutine(PlayRecord());
|
|
|
|
|
|
capture.CameraRenderCustomResolution = new Vector2(UnityEngine.Screen.width, UnityEngine.Screen.height);
|
|
|
|
|
|
capture.StartCapture();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
StopAllCoroutines();
|
|
|
|
|
|
capture.StopCapture();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerator PlayRecord()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Image_Record_Play.gameObject.SetActive(false);
|
|
|
|
|
|
//Button_Record.image.color = isRecordClick ? ColorUtil.FromHex("#32A3FF") : ColorUtil.FromHex("FFFFFF");
|
|
|
|
|
|
while (isRecordClick)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Image_Record_Play.gameObject.SetActive(true);
|
|
|
|
|
|
yield return new WaitForSeconds(0.5f);
|
|
|
|
|
|
this.Image_Record_Play.gameObject.SetActive(false);
|
|
|
|
|
|
yield return new WaitForSeconds(0.5f);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnClickMinimap()
|
|
|
|
|
|
{
|
2025-03-13 09:41:50 +09:00
|
|
|
|
onClickMiniMap?.Invoke();
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnClickCustomView()
|
|
|
|
|
|
{
|
2025-03-14 09:21:26 +09:00
|
|
|
|
onClickCustomView?.Invoke();
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnClickDashBoard()
|
|
|
|
|
|
{
|
2025-03-12 12:04:19 +09:00
|
|
|
|
onClickDashBoard?.Invoke();
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnClickShoulderView()
|
|
|
|
|
|
{
|
2025-03-12 18:55:01 +09:00
|
|
|
|
onClickCameraView?.Invoke(ViewMode.FirstPersonView);
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnClickQuaterView()
|
|
|
|
|
|
{
|
2025-03-12 18:55:01 +09:00
|
|
|
|
onClickCameraView?.Invoke(ViewMode.PerspectiveView);
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnClickTopView()
|
|
|
|
|
|
{
|
2025-03-12 18:55:01 +09:00
|
|
|
|
onClickCameraView?.Invoke(ViewMode.TopView);
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|