FairyGUI.GearLook.Apply C# (CSharp) Method

Apply() public method

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

            if (tween && UIPackage._constructing == 0 && !disableAllTweenEffect)
            {
                _owner._gearLocked = true;
                _owner.grayed = gv.grayed;
                _owner._gearLocked = false;

                if (tweener != null)
                {
                    if (_tweenTarget.alpha != gv.alpha || _tweenTarget.rotation != gv.rotation)
                    {
                        tweener.Kill(true);
                        tweener = null;
                    }
                    else
                        return;
                }

                bool a = gv.alpha != _owner.alpha;
                bool b = gv.rotation != _owner.rotation;
                if (a || b)
                {
                    _owner.internalVisible++;
                    _tweenTarget = gv;

                    tweener = DOTween.To(() => new Vector2(_owner.alpha, _owner.rotation), val =>
                    {
                        _owner._gearLocked = true;
                        if (a)
                            _owner.alpha = val.x;
                        if (b)
                            _owner.rotation = val.y;
                        _owner._gearLocked = false;
                    }, new Vector2(gv.alpha, gv.rotation), tweenTime)
                    .SetEase(easeType)
                    .SetUpdate(true)
                    .OnUpdate(() =>
                    {
                        if(b)
                            _owner.InvalidateBatchingState();
                    })
                    .OnComplete(() =>
                    {
                        tweener = null;
                        _owner.internalVisible--;
                        if (b)
                            _owner.InvalidateBatchingState();
                        _owner.OnGearStop.Call(this);
                    });

                    if (delay > 0)
                        tweener.SetDelay(delay);
                }
            }
            else
            {
                _owner._gearLocked = true;
                _owner.alpha = gv.alpha;
                _owner.rotation = gv.rotation;
                _owner.grayed = gv.grayed;
                _owner._gearLocked = false;
            }
        }

Usage Example

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