/// <summary> /// 播放动画 /// </summary> /// <param name="direction"></param> /// <param name="forward"></param> public void PlayTween(AnimationOrTween.Direction direction, bool forward = true) { UIPlayTween[] tweens = CacheTransform.GetComponents <UIPlayTween>(); if (null != tweens) { foreach (UIPlayTween tween in tweens) { tween.playDirection = direction; tween.Play(forward); } } }
/// <summary> /// 播放动画 /// </summary> /// <param name="direction"></param> /// <param name="forward"></param> public void PlayTween(AnimationOrTween.Direction direction, bool forward = true) { UIPlayTween[] tweens = CacheTransform.GetComponents <UIPlayTween>(); if (null != tweens) { Vector3 pos = CacheTransform.transform.localPosition; foreach (UIPlayTween tween in tweens) { tween.playDirection = direction; if (tween.onFinished.Count <= 0) { tween.onFinished.Add(new EventDelegate(() => { CacheTransform.localPosition = pos; })); } tween.Play(forward); } } }