using UnityEngine;

namespace eagle {
    public class PopupCanvasController : MonoBehaviour {
        public GameObject modalBlocker;
        public GameObject panel;

        void Update() {
            bool enable = false;

            foreach (var controller in panel.GetComponentsInChildren<PopupPanelController>()) {
                bool hasInfo = controller.HasInfo;
                enable = enable || hasInfo;
                controller.gameObject.SetActive(hasInfo);
            }
            modalBlocker.SetActive(enable);
            panel.SetActive(enable);
        }

        public void SetChildActive(bool val) {
            // if (val)
            //{
            //     gameObject.SetActive(true);
            // }
            // else
            //{
            //     MainQueue.Q.EnqueueForNextUpdate(() =>
            //     {
            //         gameObject.SetActive(HasActiveChild);
            //     });
            // }
        }
    }
}