Ejemplo n.º 1
0
        /** @private */
        public void arriveAtFrame(Frame frame, TimelineState timelineState, AnimationState animationState, bool isCross)
        {
            if (frame != null)
            {
                int mixingType = animationState.GetMixingTransform(Name);
                if (animationState.DisplayControl && (mixingType == 2 || mixingType == -1))
                {
                    if (
                        DisplayController == null || DisplayController == animationState.Name
                        )
                    {
                        TransformFrame tansformFrame = frame as TransformFrame;
                        if (_slot != null)
                        {
                            int displayIndex = tansformFrame.DisplayIndex;
                            if (displayIndex >= 0)
                            {
                                if (!float.IsNaN(tansformFrame.ZOrder) && tansformFrame.ZOrder != _slot._tweenZorder)
                                {
                                    _slot._tweenZorder = tansformFrame.ZOrder;
                                    this._armature._slotsZOrderChanged = true;
                                }
                            }
                            _slot.changeDisplay(displayIndex);
                            _slot.updateVisible(tansformFrame.Visible);
                        }
                    }
                }

                if (frame.Evt != null && this._armature.HasEventListener(FrameEvent.BONE_FRAME_EVENT))
                {
                    FrameEvent frameEvent = new FrameEvent(FrameEvent.BONE_FRAME_EVENT);
                    frameEvent.Bone           = this;
                    frameEvent.AnimationState = animationState;
                    frameEvent.FrameLabel     = frame.Evt;
                    this._armature._eventList.Add(frameEvent);
                }

                if (frame.Sound != null && _soundManager.HasEventListener(SoundEvent.SOUND))
                {
                    SoundEvent soundEvent = new SoundEvent(SoundEvent.SOUND);
                    soundEvent.Armature       = this._armature;
                    soundEvent.AnimationState = animationState;
                    soundEvent.Sound          = frame.Sound;
                    _soundManager.DispatchEvent(soundEvent);
                }

                if (frame.Action != null)
                {
                    foreach (DBObject child in _children)
                    {
                        if (child is Slot)
                        {
                            Armature childArmature = (child as Slot).ChildArmature;
                            if (childArmature != null)
                            {
                                childArmature.Animation.GotoAndPlay(frame.Action);
                            }
                        }
                    }
                }
            }
            else
            {
                if (_slot != null)
                {
                    _slot.changeDisplay(-1);
                }
            }
        }