using Thousandto.Core.Base; using System.Collections.Generic; using UnityEngine; namespace Thousandto.Plugins.Common { public class UIAnimationTrans { #region//私有变量 //回调函数 private MyAction _finishCallBack = null; //操作的对象 private Transform _handleTrans = null; //动画列表 private List _animList = new List(); //hide动画结束后是否隐藏节点 private bool _hideGo = true; #endregion #region//属性 public Transform HandleTrans { get { return _handleTrans; } set { _handleTrans = value; } } public MyAction FinishCallBack { get { return _finishCallBack; } set { _finishCallBack = value; } } public bool IsFinish { get { return _animList.Count <= 0; } } public bool HideGo { get { return _hideGo; } set { _hideGo = value; } } #endregion #region//函数 public void Update() { if (IsFinish) return; for (int i = _animList.Count - 1; i >= 0; --i) { _animList[i].Update(); if(_animList[i].IsFinish) { _animList.RemoveAt(i); } } if(_animList.Count <= 0) { if(_finishCallBack != null) { _finishCallBack(); } } } public void AddAnim(UIAnimationBase anim) { if (_animList.Contains(anim)) return; anim.HandleTrans = _handleTrans; anim.Start(); _animList.Add(anim); } #endregion } }