1
0
mirror of synced 2024-12-19 01:35:53 +01:00
WACVR/Assets/Script/Configuration/CaptureSettingManager.cs
2022-10-03 02:04:54 +02:00

35 lines
1.0 KiB
C#

using TMPro;
using UnityEngine;
using uWindowCapture;
using UnityEngine.UI;
using System;
public class CaptureSettingManager : MonoBehaviour
{
public UwcWindowTexture windowTexture;
private void Start()
{
windowTexture = GetComponent<UwcWindowTexture>();
ConfigManager.onConfigChanged += ApplyConfig;
ConfigManager.EnsureInitialization();
ApplyConfig();
}
private void ApplyConfig()
{
windowTexture.captureMode = (CaptureMode)ConfigManager.config.CaptureMode - 1;
var fps = Enum.GetName(typeof(Config.captureFPS), ConfigManager.config.CaptureFPS);
windowTexture.captureFrameRate = int.Parse(fps.Remove(0, 3));
if (ConfigManager.config.CaptureDesktop)
{
windowTexture.type = WindowTextureType.Desktop;
windowTexture.desktopIndex = ConfigManager.config.CaptureDesktopNumber;
}
else
windowTexture.type = WindowTextureType.Window;
windowTexture.desktopIndex = ConfigManager.config.CaptureDesktopNumber;
}
}