Exemplo n.º 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; }));
        }
Exemplo n.º 2
0
    static int Kill(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                FairyGUI.GTweener obj = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
                obj.Kill();
                return(0);
            }
            else if (count == 2)
            {
                FairyGUI.GTweener obj = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
                bool arg0             = LuaDLL.luaL_checkboolean(L, 2);
                obj.Kill(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GTweener.Kill"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemplo n.º 3
0
        override public void Apply()
        {
            GearColorValue gv;

            if (!_storage.TryGetValue(_controller.selectedPageId, out gv))
            {
                gv = _default;
            }

            if (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 (_tweener != null)
                {
                    if (_tweener.endValue.color != gv.color)
                    {
                        _tweener.Kill(true);
                        _tweener = null;
                    }
                    else
                    {
                        return;
                    }
                }

                if (((IColorGear)_owner).color != gv.color)
                {
                    if (_owner.CheckGearController(0, _controller))
                    {
                        _displayLockToken = _owner.AddDisplayLock();
                    }

                    _tweener = GTween.To(((IColorGear)_owner).color, gv.color, tweenTime)
                               .SetDelay(delay)
                               .SetEase(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;
            }
        }
Exemplo n.º 4
0
        override public 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.touchable   = gv.touchable;
                _owner._gearLocked = false;

                if (_tweener != null)
                {
                    if (_tweener.endValue.x != gv.alpha || _tweener.endValue.y != gv.rotation)
                    {
                        _tweener.Kill(true);
                        _tweener = null;
                    }
                    else
                    {
                        return;
                    }
                }

                bool a = gv.alpha != _owner.alpha;
                bool b = gv.rotation != _owner.rotation;
                if (a || b)
                {
                    if (_owner.CheckGearController(0, _controller))
                    {
                        _displayLockToken = _owner.AddDisplayLock();
                    }

                    _tweener = GTween.To(new Vector2(_owner.alpha, _owner.rotation), new Vector2(gv.alpha, gv.rotation), tweenTime)
                               .SetDelay(delay)
                               .SetEase(easeType)
                               .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;
            }
        }
Exemplo n.º 5
0
        public static void KillAll(bool completed)
        {
            bool flag = false;
            int  cnt  = _totalActiveTweens;

            for (int i = 0; i < cnt; i++)
            {
                GTweener tweener = _activeTweens[i];
                tweener.Kill(completed);
            }
        }
Exemplo n.º 6
0
        override public void Apply()
        {
            GearSizeValue gv;

            if (!_storage.TryGetValue(_controller.selectedPageId, out gv))
            {
                gv = _default;
            }

            if (tween && UIPackage._constructing == 0 && !disableAllTweenEffect)
            {
                if (_tweener != null)
                {
                    if (_tweener.endValue.x != gv.width || _tweener.endValue.y != gv.height ||
                        _tweener.endValue.z != gv.scaleX || _tweener.endValue.w != gv.scaleY)
                    {
                        _tweener.Kill(true);
                        _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))
                    {
                        _displayLockToken = _owner.AddDisplayLock();
                    }

                    _tweener = GTween.To(new Vector4(_owner.width, _owner.height, _owner.scaleX, _owner.scaleY),
                                         new Vector4(gv.width, gv.height, gv.scaleX, gv.scaleY), tweenTime)
                               .SetDelay(delay)
                               .SetEase(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;
            }
        }
Exemplo n.º 7
0
        override public void Apply()
        {
            GearXYValue gv;

            if (!_storage.TryGetValue(_controller.selectedPageId, out gv))
            {
                gv = _default;
            }

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

                if (_owner.x != gv.x || _owner.y != gv.y)
                {
                    if (_owner.CheckGearController(0, _controller))
                    {
                        _displayLockToken = _owner.AddDisplayLock();
                    }

                    _tweener = GTween.To(_owner.xy, new Vector2(gv.x, gv.y), tweenTime)
                               .SetDelay(delay)
                               .SetEase(easeType)
                               .SetTarget(this)
                               .SetListener(this);
                }
            }
            else
            {
                _owner._gearLocked = true;
                _owner.SetXY(gv.x, gv.y);
                _owner._gearLocked = false;
            }
        }
Exemplo n.º 8
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);
		}
Exemplo n.º 9
0
        internal static bool KillTweens(object target, TweenPropType propType, bool completed)
        {
            if (target == null)
            {
                return(false);
            }

            bool flag    = false;
            int  cnt     = _totalActiveTweens;
            bool anyType = propType == TweenPropType.None;

            for (int i = 0; i < cnt; i++)
            {
                GTweener tweener = _activeTweens[i];
                if (tweener != null && tweener.target == target && !tweener._killed &&
                    (anyType || tweener._propType == propType))
                {
                    tweener.Kill(completed);
                    flag = true;
                }
            }

            return(flag);
        }