namespace BingoBrain
{
    using DG.Tweening;
    using BingoBrain.Core;
    using UnityEngine;
    using FairyGUI;

    public class CheckReadyUI : BaseUI
    {
        private CheckReadyUICtrl ctrl;
        private CheckReadyModel model;
        private FGUI.JNetIdle.com_Netidle ui;

        public CheckReadyUI(CheckReadyUICtrl ctrl) : base(ctrl)
        {
            uiName = UIConst.CheckReadyUI;
            this.ctrl = ctrl;
        }

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

        #region 生命周期

        protected override void OnInit()
        {
        }

        protected override void OnClose()
        {
        }

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

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

        protected override void OnOpen(object args)
        {
            ui.alpha = 0;
            DOTween.To(() => ui.alpha, x => ui.alpha = x, 1, 0.3f);
        }

        #endregion

        private void InitView()
        {
            // EyesHarmony.GetPicture("Atlas.Game", "ic_launcher",
            //     tx => { ui.com_net_loading.loader_gameicon.texture = tx; });

            //ui.com_net_loading.loader_gameicon.texture = new NTexture(Resources.Load<Sprite>("AssetHotFix/Atlas/Game/ic_launcher"));
        }
    }
}