using Fort23.Mono;
using UnityEngine;

namespace Mono
{
    public class UICom : UIBasic
    {
        public override void SetUIRoot(GameObject root)
        {
            base.Root = root;
            UIData = Root.GetComponent<ReferenceCollector>();
            GetUIData();
            AddButtonEvent();
        }

        public override void GetUIData()
        {
            
        }

        public override void AddButtonEvent()
        {
        }

        public override void AddEvent()
        {
        }

        public override void DelEvent()
        {
        }

        public override void Show()
        {
            Root.gameObject.SetActive(true);
            IsShow = true;
            AddEvent();
        }

        public override void Hide()
        {
            Root.gameObject.SetActive(false);
            IsShow = false;
            DelEvent();
        }

        public override void Dispose()
        {
            Hide();

            foreach (var keyValuePair in AllUICom)
            {
                foreach (var uiCom in keyValuePair.Value)
                {
                    uiCom.Dispose();
                }
            }

            Object.Destroy(Root);
        }
    }
}