using UnityEngine;
using XGame.Framework.ObjectCollection;

namespace XGame.Framework.UI
{
    /// <summary>
    /// UGUI的实现
    /// </summary>
    [DisallowMultipleComponent]
    [AddComponentMenu("XGame/UI/UIPanel")]
    public class UIPanel : MonoBehaviour, IUIPanel, IComponentGetter
    {
        [SerializeField]
        private ObjectCollector _collector = new ObjectCollector();
        [SerializeField]
        private UILayer _layer = UILayer.Normal;
        #region IUIPanel 接口实现
        public UILayer Layer => _layer;



        void IUIPanel.SetActive(bool isActive)
        {
            gameObject.SetActive(isActive);
        }
        #endregion
        T IComponentGetter.GetComponent<T>(string key)
        {
            return _collector.GetComponent<T>(key);
        }

        //#region IObjectCollector 接口实现
        //Object IObjectCollector.this[string key] => _collector[key];

        //List<string> IObjectCollector.Keys => _collector.Keys;

        //List<Object> IObjectCollector.Objects => _collector.Objects;
        //#endregion

    }
}

