Esempio n. 1
0
        /**
         * @private
         */
        internal void _fadeIn(
            Armature armature, AnimationData clip, string animationName,
            uint playTimes, float position, float duration, float time, float timeScale, float fadeInTime,
            bool pausePlayhead
            )
        {
            _armature      = armature;
            _animationData = clip;
            _name          = animationName;

            actionEnabled  = stateActionEnabled;
            this.playTimes = playTimes;
            this.timeScale = timeScale;
            fadeTotalTime  = fadeInTime;

            _position        = position;
            _duration        = duration;
            _time            = time;
            _isPausePlayhead = pausePlayhead;
            if (fadeTotalTime <= 0.0f)
            {
                _fadeProgress = 0.999999f;
            }

            _timeline = BaseObject.BorrowObject <AnimationTimelineState>();
            _timeline.FadeIn(_armature, this, _animationData, _time);

            _updateTimelineStates();
        }
Esempio n. 2
0
        /**
         * @inheritDoc
         */
        override protected void _onClear()
        {
            foreach (var boneTimelineState in _boneTimelines)
            {
                boneTimelineState.ReturnToPool();
            }

            foreach (var slotTimelineState in _slotTimelines)
            {
                slotTimelineState.ReturnToPool();
            }

            foreach (var ffdTimelineState in _ffdTimelines)
            {
                ffdTimelineState.ReturnToPool();
            }

            if (_timeline != null)
            {
                _timeline.ReturnToPool();
            }

            if (_zOrderTimeline != null)
            {
                _zOrderTimeline.ReturnToPool();
            }

            displayControl   = true;
            additiveBlending = false;
            actionEnabled    = false;
            playTimes        = 1;
            timeScale        = 1.0f;
            weight           = 1.0f;
            autoFadeOutTime  = -1.0f;
            fadeTotalTime    = 0.0f;

            _fadeState    = 0;
            _layer        = 0;
            _position     = 0.0f;
            _duration     = 0.0f;
            _weightResult = 0.0f;
            _fadeProgress = 0.0f;
            _group        = null;
            _timeline     = null;

            _isPlaying       = true;
            _isPausePlayhead = false;
            _fadeTime        = 0.0f;
            _time            = 0.0f;
            _name            = null;
            _armature        = null;
            _animationData   = null;
            _zOrderTimeline  = null;
            _boneMask.Clear();
            _boneTimelines.Clear();
            _slotTimelines.Clear();
            _ffdTimelines.Clear();
        }
