47 lines
956 B
C#
47 lines
956 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CheatsHotkeys : MonoBehaviour
|
|
{
|
|
private readonly List<Window> _windows = new List<Window>(10);
|
|
|
|
private void Awake()
|
|
{
|
|
#if !UNITY_EDITOR
|
|
Destroy(this);
|
|
#endif
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
ToggleUI();
|
|
}
|
|
|
|
private void ToggleUI()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Space))
|
|
{
|
|
bool hasClosedWindows = _windows.Count > 0;
|
|
|
|
if (UI.GetVisibleStack().Count > 0)
|
|
_windows.Clear();
|
|
|
|
if (hasClosedWindows)
|
|
{
|
|
foreach (var window in _windows)
|
|
window.Show();
|
|
|
|
_windows.Clear();
|
|
}
|
|
else
|
|
{
|
|
_windows.AddRange(UI.GetVisibleStack());
|
|
|
|
foreach (Window window in _windows)
|
|
window.Hide();
|
|
}
|
|
}
|
|
}
|
|
}
|