FairyGUI.GearColor.Apply C# (CSharp) Method

Apply() public method

public Apply ( ) : void
return void
        public override void Apply()
        {
            GearColorValue cv;
            if (!_storage.TryGetValue(_controller.selectedPageId, out cv))
                cv = _default;

            if (tween && UIPackage._constructing == 0 && !disableAllTweenEffect)
            {
                if (tweener != null)
                {
                    if (_tweenTarget.color != cv.color)
                    {
                        tweener.Kill(true);
                        tweener = null;
                    }
                    else
                        return;
                }

                if (((IColorGear)_owner).color != cv.color)
                {
                    _owner.internalVisible++;
                    _tweenTarget = cv;

                    tweener = DOTween.To(() => ((IColorGear)_owner).color, v =>
                    {
                        _owner._gearLocked = true;
                        ((IColorGear)_owner).color = v;
                        _owner._gearLocked = false;
                    }, cv.color, tweenTime)
                    .SetEase(easeType)
                    .SetUpdate(true)
                    .OnUpdate(() =>
                    {
                        _owner.InvalidateBatchingState();
                    })
                    .OnComplete(() =>
                    {
                        tweener = null;
                        _owner.internalVisible--;
                        _owner.InvalidateBatchingState();
                        _owner.OnGearStop.Call(this);
                    });

                    if (delay > 0)
                        tweener.SetDelay(delay);
                }
            }
            else
            {
                _owner._gearLocked = true;
                ((IColorGear)_owner).color = cv.color;
                _owner._gearLocked = false;
            }
        }

Usage Example

 static public int Apply(IntPtr l)
 {
     try {
         FairyGUI.GearColor self = (FairyGUI.GearColor)checkSelf(l);
         self.Apply();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }