
using System;
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
using Spine.Unity;

namespace RedHotRoast
{
    public class ScAlbumLockUI : BaseUI
    {
        private ScAlbumLockUICtrl ctrl;
        private ScAlbumLockModel model;
        private FGUI.LG_Unlock.com_scAlbumLock ui;

        public ScAlbumLockUI(ScAlbumLockUICtrl ctrl) : base(ctrl)
        {
            uiName = UIConst.ScAlbumLockUI;
            this.ctrl = ctrl;
        }

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

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

        protected override void OnClose()
        {
        }

        protected override void OnBind()
        {
            ui = baseUI as FGUI.LG_Unlock.com_scAlbumLock;
        }

        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()
        {
            Action closeCallBack = null;
            var prop_effect = FXManager.Instance.SetFx<SkeletonAnimation>(ui.anim, Fx_Type.fx_secret_girl, ref closeCallBack);
            prop_effect.state.SetAnimation(0, "animation", true);
            ui.btn_close.SetClick(() =>
            {
                CtrlCloseUI();
            });
            ui.text_unlock.SetVar("num", GameHelper.GetCommonModel().UnlockSecret[1].ToString()).FlushVars();
        }
    }
}