using System;
using DG.Tweening;
using FGUI.ZM_Login_05;
using UnityEngine;

namespace RedHotRoast
{

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

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

        protected override void SetUIInfo(UIInfo uiInfo)
        {
            uiInfo.packageName = "ZM_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 FGUI.ZM_Common_01.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();
            });
        }

    }
}