
using FGUI.A000_common;
using UnityEngine;
using FairyGUI;
using Roy.Datas;
using SGame;

namespace ScrewsMaster
{
    public class TipsUI : BaseUI
    {
        private TipsUICtrl ctrl;
        private PropModel model;
        private FGUI.G003_play.Com_LoginFailurePopup ui;
        private int type;
        private int num;

        private PropViewData _data;

        public TipsUI(TipsUICtrl ctrl) : base(ctrl)
        {
            uiName = UIConst.PropUI;
            this.ctrl = ctrl;
        }

        protected override void SetUIInfo(UIInfo uiInfo)
        {
            uiInfo.packageName = "G003_play";
            uiInfo.assetName = "Com_LoginFailurePopup";
            uiInfo.layerType = UILayerType.NetworkError;
            uiInfo.isNeedOpenAnim = true;
            uiInfo.isNeedCloseAnim = true;
            uiInfo.isNeedUIMask = false;
        }

        #region 生命周期
        protected override void OnInit()
        {
        }

        protected override void OnClose()
        {
        }

        protected override void OnBind()
        {
            ui = baseUI as FGUI.G003_play.Com_LoginFailurePopup;
        }

        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 void InitView()
        {
            ui.btn_close.visible = false;
            ui.btn_Login.onClick.Add(() =>
            {
                NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
                ctrl.CloseUI();
            });
            ui.btn_close.onClick.Add(() => {
                this.ctrl.CloseUI();
            });
        }
    }
}