Ejemplo n.º 1
0
        public virtual void Init(Armature armature, AnimationState animationState, TimelineData timelineData)
        {
            this._armature       = armature;
            this._animationState = animationState;
            this._timelineData   = timelineData;
            this._actionTimeline = this._animationState._actionTimeline;

            if (this == this._actionTimeline)
            {
                this._actionTimeline = null; //
            }

            this._frameRate       = this._armature.armatureData.frameRate;
            this._frameRateR      = 1.0f / this._frameRate;
            this._position        = this._animationState._position;
            this._duration        = this._animationState._duration;
            this._dragonBonesData = this._armature.armatureData.parent;
            this._animationData   = this._animationState._animationData;

            if (this._timelineData != null)
            {
                this._frameIntArray   = this._dragonBonesData.frameIntArray;
                this._frameFloatArray = this._dragonBonesData.frameFloatArray;
                this._frameArray      = this._dragonBonesData.frameArray;
                this._timelineArray   = this._dragonBonesData.timelineArray;
                this._frameIndices    = this._dragonBonesData.frameIndices.ToArray();

                this._frameCount       = this._timelineArray[this._timelineData.offset + (int)BinaryOffset.TimelineKeyFrameCount];
                this._frameValueOffset = this._timelineArray[this._timelineData.offset + (int)BinaryOffset.TimelineFrameValueOffset];
                var timelineScale = this._timelineArray[this._timelineData.offset + (int)BinaryOffset.TimelineScale];
                this._timeScale  = 100.0f / (timelineScale == 0 ? 100.0f : timelineScale);
                this._timeOffset = this._timelineArray[this._timelineData.offset + (int)BinaryOffset.TimelineOffset] * 0.01f;
            }
        }
Ejemplo n.º 2
0
        protected override void _OnClear()
        {
            this.playState        = -1;
            this.currentPlayTimes = -1;
            this.currentTime      = -1.0f;

            this._tweenState       = TweenState.None;
            this._frameRate        = 0;
            this._frameValueOffset = 0;
            this._frameCount       = 0;
            this._frameOffset      = 0;
            this._frameIndex       = -1;
            this._frameRateR       = 0.0f;
            this._position         = 0.0f;
            this._duration         = 0.0f;
            this._timeScale        = 1.0f;
            this._timeOffset       = 0.0f;
            this._dragonBonesData  = null; //
            this._animationData    = null; //
            this._timelineData     = null; //
            this._armature         = null; //
            this._animationState   = null; //
            this._actionTimeline   = null; //
            this._frameArray       = null; //
            this._frameIntArray    = null; //
            this._frameFloatArray  = null; //
            this._timelineArray    = null; //
            this._frameIndices     = null; //
        }
Ejemplo n.º 3
0
        /** @private */
        public void arriveAtFrame(Frame frame, TimelineState timelineState, AnimationState animationState, bool isCross)
        {
            if (frame.Evt != null && this.HasEventListener(FrameEvent.ANIMATION_FRAME_EVENT))
            {
                FrameEvent frameEvent = new FrameEvent(FrameEvent.ANIMATION_FRAME_EVENT);
                frameEvent.AnimationState = animationState;
                frameEvent.FrameLabel     = frame.Evt;
                _eventList.Add(frameEvent);
            }

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

            if (frame.Action != null)
            {
                if (animationState.IsPlaying)
                {
                    Animation.GotoAndPlay(frame.Action);
                }
            }
        }
Ejemplo n.º 4
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);
                }
            }
        }
Ejemplo n.º 5
0
 static int Update(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DragonBones.TimelineState <DragonBones.AnimationFrameData, DragonBones.AnimationData> obj = (DragonBones.TimelineState <DragonBones.AnimationFrameData, DragonBones.AnimationData>)ToLua.CheckObject(L, 1, typeof(DragonBones.TimelineState <DragonBones.AnimationFrameData, DragonBones.AnimationData>));
         float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.Update(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 6
0
 static int FadeOut(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         DragonBones.TimelineState <DragonBones.AnimationFrameData, DragonBones.AnimationData> obj = (DragonBones.TimelineState <DragonBones.AnimationFrameData, DragonBones.AnimationData>)ToLua.CheckObject(L, 1, typeof(DragonBones.TimelineState <DragonBones.AnimationFrameData, DragonBones.AnimationData>));
         obj.FadeOut();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 7
0
 static int _init(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         DragonBones.TimelineState <DragonBones.AnimationFrameData, DragonBones.AnimationData> obj = (DragonBones.TimelineState <DragonBones.AnimationFrameData, DragonBones.AnimationData>)ToLua.CheckObject(L, 1, typeof(DragonBones.TimelineState <DragonBones.AnimationFrameData, DragonBones.AnimationData>));
         DragonBones.Armature       arg0 = (DragonBones.Armature)ToLua.CheckObject(L, 2, typeof(DragonBones.Armature));
         DragonBones.AnimationState arg1 = (DragonBones.AnimationState)ToLua.CheckObject(L, 3, typeof(DragonBones.AnimationState));
         DragonBones.AnimationData  arg2 = (DragonBones.AnimationData)ToLua.CheckObject(L, 4, typeof(DragonBones.AnimationData));
         obj._init(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }