using DG.Tweening;
using FGUI.Lobby_03;

namespace ChillConnect
{
    public class PayloadingUI : BaseUI
    {
        private PayloadingUICtrl ctrl;
        private PayloadingModel model;
        private com_payloading ui;
        private int times = 5;

        public PayloadingUI(PayloadingUICtrl ctrl) : base(ctrl)
        {
            uiName = UIConst.PayloadingUI;
            this.ctrl = ctrl;
        }

        protected override void SetUIInfo(UIInfo uiInfo)
        {
            uiInfo.packageName = "Lobby_03";
            uiInfo.assetName = "com_payloading";
            uiInfo.layerType = UILayerType.Popup;
            uiInfo.isNeedOpenAnim = false;
            uiInfo.isNeedCloseAnim = false;
            uiInfo.isNeedUIMask = false;
        }

        #region 生命周期
        protected override void OnInit()
        {
            //model = ModuleManager.Instance.GetModel(ModelConst.PayloadingModel) as PayloadingModel;
        }

        protected override void OnClose()
        {
        }

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

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

        protected override void OnOpen(object args)
        {
        }

        protected override void OnHide()
        {
        }

        protected override void OnDisplay(object args)
        {
        }
        #endregion

        #region 消息
        protected override void AddListener()
        {

        }
        protected override void RemoveListener()
        {

        }
        #endregion

        //初始化页面逻辑
        private void InitView()
        {
            DOVirtual.DelayedCall(times, () =>
            {
                CtrlCloseUI();
            });

        }
    }
}