Ejemplo n.º 1
0
        override public void Apply()
        {
            GearColorValue gv;

            if (!_storage.TryGetValue(_controller.selectedPageId, out gv))
            {
                gv = _default;
            }

            if (_tweenConfig != null && _tweenConfig.tween && UIPackage._constructing == 0 && !disableAllTweenEffect)
            {
                if ((_owner is ITextColorGear) && gv.strokeColor.A > 0)
                {
                    _owner._gearLocked = true;
                    ((ITextColorGear)_owner).strokeColor = gv.strokeColor;
                    _owner._gearLocked = false;
                }

                if (_tweenConfig._tweener != null)
                {
                    Color tmp = _tweenConfig._tweener.endValue.color;
                    if (!ToolSet.EqualColor(ref tmp, ref gv.color))
                    {
                        _tweenConfig._tweener.Kill(true);
                        _tweenConfig._tweener = null;
                    }
                    else
                    {
                        return;
                    }
                }

                Color tmp2 = ((IColorGear)_owner).color;
                if (!ToolSet.EqualColor(ref tmp2, ref gv.color))
                {
                    if (_owner.CheckGearController(0, _controller))
                    {
                        _tweenConfig._displayLockToken = _owner.AddDisplayLock();
                    }

                    _tweenConfig._tweener = GTween.To(((IColorGear)_owner).color, gv.color, _tweenConfig.duration)
                                            .SetDelay(_tweenConfig.delay)
                                            .SetEase(_tweenConfig.easeType)
                                            .SetTarget(this)
                                            .SetListener(this);
                }
            }
            else
            {
                _owner._gearLocked         = true;
                ((IColorGear)_owner).color = gv.color;
                if ((_owner is ITextColorGear) && gv.strokeColor.A > 0)
                {
                    ((ITextColorGear)_owner).strokeColor = gv.strokeColor;
                }
                _owner._gearLocked = false;
            }
        }