// using System.Collections.Generic; // using UnityEngine; // using UnityEngine.Serialization; // using UnityAtoms; // namespace UnityAtoms.UI // { // /// // /// A MonoBehaviour that you can add to a `CanvasGroup` and makes it transition based on a `StringVariable` value. // /// // /// **TODO**: Add support for differnt transitions. Maybe integrate with DOTween? // /// // [AddComponentMenu("Unity Atoms/UI/Container")] // public class UIContainer : MonoBehaviour, IAtomListener // { // /// // /// Variable that we listens to. // /// // [SerializeField] // private StringVariable _UIStateVariable = null; // /// // /// A list of states that this `UIContainer` will be visible for. // /// // [SerializeField] // private List _visibleForStates = null; // private void Start() // { // StateNameChanged(_UIStateVariable.Value); // } // /// // /// Handler for when the state is changed. // /// // /// // public void OnEventRaised(string stateName) // { // StateNameChanged(stateName); // } // private void StateNameChanged(string stateName) // { // if (_visibleForStates.Exists((state) => state.Value == stateName)) // { // GetComponent().alpha = 1f; // GetComponent().blocksRaycasts = true; // GetComponent().interactable = true; // } // else // { // GetComponent().alpha = 0f; // GetComponent().blocksRaycasts = false; // GetComponent().interactable = false; // } // } // private void Awake() // { // if (_UIStateVariable.Changed != null) // { // _UIStateVariable.Changed.RegisterListener(this); // } // } // private void OnDestroy() // { // if (_UIStateVariable.Changed != null) // { // _UIStateVariable.Changed.UnregisterListener(this); // } // } // } // }