示例#1
0
 private void OnEnable()
 {
     current    = (DoTweenAnimation)target;
     data       = current.GetData();
     laseChoose = data.anis;
     Init();
 }
 static int Stop(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         GameFramework.DoTweenAnimation obj = (GameFramework.DoTweenAnimation)ToLua.CheckObject <GameFramework.DoTweenAnimation>(L, 1);
         obj.Stop();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetData(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         GameFramework.DoTweenAnimation     obj = (GameFramework.DoTweenAnimation)ToLua.CheckObject <GameFramework.DoTweenAnimation>(L, 1);
         GameFramework.DoTweenAnimationData o   = obj.GetData();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int ReStart(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         GameFramework.DoTweenAnimation obj = (GameFramework.DoTweenAnimation)ToLua.CheckObject <GameFramework.DoTweenAnimation>(L, 1);
         bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
         obj.ReStart(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int SetCallback(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         GameFramework.DoTweenAnimation obj = (GameFramework.DoTweenAnimation)ToLua.CheckObject <GameFramework.DoTweenAnimation>(L, 1);
         System.Action arg0 = (System.Action)ToLua.CheckDelegate <System.Action>(L, 2);
         obj.SetCallback(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int SetTween(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         GameFramework.DoTweenAnimation obj = (GameFramework.DoTweenAnimation)ToLua.CheckObject <GameFramework.DoTweenAnimation>(L, 1);
         DG.Tweening.Tween arg0             = (DG.Tweening.Tween)ToLua.CheckObject <DG.Tweening.Tween>(L, 2);
         GameFramework.DoTweenAnimation o   = obj.SetTween(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int get_canvasGroup(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.DoTweenAnimation obj = (GameFramework.DoTweenAnimation)o;
            UnityEngine.CanvasGroup        ret = obj.canvasGroup;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index canvasGroup on a nil value"));
        }
    }
    static int get_rectTransform(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.DoTweenAnimation obj = (GameFramework.DoTweenAnimation)o;
            UnityEngine.RectTransform      ret = obj.rectTransform;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index rectTransform on a nil value"));
        }
    }
    static int get_graphic(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.DoTweenAnimation obj = (GameFramework.DoTweenAnimation)o;
            UnityEngine.UI.Graphic         ret = obj.graphic;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index graphic on a nil value"));
        }
    }
    static int get_lengthWithDelay(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.DoTweenAnimation obj = (GameFramework.DoTweenAnimation)o;
            float ret = obj.lengthWithDelay;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index lengthWithDelay on a nil value"));
        }
    }
 static int ToMoveUGUI(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         UnityEngine.GameObject arg0      = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
         UnityEngine.Vector2    arg1      = ToLua.ToVector2(L, 2);
         float            arg2            = (float)LuaDLL.luaL_checknumber(L, 3);
         DG.Tweening.Ease arg3            = (DG.Tweening.Ease)ToLua.CheckObject(L, 4, typeof(DG.Tweening.Ease));
         GameFramework.DoTweenAnimation o = GameFramework.UtilityUnity.ToMoveUGUI(arg0, arg1, arg2, arg3);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int ToFilledImage(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 5);
         UnityEngine.GameObject arg0      = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
         float            arg1            = (float)LuaDLL.luaL_checknumber(L, 2);
         float            arg2            = (float)LuaDLL.luaL_checknumber(L, 3);
         float            arg3            = (float)LuaDLL.luaL_checknumber(L, 4);
         DG.Tweening.Ease arg4            = (DG.Tweening.Ease)ToLua.CheckObject(L, 5, typeof(DG.Tweening.Ease));
         GameFramework.DoTweenAnimation o = GameFramework.DoTweenAnimation.ToFilledImage(arg0, arg1, arg2, arg3, arg4);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#13
0
 public static DoTweenAnimation ToAlpha(GameObject _target, float _start, float _end, float _time, Ease _ease = Ease.Linear)
 {
     return(DoTweenAnimation.ToAlpha(_target, _start, _end, _time, _ease));
 }
示例#14
0
 public static DoTweenAnimation ToUGUIColor(GameObject _target, Color _start, Color _end, float _time, Ease _ease = Ease.Linear)
 {
     return(DoTweenAnimation.ToUGUIColor(_target, _start, _end, _time, _ease));
 }
示例#15
0
 public static DoTweenAnimation ToUGUIShowNumber(GameObject _target, float _start, float _end, float _time, int _showLimit, Ease _ease = Ease.Linear)
 {
     return(DoTweenAnimation.ToUGUIShowNumber(_target, _start, _end, _time, _showLimit, _ease));
 }
示例#16
0
 public static DoTweenAnimation ToMoveUGUI(GameObject _target, Vector2 _end, float _time, Ease _ease = Ease.Linear)
 {
     return(DoTweenAnimation.ToMoveUGUI(_target, _end, _time, _ease));
 }
示例#17
0
 public static DoTweenAnimation ToEulerAngles(GameObject _target, Vector3 _end, float _time, Ease _ease = Ease.Linear)
 {
     return(DoTweenAnimation.ToEulerAngles(_target, _end, _time, _ease));
 }
        public Tween GetTween(DoTweenAnimation _animation)
        {
            Sequence _sequence = null;
            float    _oneTime  = 0;

            if (_animation == null)
            {
                return(_sequence);
            }
            switch (anis)
            {
            case DoTweenAnis.ToMove:
                _animation.transform.position = startVector3;
                _sequence = DOTween.Sequence();
                _sequence.Append(_animation.transform.DOPath(pathVector3.ToArray(), time, PathType.CatmullRom).SetEase(ease));
                break;

            case DoTweenAnis.ToLocalMove:
                _animation.transform.localPosition = startVector3;
                _sequence = DOTween.Sequence();
                _oneTime  = time / pathVector3.Count;
                _sequence.Append(_animation.transform.DOLocalPath(pathVector3.ToArray(), time, PathType.CatmullRom).SetEase(ease));
                break;

            case DoTweenAnis.ToEulerAngles:
                _animation.transform.eulerAngles = startVector3;
                _sequence = DOTween.Sequence();
                _oneTime  = time / pathVector3.Count;
                for (int i = 0; i < pathVector3.Count; i++)
                {
                    _sequence.Append(_animation.transform.DORotate(pathVector3[i], _oneTime).SetEase(ease));
                }
                break;

            case DoTweenAnis.ToLocalEulerAngles:
                _animation.transform.localEulerAngles = startVector3;
                _sequence = DOTween.Sequence();
                _oneTime  = time / pathVector3.Count;
                for (int i = 0; i < pathVector3.Count; i++)
                {
                    _sequence.Append(_animation.transform.DOLocalRotate(pathVector3[i], _oneTime).SetEase(ease));
                }
                break;

            case DoTweenAnis.ToScale:
                _animation.transform.localScale = startVector3;
                _sequence = DOTween.Sequence();
                _oneTime  = time / pathVector3.Count;
                for (int i = 0; i < pathVector3.Count; i++)
                {
                    _sequence.Append(_animation.transform.DOScale(pathVector3[i], _oneTime).SetEase(ease));
                }
                break;

            case DoTweenAnis.ToUGUIScale:
                if (_animation.rectTransform)
                {
                    _animation.rectTransform.sizeDelta = startVector2;
                    _sequence = DOTween.Sequence();
                    _oneTime  = time / pathVector2.Count;
                    for (int i = 0; i < pathVector2.Count; i++)
                    {
                        _sequence.Append(DOTween.To(() => _animation.rectTransform.sizeDelta, (_v) => _animation.rectTransform.sizeDelta = _v, pathVector2[i], _oneTime).SetEase(ease));
                    }
                }
                break;

            case DoTweenAnis.ToMoveUGUI:
                if (_animation.rectTransform)
                {
                    _animation.rectTransform.anchoredPosition3D = startVector3;
                    _sequence = DOTween.Sequence();
                    _oneTime  = time / pathVector3.Count;
                    for (int i = 0; i < pathVector3.Count; i++)
                    {
                        _sequence.Append(DOTween.To(() => _animation.rectTransform.anchoredPosition3D, (_v) => _animation.rectTransform.anchoredPosition3D = _v, pathVector3[i], _oneTime).SetEase(ease));
                    }
                }
                break;

            case DoTweenAnis.ToUGUIShowInt:
                if (_animation.text)
                {
                    _animation.text.text = startFloat.ToString();
                    _sequence            = DOTween.Sequence();
                    _oneTime             = time / pathNumber.Count;
                    for (int i = 0; i < pathNumber.Count; i++)
                    {
                        _sequence.Append(DOTween.To(() => int.Parse(_animation.text.text), (_v) => _animation.text.text = ((int)_v).ToString(), pathNumber[i], _oneTime).SetEase(ease));
                    }
                }
                break;

            case DoTweenAnis.ToUGUIShowNumber:
                if (_animation.text)
                {
                    _animation.text.text = startFloat.ToString("F" + limit);
                    _sequence            = DOTween.Sequence();
                    _oneTime             = time / pathNumber.Count;
                    for (int i = 0; i < pathNumber.Count; i++)
                    {
                        _sequence.Append(DOTween.To(() => float.Parse(_animation.text.text), (_v) => _animation.text.text = _v.ToString("F" + limit), pathNumber[i], _oneTime).SetEase(ease));
                    }
                }
                break;

            case DoTweenAnis.ToUGUIColor:
                if (_animation.graphic)
                {
                    Color _c = _animation.graphic.color;
                    _animation.graphic.color = startColor;
                    _sequence = DOTween.Sequence();
                    _oneTime  = time / pathColor.Count;
                    for (int i = 0; i < pathColor.Count; i++)
                    {
                        _sequence.Append(DOTween.To(() => _animation.graphic.color, (_v) => _animation.graphic.color = _v, pathColor[i], _oneTime).SetEase(ease));
                    }
                }
                break;

            case DoTweenAnis.ToFilledImage:
                if (_animation.image)
                {
                    _animation.image.fillAmount = startFloat;
                    _sequence = DOTween.Sequence();
                    _oneTime  = time / pathNumber.Count;
                    for (int i = 0; i < pathNumber.Count; i++)
                    {
                        _sequence.Append(DOTween.To(() => _animation.image.fillAmount, (_v) => _animation.image.fillAmount = _v, pathNumber[i], _oneTime).SetEase(ease));
                    }
                }
                break;

            case DoTweenAnis.ToAlpha:
                if (_animation.graphic)
                {
                    Color _c = _animation.graphic.color;
                    _animation.graphic.color = new Color(_c.r, _c.g, _c.b, startFloat);
                    _sequence = DOTween.Sequence();
                    _oneTime  = time / pathNumber.Count;
                    for (int i = 0; i < pathNumber.Count; i++)
                    {
                        _sequence.Append(DOTween.To(() => _animation.graphic.color, (_v) => _animation.graphic.color = _v, new Color(_c.r, _c.g, _c.b, pathNumber[i]), _oneTime).SetEase(ease));
                    }
                }
                if (_animation.canvasGroup)
                {
                    _animation.canvasGroup.alpha = startFloat;
                    _sequence = DOTween.Sequence();
                    _oneTime  = time / pathNumber.Count;
                    for (int i = 0; i < pathNumber.Count; i++)
                    {
                        _sequence.Append(DOTween.To(() => _animation.canvasGroup.alpha, (_v) => _animation.canvasGroup.alpha = _v, pathNumber[i], _oneTime).SetEase(ease));
                    }
                }
                break;

            default:
                break;
            }

            if (_sequence != null)
            {
                _sequence.SetEase(ease);
                _sequence.SetDelay(delay);
            }
            if (loop != DoTweenAnisLoop.No)
            {
                _sequence.SetLoops(-1, (LoopType)((int)loop));
            }

            return(_sequence);
        }