override public void Apply() { GearXYValue gv; if (!_storage.TryGetValue(_controller.selectedPageId, out gv)) { gv = _default; } Vector2 endPos = new Vector2(); if (positionsInPercent && _owner.parent != null) { endPos.x = gv.px * _owner.parent.width; endPos.y = gv.py * _owner.parent.height; } else { endPos.x = gv.x; endPos.y = gv.y; } if (_tweenConfig != null && _tweenConfig.tween && UIPackage._constructing == 0 && !disableAllTweenEffect) { if (_tweenConfig._tweener != null) { if (_tweenConfig._tweener.endValue.x != endPos.x || _tweenConfig._tweener.endValue.y != endPos.y) { _tweenConfig._tweener.Kill(true); _tweenConfig._tweener = null; } else { return; } } Vector2 origin = _owner.xy; if (endPos != origin) { if (_owner.CheckGearController(0, _controller)) { _tweenConfig._displayLockToken = _owner.AddDisplayLock(); } _tweenConfig._tweener = GTween.To(origin, endPos, _tweenConfig.duration) .SetDelay(_tweenConfig.delay) .SetEase(_tweenConfig.easeType) .SetTarget(this) .SetListener(this); } } else { _owner._gearLocked = true; _owner.SetXY(endPos.x, endPos.y); _owner._gearLocked = false; } }
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; } }
override public void Apply() { GearLookValue gv; if (!_storage.TryGetValue(_controller.selectedPageId, out gv)) { gv = _default; } if (_tweenConfig != null && _tweenConfig.tween && UIPackage._constructing == 0 && !disableAllTweenEffect) { _owner._gearLocked = true; _owner.grayed = gv.grayed; _owner.touchable = gv.touchable; _owner._gearLocked = false; if (_tweenConfig._tweener != null) { if (_tweenConfig._tweener.endValue.x != gv.alpha || _tweenConfig._tweener.endValue.y != gv.rotation) { _tweenConfig._tweener.Kill(true); _tweenConfig._tweener = null; } else { return; } } bool a = gv.alpha != _owner.alpha; bool b = gv.rotation != _owner.rotation; if (a || b) { if (_owner.CheckGearController(0, _controller)) { _tweenConfig._displayLockToken = _owner.AddDisplayLock(); } _tweenConfig._tweener = GTween.To(new Vector2(_owner.alpha, _owner.rotation), new Vector2(gv.alpha, gv.rotation), _tweenConfig.duration) .SetDelay(_tweenConfig.delay) .SetEase(_tweenConfig.easeType, _tweenConfig.customEase) .SetUserData((a ? 1 : 0) + (b ? 2 : 0)) .SetTarget(this) .SetListener(this); } } else { _owner._gearLocked = true; _owner.alpha = gv.alpha; _owner.rotation = gv.rotation; _owner.grayed = gv.grayed; _owner.touchable = gv.touchable; _owner._gearLocked = false; } }
override public void Apply() { GearSizeValue gv; if (!_storage.TryGetValue(_controller.selectedPageId, out gv)) { gv = _default; } if (_tweenConfig != null && _tweenConfig.tween && UIPackage._constructing == 0 && !disableAllTweenEffect) { if (_tweenConfig._tweener != null) { if (_tweenConfig._tweener.endValue.x != gv.width || _tweenConfig._tweener.endValue.y != gv.height || _tweenConfig._tweener.endValue.z != gv.scaleX || _tweenConfig._tweener.endValue.w != gv.scaleY) { _tweenConfig._tweener.Kill(true); _tweenConfig._tweener = null; } else { return; } } bool a = gv.width != _owner.width || gv.height != _owner.height; bool b = gv.scaleX != _owner.scaleX || gv.scaleY != _owner.scaleY; if (a || b) { if (_owner.CheckGearController(0, _controller)) { _tweenConfig._displayLockToken = _owner.AddDisplayLock(); } _tweenConfig._tweener = GTween.To(new Vector4(_owner.width, _owner.height, _owner.scaleX, _owner.scaleY), new Vector4(gv.width, gv.height, gv.scaleX, gv.scaleY), _tweenConfig.duration) .SetDelay(_tweenConfig.delay) .SetEase(_tweenConfig.easeType) .SetUserData((a ? 1 : 0) + (b ? 2 : 0)) .SetTarget(this) .SetListener(this); } } else { _owner._gearLocked = true; _owner.SetSize(gv.width, gv.height, _owner.CheckGearController(1, _controller)); _owner.SetScale(gv.scaleX, gv.scaleY); _owner._gearLocked = false; } }
/// <summary> /// 动态改变进度值。 /// </summary> /// <param name="value"></param> /// <param name="duration"></param> public GTweener TweenValue(double value, float duration) { double oldValule = _value; _value = value; if (_tweening) { GTween.Kill(this, TweenPropType.Progress, false); } _tweening = true; return(GTween.To(oldValule, _value, duration) .SetEase(EaseType.Linear) .SetTarget(this, TweenPropType.Progress) .OnComplete(() => { _tweening = false; })); }
override public void Apply() { GearXYValue gv; if (!_storage.TryGetValue(_controller.selectedPageId, out gv)) { gv = _default; } if (_tweenConfig != null && _tweenConfig.tween && UIPackage._constructing == 0 && !disableAllTweenEffect) { if (_tweenConfig._tweener != null) { if (_tweenConfig._tweener.endValue.x != gv.x || _tweenConfig._tweener.endValue.y != gv.y) { _tweenConfig._tweener.Kill(true); _tweenConfig._tweener = null; } else { return; } } if (_owner.x != gv.x || _owner.y != gv.y) { if (_owner.CheckGearController(0, _controller)) { _tweenConfig._displayLockToken = _owner.AddDisplayLock(); } _tweenConfig._tweener = GTween.To(_owner.xy, new Vector2(gv.x, gv.y), _tweenConfig.duration) .SetDelay(_tweenConfig.delay) .SetEase(_tweenConfig.easeType) .SetTarget(this) .SetListener(this); } } else { _owner._gearLocked = true; _owner.SetPosition(gv.x, gv.y); _owner._gearLocked = false; } }