mirror of
https://github.com/xiaopeng12138/MaiDXR.git
synced 2024-12-18 11:55:52 +01:00
33 lines
780 B
C#
33 lines
780 B
C#
using UnityEngine;
|
|
|
|
namespace uWindowCapture
|
|
{
|
|
|
|
public class UwcAltTabWindowTextureManager : UwcWindowTextureManager
|
|
{
|
|
void Start()
|
|
{
|
|
UwcManager.onWindowAdded.AddListener(OnWindowAdded);
|
|
UwcManager.onWindowRemoved.AddListener(OnWindowRemoved);
|
|
|
|
foreach (var pair in UwcManager.windows) {
|
|
OnWindowAdded(pair.Value);
|
|
}
|
|
}
|
|
|
|
void OnWindowAdded(UwcWindow window)
|
|
{
|
|
if (window.parentWindow != null) return; // handled by UwcWindowTextureChildrenManager
|
|
if (!window.isVisible || !window.isAltTabWindow || window.isBackground) return;
|
|
|
|
window.RequestCapture();
|
|
AddWindowTexture(window);
|
|
}
|
|
|
|
void OnWindowRemoved(UwcWindow window)
|
|
{
|
|
RemoveWindowTexture(window);
|
|
}
|
|
}
|
|
|
|
} |