using System;
using FGUI.Common_01;

namespace ChillConnect
{

    public class TipsViewUI : BaseUI
    {
        private TipsViewUICtrl ctrl;
        private TipsViewModel model;
        private com_tips ui;

        public TipsViewUI(TipsViewUICtrl ctrl) : base(ctrl)
        {
            uiName = UIConst.TipsViewUI;
            this.ctrl = ctrl;
        }

        protected override void SetUIInfo(UIInfo uiInfo)
        {
            uiInfo.packageName = "Common_01";
            uiInfo.assetName = "com_tips";
            uiInfo.layerType = UILayerType.Loading;
        }

        protected override void OnInit()
        {
        }

        protected override void OnClose()
        {
            CommonHelper.FadeOut(ui);
        }

        protected override void OnBind()
        {
            ui = baseUI as com_tips;
        }

        protected override void OnOpenBefore(object args)
        {
            if (args != null)
            {
                InitView((Action)args);
            }
        }

        protected override void OnOpen(object args)
        {
            CommonHelper.FadeIn(ui);
        }

        protected override void AddListener()
        {
        }

        protected override void RemoveListener()
        {
        }

        private void InitView(Action callback)
        {

            ui.btn_relog.SetClick(() =>
            {

                callback?.Invoke();
                CtrlCloseUI();
            });
        }

    }
}