63 lines
1.7 KiB
C#
63 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using UnityEngine;
|
|
|
|
public partial class SROptions
|
|
{
|
|
[Category("瑜伽设置"), DisplayName("设置内置摄像机")]
|
|
public void SetCameraIndex()
|
|
{
|
|
var devices = WebCamTexture.devices;
|
|
if (devices.Length == 0)
|
|
{
|
|
LogPrint.Error("No camera detected!");
|
|
return;
|
|
}
|
|
GlobalData.Instance.CameraIndex++;
|
|
if (GlobalData.Instance.CameraIndex >= devices.Length)
|
|
{
|
|
GlobalData.Instance.CameraIndex = 0;
|
|
}
|
|
|
|
EventManager.Instance.Dispatch(YogaEventType.ChangeCaptureCameraDevice);
|
|
}
|
|
|
|
[Category("瑜伽设置")]
|
|
public void PrintCurrentCamera()
|
|
{
|
|
var devices = WebCamTexture.devices;
|
|
if (devices.Length == 0)
|
|
{
|
|
LogPrint.Error("No camera detected!");
|
|
return;
|
|
}
|
|
|
|
LogPrint.Warning($"Current camera: {devices[GlobalData.Instance.CameraIndex].name}");
|
|
foreach (var device in devices)
|
|
{
|
|
LogPrint.Warning($"Camera: {device.name}");
|
|
}
|
|
}
|
|
|
|
[Category("瑜伽设置")]
|
|
public void SetCameraDeviceType()
|
|
{
|
|
if (GlobalData.Instance.InputDeviceType == InputDeviceType.WebCamera)
|
|
{
|
|
GlobalData.Instance.InputDeviceType = InputDeviceType.USBCamera;
|
|
}
|
|
else
|
|
{
|
|
GlobalData.Instance.InputDeviceType = InputDeviceType.WebCamera;
|
|
}
|
|
|
|
EventManager.Instance.Dispatch(YogaEventType.ChangeCaptureCameraDevice);
|
|
}
|
|
|
|
[Category("瑜伽设置"), DisplayName("动作捕捉开关")]
|
|
public void OnOffEstimationDebugMode()
|
|
{
|
|
GlobalData.Instance.IsEstimationDebugMode = !GlobalData.Instance.IsEstimationDebugMode;
|
|
}
|
|
} |