Files
uDesktopDuplication/Assets/uDesktopDuplication/Examples/Scripts/ToggleMonitors.cs
2016-11-19 21:45:32 +09:00

20 lines
608 B
C#

using UnityEngine;
public class ToggleMonitors : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown(KeyCode.Tab)) {
var texture = GetComponent<uDesktopDuplication.Texture>();
var id = texture.monitorId;
var n = uDesktopDuplication.Manager.monitorCount;
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) {
texture.monitorId = (id - 1 < 0) ? 0 : (id - 1);
} else {
texture.monitorId = (id + 1 >= n) ? (n - 1) : (id + 1);
}
}
}
}