FairyGUI.GearXY.Apply C# (CSharp) Method

Apply() public method

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

            if (tween && UIPackage._constructing == 0 && !disableAllTweenEffect)
            {
                if (tweener != null)
                {
                    if (_tweenTarget.x != gv.x || _tweenTarget.y != gv.y)
                    {
                        tweener.Kill(true);
                        tweener = null;
                    }
                    else
                        return;
                }

                if (_owner.x != gv.x || _owner.y != gv.y)
                {
                    _owner.internalVisible++;
                    _tweenTarget = gv;

                    tweener = DOTween.To(() => new Vector2(_owner.x, _owner.y), v =>
                    {
                        _owner._gearLocked = true;
                        _owner.SetXY(v.x, v.y);
                        _owner._gearLocked = false;
                    }, new Vector2(gv.x, gv.y), 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;
                _owner.SetXY(gv.x, gv.y);
                _owner._gearLocked = false;
            }
        }

Usage Example

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