1
0
mirror of synced 2024-12-19 09:45:54 +01:00
WACVR/Assets/Script/Configuration/CaptureSettingManager.cs

59 lines
2.3 KiB
C#
Raw Normal View History

2022-10-03 02:04:54 +02:00
using TMPro;
using UnityEngine;
using uWindowCapture;
using UnityEngine.UI;
using System;
public class CaptureSettingManager : MonoBehaviour
{
public UwcWindowTexture windowTexture;
private void Start()
{
windowTexture = GetComponent<UwcWindowTexture>();
2022-11-05 01:32:17 +01:00
var modeWidget = ConfigManager.GetConfigPanelWidget("CaptureMode");
var fpsWidget = ConfigManager.GetConfigPanelWidget("CaptureFPS");
var desktopWidget = ConfigManager.GetConfigPanelWidget("CaptureDesktop");
var desktopIndexWidget = ConfigManager.GetConfigPanelWidget("DesktopIndex");
var modeDropdown = modeWidget.GetComponent<TMP_Dropdown>();
var fpsDropdown = fpsWidget.GetComponent<TMP_Dropdown>();
var desktopToggle = desktopWidget.GetComponent<Toggle>();
var desktopIndexDropdown = desktopIndexWidget.GetComponent<TMP_Dropdown>();
modeDropdown.onValueChanged.AddListener((int value) => {
windowTexture.captureMode = (CaptureMode)value - 1;
Debug.Log("CaptureFPS: " + windowTexture.captureMode);
2022-11-05 01:32:17 +01:00
});
fpsDropdown.onValueChanged.AddListener((int value) => {
var fps = Enum.GetName(typeof(CEnum.FPS), value);
windowTexture.captureFrameRate = int.Parse(fps.Remove(0, 3));
Debug.Log("CaptureFPS: " + windowTexture.captureFrameRate);
2022-11-05 01:32:17 +01:00
});
2022-10-03 02:04:54 +02:00
2022-11-05 01:32:17 +01:00
desktopToggle.onValueChanged.AddListener((bool value) => {
if (value)
{
2022-11-05 01:32:17 +01:00
windowTexture.type = WindowTextureType.Desktop;
desktopIndexDropdown.interactable = true;
}
else
{
windowTexture.type = WindowTextureType.Window;
2022-11-05 01:32:17 +01:00
desktopIndexDropdown.interactable = false;
}
Debug.Log("CaptureTarget: " + windowTexture.type);
2022-11-05 01:32:17 +01:00
});
2022-10-03 02:04:54 +02:00
2022-11-05 01:32:17 +01:00
desktopIndexDropdown.onValueChanged.AddListener((int value) => {
windowTexture.desktopIndex = value;
Debug.Log("DesktopIndex: " + windowTexture.desktopIndex);
2022-11-05 01:32:17 +01:00
});
modeDropdown.onValueChanged?.Invoke(modeDropdown.value);
fpsDropdown.onValueChanged?.Invoke(fpsDropdown.value);
desktopToggle.onValueChanged?.Invoke(desktopToggle.isOn);
desktopIndexDropdown.onValueChanged?.Invoke(desktopIndexDropdown.value);
2022-10-03 02:04:54 +02:00
}
}