Пример #1
0
        /// <summary>
        /// 动态改变进度值。
        /// </summary>
        /// <param name="value"></param>
        /// <param name="duration"></param>
        public GTweener TweenValue(double value, float duration)
        {
            double oldValule;

            if (_tweening)
            {
                GTweener twener = GTween.GetTween(this, TweenPropType.Progress);
                oldValule = twener.value.d;

                twener.Kill(false);
            }
            else
            {
                oldValule = _value;
            }

            oldValule = _value;

            _value    = value;
            _tweening = true;
            return(GTween.ToDouble(oldValule, _value, duration)
                   .SetEase(EaseType.Linear)
                   .SetTarget(this, TweenPropType.Progress)
                   .OnComplete(() => { _tweening = false; }));
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
 public override void Dispose()
 {
     if (_tweening)
     {
         GTween.Kill(this);
     }
     base.Dispose();
 }
Пример #4
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;
            }
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
        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;
            }
        }
Пример #7
0
        /// <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; }));
        }
Пример #8
0
        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;
            }
        }
Пример #9
0
		/// <summary>
		/// 动态改变进度值。
		/// </summary>
		/// <param name="value"></param>
		/// <param name="duration"></param>
		public GTweener TweenValue(double value, float duration)
		{
			double oldValule;

			GTweener twener = GTween.GetTween(this, TweenPropType.Progress);
			if (twener != null)
			{
				oldValule = twener.value.d;
				twener.Kill(false);
			}
			else
				oldValule = _value;

			_value = value;
			return GTween.ToDouble(oldValule, _value, duration)
				.SetEase(EaseType.Linear)
				.SetTarget(this, TweenPropType.Progress);
		}
Пример #10
0
    static int _CreateFairyGUI_GTween(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                FairyGUI.GTween obj = new FairyGUI.GTween();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.GTween.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }