using BingoBrain.Core;
using BingoBrain.HotFix;
using FGUI.ACommon;
using UnityEngine;

namespace BingoBrain
{
    public class LoginAUI : BaseUI
    {
        private LoginAUICtrl ctrl;
        private LoginAModel model;
        private FGUI.JLoading.com_login_a ui;

        public LoginAUI(LoginAUICtrl ctrl) : base(ctrl)
        {
            uiName = UIConst.LoginAUI;
            this.ctrl = ctrl;
        }

        protected override void SetUIInfo(UIInfo uiInfo)
        {
            uiInfo.packageName = "JLoading";
            uiInfo.assetName = "com_login_a";
            uiInfo.layerType = UILayerType.Normal;
            uiInfo.isNeedOpenAnim = false;
            uiInfo.isNeedCloseAnim = false;
            uiInfo.isNeedUIMask = true;
        }

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

        protected override void OnClose()
        {
        }

        protected override void OnBind()
        {
            ui = baseUI as FGUI.JLoading.com_login_a;
        }

        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()
        {
            AppDispatcher.Instance.AddListener(CsjInfoC.Show_uid, Show_uid);
        }
        protected override void RemoveListener()
        {
            AppDispatcher.Instance.RemoveListener(CsjInfoC.Show_uid, Show_uid);
        }
        void Show_uid(object a = null)
        {
            ui.text_uid.text = "uid" + GameHelper.GetLoginModel().uid;
        }
        #endregion

        //初始化页面逻辑
        private void InitView()
        {

        }
    }
}