using FairyGUI;
using FGUI.NetIdle_22;

namespace ChillConnect
{
    public class NetLoadingUI : BaseUI
    {
        private NetLoadingUICtrl ctrl;
        private NetLoadingModel model;
        private com_Netidle ui;

        public NetLoadingUI(NetLoadingUICtrl ctrl) : base(ctrl)
        {
            uiName = UIConst.NetLoadingUI;
            this.ctrl = ctrl;
        }

        protected override void SetUIInfo(UIInfo uiInfo)
        {
            uiInfo.packageName = "NetIdle_22";
            uiInfo.assetName = "com_Netidle";
            uiInfo.layerType = UILayerType.Loading;
            uiInfo.isNeedOpenAnim = false;
            uiInfo.isNeedCloseAnim = false;
            uiInfo.isNeedUIMask = true;
        }

        #region 生命周期

        protected override void OnInit()
        {

        }

        protected override void OnClose()
        {
            CommonHelper.FadeOut(ui);
        }

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

        protected override void OnOpenBefore(object args)
        {
            InitView();
        }

        protected override void OnOpen(object args)
        {
            CommonHelper.FadeIn(ui);
        }

        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.com_net_loading.loader_gameicon.texture = new NTexture(LoadKit.Instance.LoadSprite("Atlas.Game", "icon512"));
        }
    }
}