using FL.FGUI;
using XGame.Framework.Asyncs;
using XGame.Framework.Loadable;
using XGame.Framework.Nodes;

namespace FL.Nodes.GameMain
{
    public class UIComponent : NodeComponent, ILoadAsyncHandle
    {
        public override void OnEnable(object intent)
        {
            Context.UI.OpenAsync(UIKeys.MainHomePanel, "打开MainHomePanel");
            Context.UI.OpenAsync(UIKeys.MainHomeBottomPanel);
            Context.UI.OpenAsync(UIKeys.CommonToastPanel);
        }
        public override void OnDisable()
        {
            Context.UI.Close(UIKeys.MainHomePanel);
            Context.UI.Close(UIKeys.MainHomeBottomPanel);
            Context.UI.Close(UIKeys.CommonToastPanel);
        }

        void ILoadAsyncHandle.OnLoadAsync(IAsyncGroup group)
        {
            Context.UI.Preload(UINestedKeys.CommonItemBase).Join(group);
        }
        void ILoadAsyncHandle.OnUnloadAsync(IAsyncGroup group)
        {
        }
    }
}