private ZOrderTimelineState _zOrderTimeline  = null; // Initial value.

        /**
         * @private
         */
        protected override void _OnClear()
        {
            foreach (var timeline in this._boneTimelines)
            {
                timeline.ReturnToPool();
            }

            foreach (var timeline in this._slotTimelines)
            {
                timeline.ReturnToPool();
            }

            foreach (var bonePose in this._bonePoses.Values)
            {
                bonePose.ReturnToPool();
            }

            if (this._actionTimeline != null)
            {
                this._actionTimeline.ReturnToPool();
            }

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

            this.resetToPose      = false;
            this.additiveBlending = false;
            this.displayControl   = false;
            this.actionEnabled    = false;
            this.layer            = 0;
            this.playTimes        = 1;
            this.timeScale        = 1.0f;
            this.weight           = 1.0f;
            this.autoFadeOutTime  = 0.0f;
            this.fadeTotalTime    = 0.0f;
            this.name             = string.Empty;
            this.group            = string.Empty;
            this.animationData    = null; //

            this._timelineDirty = true;
            this._playheadState = 0;
            this._fadeState     = -1;
            this._subFadeState  = -1;
            this._position      = 0.0f;
            this._duration      = 0.0f;
            this._fadeTime      = 0.0f;
            this._time          = 0.0f;
            this._fadeProgress  = 0.0f;
            this._weightResult  = 0.0f;
            this._boneMask.Clear();
            this._boneTimelines.Clear();
            this._slotTimelines.Clear();
            this._bonePoses.Clear();
            this._armature       = null; //
            this._actionTimeline = null; //
            this._zOrderTimeline = null;
        }
Ejemplo 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();
        }
Ejemplo 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;
        }
Ejemplo n.º 4
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;

            _fadeState       = -1;
            _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);

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

            _updateTimelineStates();
        }
Ejemplo n.º 5
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();
        }
        /**
         * @private
         * @internal
         */
        internal void Init(Armature armature, AnimationData animationData, AnimationConfig animationConfig)
        {
            if (this._armature != null)
            {
                return;
            }

            this._armature = armature;

            this.animationData    = animationData;
            this.resetToPose      = animationConfig.resetToPose;
            this.additiveBlending = animationConfig.additiveBlending;
            this.displayControl   = animationConfig.displayControl;
            this.actionEnabled    = animationConfig.actionEnabled;
            this.layer            = animationConfig.layer;
            this.playTimes        = animationConfig.playTimes;
            this.timeScale        = animationConfig.timeScale;
            this.fadeTotalTime    = animationConfig.fadeInTime;
            this.autoFadeOutTime  = animationConfig.autoFadeOutTime;
            this.weight           = animationConfig.weight;
            this.name             = animationConfig.name.Length > 0 ? animationConfig.name : animationConfig.animation;
            this.group            = animationConfig.group;

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

            if (animationConfig.duration < 0.0f)
            {
                this._position = 0.0f;
                this._duration = this.animationData.duration;
                if (animationConfig.position != 0.0f)
                {
                    if (this.timeScale >= 0.0f)
                    {
                        this._time = animationConfig.position;
                    }
                    else
                    {
                        this._time = animationConfig.position - this._duration;
                    }
                }
                else
                {
                    this._time = 0.0f;
                }
            }
            else
            {
                this._position = animationConfig.position;
                this._duration = animationConfig.duration;
                this._time     = 0.0f;
            }

            if (this.timeScale < 0.0f && this._time == 0.0f)
            {
                this._time = -0.000001f; // Turn to end.
            }

            if (this.fadeTotalTime <= 0.0f)
            {
                this._fadeProgress = 0.999999f; // Make different.
            }

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

            this._actionTimeline = BaseObject.BorrowObject <ActionTimelineState>();
            this._actionTimeline.Init(this._armature, this, this.animationData.actionTimeline);
            this._actionTimeline.currentTime = this._time;
            if (this._actionTimeline.currentTime < 0.0f)
            {
                this._actionTimeline.currentTime = this._duration - this._actionTimeline.currentTime;
            }

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