Esempio n. 3
0
        /**
         * @private
         */
        override protected void _onClear()
        {
            for (int i = 0, l = _boneTimelines.Count; i < l; ++i)
            {
                _boneTimelines[i].ReturnToPool();
            }

            for (int i = 0, l = _slotTimelines.Count; i < l; ++i)
            {
                _slotTimelines[i].ReturnToPool();
            }

            for (int i = 0, l = _ffdTimelines.Count; i < l; ++i)
            {
                _ffdTimelines[i].ReturnToPool();
            }

            if (_timeline != null)
            {
                _timeline.ReturnToPool();
            }

            if (_zOrderTimeline != null)
            {
                _zOrderTimeline.ReturnToPool();
            }

            displayControl   = true;
            additiveBlending = false;
            actionEnabled    = false;
            playTimes        = 1;
            timeScale        = 1.0f;
            weight           = 1.0f;
            autoFadeOutTime  = -1.0f;
            fadeTotalTime    = 0.0f;

            _playheadState = 0;
            _fadeState     = -1;
            _subFadeState  = -1;
            _layer         = 0;
            _position      = 0.0f;
            _duration      = 0.0f;
            _fadeTime      = 0.0f;
            _time          = 0.0f;
            _fadeProgress  = 0.0f;
            _weightResult  = 0.0f;
            _name          = null;
            _group         = null;
            _boneMask.Clear();
            _boneTimelines.Clear();
            _slotTimelines.Clear();
            _ffdTimelines.Clear();
            _animationData  = null;
            _armature       = null;
            _timeline       = null;
            _zOrderTimeline = null;
        }
 static int setCurrentTime(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DragonBones.AnimationTimelineState obj = (DragonBones.AnimationTimelineState)ToLua.CheckObject(L, 1, typeof(DragonBones.AnimationTimelineState));
         float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.setCurrentTime(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 5
0
        override protected void _onClear()
        {
            _playState        = -1;
            _currentPlayTimes = 0;
            _currentTime      = -1.0f;
            _timelineData     = null;

            _frameRate         = 0;
            _keyFrameCount     = 0;
            _frameCount        = 0;
            _position          = 0.0f;
            _duration          = 0.0f;
            _animationDutation = 0.0f;
            _timeScale         = 1.0f;
            _timeOffset        = 0.0f;
            _currentFrame      = null;
            _armature          = null;
            _animationState    = null;
            _mainTimeline      = null;
        }
Esempio n. 6
0
        virtual public void _init(Armature armature, AnimationState animationState, M timelineData)
        {
            _armature       = armature;
            _animationState = animationState;
            _timelineData   = timelineData;
            _mainTimeline   = _animationState._timeline;

            if (this == (object)_mainTimeline)
            {
                _mainTimeline = null;
            }

            _frameRate         = _armature.armatureData.frameRate;
            _keyFrameCount     = (uint)_timelineData.frames.Count;
            _frameCount        = _animationState.animationData.frameCount;
            _position          = _animationState._position;
            _duration          = _animationState._duration;
            _animationDutation = _animationState.animationData.duration;
            _timeScale         = _mainTimeline == null ? 1.0f : (1.0f / _timelineData.scale);
            _timeOffset        = _mainTimeline == null ? 0.0f : _timelineData.offset;
        }
    static int _CreateDragonBones_AnimationTimelineState(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                DragonBones.AnimationTimelineState obj = new DragonBones.AnimationTimelineState();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: DragonBones.AnimationTimelineState.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 8
0
        /**
         * @private
         */
        internal void _init(Armature armature, AnimationData animationData, AnimationConfig animationConfig)
        {
            _armature      = armature;
            _animationData = animationData;
            _name          = !string.IsNullOrEmpty(animationConfig.name) ? animationConfig.name : animationConfig.animationName;

            actionEnabled    = animationConfig.actionEnabled;
            additiveBlending = animationConfig.additiveBlending;
            displayControl   = animationConfig.displayControl;
            playTimes        = (uint)animationConfig.playTimes;
            timeScale        = animationConfig.timeScale;
            fadeTotalTime    = animationConfig.fadeInTime;
            autoFadeOutTime  = animationConfig.autoFadeOutTime;
            weight           = animationConfig.weight;

            if (animationConfig.pauseFadeIn)
            {
                _playheadState = 2; // 10
            }
            else
            {
                _playheadState = 3; // 11
            }

            _fadeState    = -1;
            _subFadeState = -1;
            _layer        = animationConfig.layer;
            _time         = animationConfig.position;
            _group        = animationConfig.group;

            if (animationConfig.duration < 0.0f)
            {
                _position = 0.0f;
                _duration = _animationData.duration;
            }
            else
            {
                _position = animationConfig.position;
                _duration = animationConfig.duration;
            }

            if (fadeTotalTime <= 0.0f)
            {
                _fadeProgress = 0.999999f;
            }

            if (animationConfig.boneMask.Count > 0)
            {
                DragonBones.ResizeList(_boneMask, animationConfig.boneMask.Count, null);
                for (int i = 0, l = _boneMask.Count; i < l; ++i)
                {
                    _boneMask[i] = animationConfig.boneMask[i];
                }
            }

            _timeline = BaseObject.BorrowObject <AnimationTimelineState>();
            _timeline._init(_armature, this, _animationData);

            if (_animationData.zOrderTimeline != null)
            {
                _zOrderTimeline = BaseObject.BorrowObject <ZOrderTimelineState>();
                _zOrderTimeline._init(_armature, this, _animationData.zOrderTimeline);
            }

            _updateTimelineStates();
        }