예제 #1
0
    static int SetTarget(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                FairyGUI.GTweener obj  = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
                object            arg0 = ToLua.ToVarObject(L, 2);
                FairyGUI.GTweener o    = obj.SetTarget(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3)
            {
                FairyGUI.GTweener      obj  = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
                object                 arg0 = ToLua.ToVarObject(L, 2);
                FairyGUI.TweenPropType arg1 = (FairyGUI.TweenPropType)ToLua.CheckObject(L, 3, typeof(FairyGUI.TweenPropType));
                FairyGUI.GTweener      o    = obj.SetTarget(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GTweener.SetTarget"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #2
0
        internal static GTweener CreateTween()
        {
            if (!_inited)
            {
                Init();
            }

            GTweener tweener;
            int      cnt = _tweenerPool.Count;

            if (cnt > 0)
            {
                tweener = _tweenerPool[cnt - 1];
                _tweenerPool.RemoveAt(cnt - 1);
            }
            else
            {
                tweener = new GTweener();
            }
            tweener._Init();
            _activeTweens[_totalActiveTweens++] = tweener;

            if (_totalActiveTweens == _activeTweens.Length)
            {
                GTweener[] newArray = new GTweener[_activeTweens.Length + Mathf.CeilToInt(_activeTweens.Length * 0.5f)];
                _activeTweens.CopyTo(newArray, 0);
                _activeTweens = newArray;
            }

            return(tweener);
        }
예제 #3
0
    static int SetRepeat(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                FairyGUI.GTweener obj = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
                int arg0            = (int)LuaDLL.luaL_checknumber(L, 2);
                FairyGUI.GTweener o = obj.SetRepeat(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3)
            {
                FairyGUI.GTweener obj = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
                int  arg0             = (int)LuaDLL.luaL_checknumber(L, 2);
                bool arg1             = LuaDLL.luaL_checkboolean(L, 3);
                FairyGUI.GTweener o   = obj.SetRepeat(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GTweener.SetRepeat"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #4
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; }));
        }
예제 #5
0
    static int GetTween(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                object            arg0 = ToLua.ToVarObject(L, 1);
                FairyGUI.GTweener o    = FairyGUI.GTween.GetTween(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2)
            {
                object arg0 = ToLua.ToVarObject(L, 1);
                FairyGUI.TweenPropType arg1 = (FairyGUI.TweenPropType)ToLua.CheckObject(L, 2, typeof(FairyGUI.TweenPropType));
                FairyGUI.GTweener      o    = FairyGUI.GTween.GetTween(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GTween.GetTween"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int OnComplete(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <FairyGUI.GTweenCallback1>(L, 2))
            {
                FairyGUI.GTweener        obj  = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
                FairyGUI.GTweenCallback1 arg0 = (FairyGUI.GTweenCallback1)ToLua.ToObject(L, 2);
                FairyGUI.GTweener        o    = obj.OnComplete(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <FairyGUI.GTweenCallback>(L, 2))
            {
                FairyGUI.GTweener       obj  = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
                FairyGUI.GTweenCallback arg0 = (FairyGUI.GTweenCallback)ToLua.ToObject(L, 2);
                FairyGUI.GTweener       o    = obj.OnComplete(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GTweener.OnComplete"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #7
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));
        }
    }
예제 #8
0
        internal static void Update()
        {
            int cnt          = _totalActiveTweens;
            int freePosStart = -1;
            int freePosCount = 0;

            for (int i = 0; i < cnt; i++)
            {
                GTweener tweener = _activeTweens[i];
                if (tweener == null)
                {
                    if (freePosStart == -1)
                    {
                        freePosStart = i;
                    }
                    freePosCount++;
                }
                else if (tweener._killed)
                {
                    tweener._Reset();
                    _tweenerPool.Add(tweener);
                    _activeTweens[i] = null;

                    if (freePosStart == -1)
                    {
                        freePosStart = i;
                    }
                    freePosCount++;
                }
                else
                {
                    if (!tweener._paused)
                    {
                        tweener._Update();
                    }

                    if (freePosStart != -1)
                    {
                        _activeTweens[freePosStart] = tweener;
                        _activeTweens[i]            = null;
                        freePosStart++;
                    }
                }
            }

            if (freePosStart >= 0)
            {
                if (_totalActiveTweens != cnt)                 //new tweens added
                {
                    int j = cnt;
                    cnt = _totalActiveTweens - cnt;
                    for (int i = 0; i < cnt; i++)
                    {
                        _activeTweens[freePosStart++] = _activeTweens[j++];
                    }
                }
                _totalActiveTweens = freePosStart;
            }
        }
예제 #9
0
        public void OnTweenUpdate(GTweener tweener)
        {
            _owner._gearLocked = true;
            _owner.SetXY(tweener.value.x, tweener.value.y);
            _owner._gearLocked = false;

            _owner.InvalidateBatchingState();
        }
예제 #10
0
        public void OnTweenUpdate(GTweener tweener)
        {
            _owner._gearLocked         = true;
            ((IColorGear)_owner).color = tweener.value.color;
            _owner._gearLocked         = false;

            _owner.InvalidateBatchingState();
        }
예제 #11
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;
            }
        }
예제 #12
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;
            }
        }
예제 #13
0
 public void OnTweenComplete(GTweener tweener)
 {
     _tweenConfig._tweener = null;
     if (_tweenConfig._displayLockToken != 0)
     {
         _owner.ReleaseDisplayLock(_tweenConfig._displayLockToken);
         _tweenConfig._displayLockToken = 0;
     }
     _owner.DispatchEvent("onGearStop", this);
 }
예제 #14
0
 public void OnTweenComplete(GTweener tweener)
 {
     _tweenConfig._tweener = null;
     if (_tweenConfig._displayLockToken != 0)
     {
         _owner.ReleaseDisplayLock(_tweenConfig._displayLockToken);
         _tweenConfig._displayLockToken = 0;
     }
     _owner.OnGearStop.Call(this);
 }
예제 #15
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);
            }
        }
예제 #16
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;
            }
        }
예제 #17
0
        public void OnTweenUpdate(GTweener tweener)
        {
            _owner._gearLocked = true;
            int flag = (int)tweener.userData;

            if ((flag & 1) != 0)
            {
                _owner.SetSize(tweener.value.x, tweener.value.y, _owner.CheckGearController(1, _controller));
            }
            if ((flag & 2) != 0)
            {
                _owner.SetScale(tweener.value.z, tweener.value.w);
            }
            _owner._gearLocked = false;
        }
예제 #18
0
        public void OnTweenUpdate(GTweener tweener)
        {
            int flag = (int)tweener.userData;

            _owner._gearLocked = true;
            if ((flag & 1) != 0)
            {
                _owner.alpha = tweener.value.x;
            }
            if ((flag & 2) != 0)
            {
                _owner.rotation = tweener.value.y;
            }
            _owner._gearLocked = false;
        }
예제 #19
0
 static int DelayedCall(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         float             arg0 = (float)LuaDLL.luaL_checknumber(L, 1);
         FairyGUI.GTweener o    = FairyGUI.GTween.DelayedCall(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #20
0
 static int Seek(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GTweener obj  = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
         float             arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.Seek(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int OnTweenComplete(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.Transition obj  = (FairyGUI.Transition)ToLua.CheckObject <FairyGUI.Transition>(L, 1);
         FairyGUI.GTweener   arg0 = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 2);
         obj.OnTweenComplete(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #22
0
 static int SetListener(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GTweener       obj  = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
         FairyGUI.ITweenListener arg0 = (FairyGUI.ITweenListener)ToLua.CheckObject <FairyGUI.ITweenListener>(L, 2);
         FairyGUI.GTweener       o    = obj.SetListener(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #23
0
 static int SetEaseOvershootOrAmplitude(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GTweener obj  = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
         float             arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         FairyGUI.GTweener o    = obj.SetEaseOvershootOrAmplitude(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #24
0
 static int OnComplete(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GTweener        obj  = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
         FairyGUI.GTweenCallback1 arg0 = (FairyGUI.GTweenCallback1)ToLua.CheckDelegate <FairyGUI.GTweenCallback1>(L, 2);
         FairyGUI.GTweener        o    = obj.OnComplete(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #25
0
 static int SetPaused(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GTweener obj = (FairyGUI.GTweener)ToLua.CheckObject <FairyGUI.GTweener>(L, 1);
         bool arg0             = LuaDLL.luaL_checkboolean(L, 2);
         FairyGUI.GTweener o   = obj.SetPaused(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #26
0
 static int Shake(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1);
         float             arg1   = (float)LuaDLL.luaL_checknumber(L, 2);
         float             arg2   = (float)LuaDLL.luaL_checknumber(L, 3);
         FairyGUI.GTweener o      = FairyGUI.GTween.Shake(arg0, arg1, arg2);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #27
0
 static int ToDouble(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         double            arg0 = (double)LuaDLL.luaL_checknumber(L, 1);
         double            arg1 = (double)LuaDLL.luaL_checknumber(L, 2);
         float             arg2 = (float)LuaDLL.luaL_checknumber(L, 3);
         FairyGUI.GTweener o    = FairyGUI.GTween.ToDouble(arg0, arg1, arg2);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #28
0
    static int get_allCompleted(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GTweener obj = (FairyGUI.GTweener)o;
            bool ret = obj.allCompleted;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index allCompleted on a nil value"));
        }
    }
예제 #29
0
    static int get_normalizedTime(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GTweener obj = (FairyGUI.GTweener)o;
            float             ret = obj.normalizedTime;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index normalizedTime on a nil value"));
        }
    }
예제 #30
0
    static int get_deltaValue(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GTweener   obj = (FairyGUI.GTweener)o;
            FairyGUI.TweenValue ret = obj.deltaValue;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index deltaValue on a nil value"));
        }
    }