using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using DG.Tweening; namespace MMO { public class MMOUIPop : MMOUIBase { [SerializeField] CanvasGroup mCvsBg; [SerializeField] Button mBtnClose; private RectTransform mRctBg; protected override void OnInit() { base.OnInit(); mRctBg = mCvsBg.GetComponent(); if (mBtnClose != null) { BindBtn(mBtnClose, PopOut); } } public override void OnOpen() { base.OnOpen(); mCvsBg.alpha = 0; //mRctBg.anchoredPosition = new Vector2(0, -160); mRctBg.localScale = Vector3.zero; mCvsBg.DOFade(1, 0.3f); //mRctBg.DOAnchorPosY(0, 0.3f); mRctBg.DOScale(1, 0.3f).SetEase(Ease.OutBack); } protected void PopOut() { mCvsBg.DOFade(0, 0.3f); //mRctBg.DOAnchorPosY(-160, 0.3f).onComplete = Close; mRctBg.DOScale(0, 0.3f).SetEase(Ease.InBack).onComplete = Close; } } }