Example #1
0
        override protected void _onArriveAtFrame()
        {
            base._onArriveAtFrame();

            if (_animationState._isDisabled(slot))
            {
                _tweenEasing = DragonBones.NO_TWEEN;
                _curve       = null;
                _tweenColor  = TweenType.None;
                return;
            }

            var displayIndex = _currentFrame.displayIndex;

            if (_playState >= 0 && slot.displayIndex != displayIndex)
            {
                slot._setDisplayIndex(displayIndex);
            }

            if (displayIndex >= 0)
            {
                _tweenColor = TweenType.None;

                var currentColor = _currentFrame.color;

                if (_tweenEasing != DragonBones.NO_TWEEN || _curve != null)
                {
                    var nextFrame = _currentFrame.next;
                    var nextColor = nextFrame.color;
                    if (currentColor != nextColor)
                    {
                        _durationColor.alphaMultiplier = nextColor.alphaMultiplier - currentColor.alphaMultiplier;
                        _durationColor.redMultiplier   = nextColor.redMultiplier - currentColor.redMultiplier;
                        _durationColor.greenMultiplier = nextColor.greenMultiplier - currentColor.greenMultiplier;
                        _durationColor.blueMultiplier  = nextColor.blueMultiplier - currentColor.blueMultiplier;
                        _durationColor.alphaOffset     = nextColor.alphaOffset - currentColor.alphaOffset;
                        _durationColor.redOffset       = nextColor.redOffset - currentColor.redOffset;
                        _durationColor.greenOffset     = nextColor.greenOffset - currentColor.greenOffset;
                        _durationColor.blueOffset      = nextColor.blueOffset - currentColor.blueOffset;

                        if (
                            _durationColor.alphaMultiplier != 0.0f ||
                            _durationColor.redMultiplier != 0.0f ||
                            _durationColor.greenMultiplier != 0.0f ||
                            _durationColor.blueMultiplier != 0.0f ||
                            _durationColor.alphaOffset != 0 ||
                            _durationColor.redOffset != 0 ||
                            _durationColor.greenOffset != 0 ||
                            _durationColor.blueOffset != 0
                            )
                        {
                            _tweenColor = TweenType.Always;
                        }
                    }
                }

                if (_tweenColor == TweenType.None)
                {
                    if (
                        _slotColor.alphaMultiplier != currentColor.alphaMultiplier ||
                        _slotColor.redMultiplier != currentColor.redMultiplier ||
                        _slotColor.greenMultiplier != currentColor.greenMultiplier ||
                        _slotColor.blueMultiplier != currentColor.blueMultiplier ||
                        _slotColor.alphaOffset != currentColor.alphaOffset ||
                        _slotColor.redOffset != currentColor.redOffset ||
                        _slotColor.greenOffset != currentColor.greenOffset ||
                        _slotColor.blueOffset != currentColor.blueOffset
                        )
                    {
                        _tweenColor = TweenType.Once;
                    }
                }
            }
            else
            {
                _tweenEasing = DragonBones.NO_TWEEN;
                _curve       = null;
                _tweenColor  = TweenType.None;
            }
        }
Example #2
0
        override protected void _onArriveAtFrame(bool isUpdate)
        {
            base._onArriveAtFrame(isUpdate);

            if (_animationState._isDisabled(slot))
            {
                _tweenEasing = DragonBones.NO_TWEEN;
                _curve       = null;
                _tweenColor  = TweenType.None;
                return;
            }

            if (slot._displayDataSet != null)
            {
                var displayIndex = _currentFrame.displayIndex;
                if (slot.displayIndex >= 0 && displayIndex >= 0)
                {
                    if (slot._displayDataSet.displays.Count > 1)
                    {
                        slot._setDisplayIndex(displayIndex);
                    }
                }
                else
                {
                    slot._setDisplayIndex(displayIndex);
                }

                slot._updateMeshData(true);
            }

            if (_currentFrame.displayIndex >= 0)
            {
                _tweenColor = TweenType.None;

                var currentColor = _currentFrame.color;

                if (this._keyFrameCount > 1 && (this._tweenEasing != DragonBones.NO_TWEEN || this._curve != null))
                {
                    var nextFrame = this._currentFrame.next;
                    var nextColor = nextFrame.color;
                    if (currentColor != nextColor && nextFrame.displayIndex >= 0)
                    {
                        _durationColor.alphaMultiplier = nextColor.alphaMultiplier - currentColor.alphaMultiplier;
                        _durationColor.redMultiplier   = nextColor.redMultiplier - currentColor.redMultiplier;
                        _durationColor.greenMultiplier = nextColor.greenMultiplier - currentColor.greenMultiplier;
                        _durationColor.blueMultiplier  = nextColor.blueMultiplier - currentColor.blueMultiplier;
                        _durationColor.alphaOffset     = nextColor.alphaOffset - currentColor.alphaOffset;
                        _durationColor.redOffset       = nextColor.redOffset - currentColor.redOffset;
                        _durationColor.greenOffset     = nextColor.greenOffset - currentColor.greenOffset;
                        _durationColor.blueOffset      = nextColor.blueOffset - currentColor.blueOffset;

                        if (
                            _durationColor.alphaMultiplier != 0.0f ||
                            _durationColor.redMultiplier != 0.0f ||
                            _durationColor.greenMultiplier != 0.0f ||
                            _durationColor.blueMultiplier != 0.0f ||
                            _durationColor.alphaOffset != 0 ||
                            _durationColor.redOffset != 0 ||
                            _durationColor.greenOffset != 0 ||
                            _durationColor.blueOffset != 0
                            )
                        {
                            _tweenColor = TweenType.Always;
                        }
                    }
                }

                if (_tweenColor == TweenType.None)
                {
                    if (
                        _slotColor.alphaMultiplier != currentColor.alphaMultiplier ||
                        _slotColor.redMultiplier != currentColor.redMultiplier ||
                        _slotColor.greenMultiplier != currentColor.greenMultiplier ||
                        _slotColor.blueMultiplier != currentColor.blueMultiplier ||
                        _slotColor.alphaOffset != currentColor.alphaOffset ||
                        _slotColor.redOffset != currentColor.redOffset ||
                        _slotColor.greenOffset != currentColor.greenOffset ||
                        _slotColor.blueOffset != currentColor.blueOffset
                        )
                    {
                        _tweenColor = TweenType.Once;
                    }
                }
            }
            else
            {
                _tweenEasing = DragonBones.NO_TWEEN;
                _curve       = null;
                _tweenColor  = TweenType.None;
            }
        }