using UnityEngine; using UnityEngine.UI; namespace Crosstales.UI { /// Change the state of all Window panels. [DisallowMultipleComponent] public class UIWindowManager : MonoBehaviour { #region Variables /// All Windows of the scene. [Tooltip("All Windows of the scene.")] public GameObject[] Windows; private Image image; private GameObject DontTouch; #endregion #region MonoBehaviour methods private void Start() { foreach (GameObject window in Windows) { image = window.transform.Find("Panel/Header").GetComponent(); Color c = image.color; c.a = 0.2f; image.color = c; } } #endregion #region Public methods ///Change the state of all windows. /// Active window. public void ChangeState(GameObject active) { foreach (GameObject window in Windows) { if (window != active) { image = window.transform.Find("Panel/Header").GetComponent(); Color c = image.color; c.a = 0.2f; image.color = c; } DontTouch = window.transform.Find("Panel/DontTouch").gameObject; DontTouch.SetActive(window != active); } } #endregion } } // © 2017-2023 crosstales LLC (https://www.crosstales.com)