Ejemplo n.º 1
0
        private void OnNextStep()
        {
            _skeletonGraphic.AnimationState.ClearTracks();
            _skeletonGraphic.Skeleton.SetToSetupPose();

            List <SpinePlayableVo> currentPlayableList = new List <SpinePlayableVo>();

            _currentIndex++;

            if (_currentIndex >= _playableList.Count)
            {
                //End
                return;
            }

            int playIndex = _playableList[_currentIndex].playIndex;

            //找到同一个播放序列的Playable
            for (int i = _currentIndex; i < _playableList.Count; i++)
            {
                SpinePlayableVo playable = _playableList[i];

                if (playable.playIndex != playIndex)
                {
                    break;
                }

                currentPlayableList.Add(playable);
                _currentIndex = i;
            }

            PlaySequence(currentPlayableList);
        }
Ejemplo n.º 2
0
        public void Play()
        {
            _skeletonGraphic.Skeleton.SetToSetupPose();
            _skeletonGraphic.AnimationState.ClearTracks();

            _currentIndex  = 0;
            _lastPlayIndex = -1;

            List <SpinePlayableVo> currentPlayableList = new List <SpinePlayableVo>();

            //找到同一个播放序列的Playable
            for (int i = 0; i < _playableList.Count; i++)
            {
                SpinePlayableVo playable = _playableList[i];


                if (_lastPlayIndex == -1)
                {
                    _lastPlayIndex = playable.playIndex;
                }

                if (playable.playIndex != _lastPlayIndex)
                {
                    break;
                }

                currentPlayableList.Add(playable);
                _currentIndex = i;
            }

            PlaySequence(currentPlayableList);
        }
Ejemplo n.º 3
0
        public SpinePlay(int trackIndex, SpinePlayableVo playableVo, SkeletonGraphic skeletonGraphic,
                         Action playNextAction)
        {
            _isStop          = false;
            _trackIndex      = trackIndex;
            _playNextAction  = playNextAction;
            _skeletonGraphic = skeletonGraphic;

            _playableVo = playableVo;

            _trackEntry = _skeletonGraphic.AnimationState.SetAnimation(_trackIndex, playableVo.animationName, true);
            if (_trackEntry.Animation.Name.Contains("toufa_"))
            {
                _trackEntry.TrackTime = HairTrackTime;
            }

            _trackEntry.TimeScale = _playableVo.speed;
            _trackEntry.Delay     = playableVo.delay;

            CurrentTime = 0;

            if (_playableVo.PlayableType == PlayableType.ByCount)
            {
                CurrentCount          = 0;
                _trackEntry.Complete += OnCount;
            }
        }
Ejemplo n.º 4
0
 private void PlaySequence(List <SpinePlayableVo> list)
 {
     _sequence = new List <SpinePlay>();
     for (int i = 0; i < list.Count; i++)
     {
         SpinePlayableVo playable = list[i];
         SpinePlay       play     = new SpinePlay(i, playable, _skeletonGraphic, OnNextStep);
         _sequence.Add(play);
     }
 }