
using DG.Tweening;
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;

namespace RedHotRoast
{
    public class NetworkErrorTipsUI : BaseUI
    {
        private NetworkErrorTipsUICtrl ctrl;
        private NetworkErrorTipsModel model;
        private FGUI.ZM_Toast_23.com_net_tips ui;

        public NetworkErrorTipsUI(NetworkErrorTipsUICtrl ctrl) : base(ctrl)
        {
            uiName = UIConst.NetworkErrorTipsUI;
            this.ctrl = ctrl;
        }

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

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

        protected override void OnClose()
        {
            _tween.Kill();
            _tween = null;
        }

        protected override void OnBind()
        {
            ui = baseUI as FGUI.ZM_Toast_23.com_net_tips;
        }

        protected override void OnOpenBefore(object 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 Tween _tween;
        //初始化页面逻辑
        private void InitView()
        {
            _tween = DOVirtual.DelayedCall(10f, () =>
            {
                ui.state.selectedIndex = 1;
            });
        }
    }
}