示例#1
0
        /// <summary>
        /// 播放一个补间动画
        /// </summary>
        /// <param name="tweenChain">补间根节点</param>
        /// <param name="safeObject">安全游戏对象:如果安全游戏对象被销毁,补间动画会自动终止</param>
        /// <param name="groupID">补间组ID</param>
        /// <returns>补间动画唯一ID</returns>
        public long Play(ITweenChain tweenChain, UnityEngine.Object safeObject = null, int groupID = 0)
        {
            ITweenNode tweenRoot = tweenChain as ITweenNode;

            if (tweenRoot == null)
            {
                throw new System.InvalidCastException();
            }

            return(Play(tweenRoot, safeObject, groupID));
        }
示例#2
0
 private bool Contains(ITweenNode tweenRoot)
 {
     for (int i = 0; i < _wrappers.Count; i++)
     {
         var wrapper = _wrappers[i];
         if (wrapper.TweenRoot == tweenRoot)
         {
             return(true);
         }
     }
     return(false);
 }
        public override void OnRefresh()
        {
            // 窗口打开动画
            if (_isPlayOpenAnimation == false)
            {
                _isPlayOpenAnimation = true;
                ITweenNode tween = ParallelNode.Allocate(
                    _animRectTrans.transform.TweenScaleTo(0.8f, Vector3.one).SetEase(TweenEase.Bounce.EaseOut),
                    _animRectTrans.transform.TweenAnglesTo(0.4f, new Vector3(0, 0, 720))
                    );
                TweenGrouper.Play(tween);
            }

            // 闪烁动画
            TweenGrouper.Play(_animImg.TweenColor(0.5f, Color.green, Color.red).SetLoop(ETweenLoop.PingPong));
        }
示例#4
0
        /// <summary>
        /// 创建补间动画
        /// </summary>
        /// <param name="tweenRoot">补间根节点</param>
        /// <param name="safeObject">安全游戏对象:如果安全游戏对象被销毁,补间动画会自动终止</param>
        /// <param name="groupID">补间组ID</param>
        /// <returns>补间动画唯一ID</returns>
        private long CreateTween(ITweenNode tweenRoot, UnityEngine.Object safeObject, int groupID = 0)
        {
            if (tweenRoot == null)
            {
                MotionLog.Warning("Tween root is null.");
                return(-1);
            }

            if (Contains(tweenRoot))
            {
                MotionLog.Warning("Tween root is running.");
                return(-1);
            }

            long         tweenUID = ++StaticTweenUID;
            TweenWrapper wrapper  = new TweenWrapper(groupID, tweenUID, tweenRoot, safeObject);

            _wrappers.Add(wrapper);
            return(wrapper.TweenUID);
        }
示例#5
0
        protected override void UpdateChain(float deltaTime)
        {
            if (_selectNode == null)
            {
                if (_nodes.Count > 0)
                {
                    int index = UnityEngine.Random.Range(0, _nodes.Count);
                    _selectNode = _nodes[index];
                }
                else
                {
                    IsDone = true;
                }
            }

            if (_selectNode != null)
            {
                _selectNode.OnUpdate(deltaTime);
                IsDone = _selectNode.IsDone;
            }
        }
示例#6
0
        void ITweenNode.OnUpdate()
        {
            if (_selectNode == null)
            {
                if (_nodes.Count > 0)
                {
                    int index = UnityEngine.Random.Range(0, _nodes.Count);
                    _selectNode = _nodes[index];
                }
                else
                {
                    IsDone = true;
                }
            }

            if (_selectNode != null)
            {
                _selectNode.OnUpdate();
                IsDone = _selectNode.IsDone;
            }
        }
示例#7
0
        /// <summary>
        /// 播放一个补间动画
        /// </summary>
        public long Play(ITweenNode tweenRoot, UnityEngine.Object safeObject = null)
        {
            int groupID = this.GetHashCode();

            return(TweenManager.Instance.Play(tweenRoot, safeObject, groupID));
        }
示例#8
0
 ITweenChain ITweenChain.Append(ITweenNode node)
 {
     AddNode(node);
     return(this);
 }
示例#9
0
 /// <summary>
 /// 添加节点
 /// </summary>
 public static ITweenChain Append(this ITweenChain chain, ITweenNode node)
 {
     return(chain.Append(node));
 }
 public static long PlayTween(this GameObject go, ITweenNode tween)
 {
     return(TweenManager.Instance.Play(tween, go));
 }