1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-12-18 11:55:52 +01:00
MaiDXR/Assets/uWindowCapture/Samples/Horizontal Layout/UwcHorizontalLayouter.cs
2022-01-05 19:44:30 +01:00

30 lines
678 B
C#

using UnityEngine;
namespace uWindowCapture
{
[RequireComponent(typeof(UwcWindowTextureManager))]
public class UwcHorizontalLayouter : MonoBehaviour
{
UwcWindowTextureManager manager_;
void Awake()
{
manager_ = GetComponent<UwcWindowTextureManager>();
}
void Update()
{
var pos = Vector3.zero;
foreach (var kv in manager_.windows) {
var windowTexture = kv.Value;
var width = windowTexture.transform.localScale.x;
pos += new Vector3(width * 0.5f, 0f, 0f);
windowTexture.transform.localPosition = pos;
pos += new Vector3(width * 0.5f, 0f, 0f);
}
}
}
}