static int SetLoops(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2)
        {
            DG.Tweening.Tween obj = (DG.Tweening.Tween)LuaScriptMgr.GetNetObjectSelf(L, 1, "DG.Tweening.Tween");
            int arg0            = (int)LuaScriptMgr.GetNumber(L, 2);
            DG.Tweening.Tween o = obj.SetLoops(arg0);
            LuaScriptMgr.PushObject(L, o);
            return(1);
        }
        else if (count == 3)
        {
            DG.Tweening.Tween obj = (DG.Tweening.Tween)LuaScriptMgr.GetNetObjectSelf(L, 1, "DG.Tweening.Tween");
            int arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
            DG.Tweening.LoopType arg1 = (DG.Tweening.LoopType)LuaScriptMgr.GetNetObject(L, 3, typeof(DG.Tweening.LoopType));
            DG.Tweening.Tween    o    = obj.SetLoops(arg0, arg1);
            LuaScriptMgr.PushObject(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: DG.Tweening.Tween.SetLoops");
        }

        return(0);
    }
 public override void Reset()
 {
     base.Reset();
     gameObject = null;
     to         = new FsmVector3 {
         UseVariable = false
     };
     toGameObject = new FsmGameObject {
         UseVariable = false
     };
     duration = new FsmFloat {
         UseVariable = false
     };
     setSpeedBased = new FsmBool {
         UseVariable = false, Value = false
     };
     rotateMode  = RotateMode.Fast;
     setRelative = new FsmBool {
         UseVariable = false, Value = false
     };
     playInReverse = new FsmBool {
         UseVariable = false, Value = false
     };
     setReverseRelative = new FsmBool {
         UseVariable = false, Value = false
     };
     startEvent        = null;
     finishEvent       = null;
     finishImmediately = new FsmBool {
         UseVariable = false, Value = false
     };
     stringAsId = new FsmString {
         UseVariable = false
     };
     tagAsId = new FsmString {
         UseVariable = false
     };
     startDelay = new FsmFloat {
         Value = 0
     };
     selectedEase = Doozy.PlayMaker.Actions.SelectedEase.EaseType;
     easeType     = Ease.Linear;
     loops        = new FsmInt {
         Value = 0
     };
     loopType             = DG.Tweening.LoopType.Restart;
     autoKillOnCompletion = new FsmBool {
         Value = true
     };
     recyclable = new FsmBool {
         Value = false
     };
     updateType          = UpdateType.Normal;
     isIndependentUpdate = new FsmBool {
         Value = false
     };
     debugThis = new FsmBool {
         Value = false
     };
 }
    static int SetLoops(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                DG.Tweening.Tweener obj = (DG.Tweening.Tweener)ToLua.CheckObject <DG.Tweening.Tweener>(L, 1);
                int arg0            = (int)LuaDLL.luaL_checknumber(L, 2);
                DG.Tweening.Tween o = obj.SetLoops(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3)
            {
                DG.Tweening.Tweener obj = (DG.Tweening.Tweener)ToLua.CheckObject <DG.Tweening.Tweener>(L, 1);
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                DG.Tweening.LoopType arg1 = (DG.Tweening.LoopType)ToLua.CheckObject(L, 3, typeof(DG.Tweening.LoopType));
                DG.Tweening.Tween    o    = obj.SetLoops(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: DG.Tweening.Tweener.SetLoops"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #4
0
    static int SetLoops(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(DG.Tweening.Tween), typeof(int)))
            {
                DG.Tweening.Sequence obj = (DG.Tweening.Sequence)ToLua.ToObject(L, 1);
                int arg0            = (int)LuaDLL.lua_tonumber(L, 2);
                DG.Tweening.Tween o = obj.SetLoops(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(DG.Tweening.Tween), typeof(int), typeof(DG.Tweening.LoopType)))
            {
                DG.Tweening.Sequence obj = (DG.Tweening.Sequence)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                DG.Tweening.LoopType arg1 = (DG.Tweening.LoopType)ToLua.ToObject(L, 3);
                DG.Tweening.Tween    o    = obj.SetLoops(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: DG.Tweening.Sequence.SetLoops"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #5
0
 static int QPYX_SetLoops_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 2)
         {
             DG.Tweening.Tweener QPYX_obj_YXQP = (DG.Tweening.Tweener)ToLua.CheckObject <DG.Tweening.Tweener>(L_YXQP, 1);
             int QPYX_arg0_YXQP            = (int)LuaDLL.luaL_checknumber(L_YXQP, 2);
             DG.Tweening.Tween QPYX_o_YXQP = QPYX_obj_YXQP.SetLoops(QPYX_arg0_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 3)
         {
             DG.Tweening.Tweener QPYX_obj_YXQP = (DG.Tweening.Tweener)ToLua.CheckObject <DG.Tweening.Tweener>(L_YXQP, 1);
             int QPYX_arg0_YXQP = (int)LuaDLL.luaL_checknumber(L_YXQP, 2);
             DG.Tweening.LoopType QPYX_arg1_YXQP = (DG.Tweening.LoopType)ToLua.CheckObject(L_YXQP, 3, typeof(DG.Tweening.LoopType));
             DG.Tweening.Tween    QPYX_o_YXQP    = QPYX_obj_YXQP.SetLoops(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else
         {
             return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: DG.Tweening.Tweener.SetLoops"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 public override void Reset()
 {
     base.Reset();
     gameObject = null;
     punch      = new FsmVector2 {
         UseVariable = false
     };
     duration = new FsmFloat {
         UseVariable = false
     };
     setSpeedBased = new FsmBool {
         UseVariable = false, Value = false
     };
     vibrato = new FsmInt {
         UseVariable = false, Value = 10
     };
     elasticity = new FsmFloat {
         UseVariable = false, Value = 1
     };
     snapping = new FsmBool {
         UseVariable = false, Value = false
     };
     startEvent        = null;
     finishEvent       = null;
     finishImmediately = new FsmBool {
         UseVariable = false, Value = false
     };
     stringAsId = new FsmString {
         UseVariable = false
     };
     tagAsId = new FsmString {
         UseVariable = false
     };
     startDelay = new FsmFloat {
         Value = 0
     };
     selectedEase = Doozy.PlayMaker.Actions.SelectedEase.EaseType;
     easeType     = Ease.Linear;
     loops        = new FsmInt {
         Value = 0
     };
     loopType             = DG.Tweening.LoopType.Restart;
     autoKillOnCompletion = new FsmBool {
         Value = true
     };
     recyclable = new FsmBool {
         Value = false
     };
     updateType          = UpdateType.Normal;
     isIndependentUpdate = new FsmBool {
         Value = false
     };
     debugThis = new FsmBool {
         Value = false
     };
 }
Example #7
0
    void SetupTweens()
    {
        // Ease
        DG.Tweening.Ease           dotweenEase = easing == Easing.Linear ? DG.Tweening.Ease.Linear : DG.Tweening.Ease.InOutQuad;
        Holoville.HOTween.EaseType hotweenEase = easing == Easing.Linear ? Holoville.HOTween.EaseType.Linear : Holoville.HOTween.EaseType.EaseInOutQuad;
        LeanTweenType leanEase = easing == Easing.Linear ? LeanTweenType.linear : LeanTweenType.easeInOutQuad;
        GoEaseType    goEase   = easing == Easing.Linear ? GoEaseType.Linear : GoEaseType.QuadInOut;

        iTween.EaseType iTweenEase = easing == Easing.Linear ? iTween.EaseType.linear : iTween.EaseType.easeInOutQuad;
        // Loop
        int loops = testSetup == TestSetup.Emit ? 1 : -1;

        DG.Tweening.LoopType       dotweenLoopType = testSetup == TestSetup.YoyoLoop ? DG.Tweening.LoopType.Yoyo : DG.Tweening.LoopType.Restart;
        Holoville.HOTween.LoopType hotweenLoopType = testSetup == TestSetup.YoyoLoop ? Holoville.HOTween.LoopType.Yoyo : Holoville.HOTween.LoopType.Restart;
        LeanTweenType leanLoopType = testSetup == TestSetup.YoyoLoop ? LeanTweenType.pingPong : LeanTweenType.clamp;
        GoLoopType    goLoopType   = testSetup == TestSetup.YoyoLoop ? GoLoopType.PingPong : GoLoopType.RestartFromBeginning;

        iTween.LoopType iTweenLoopType = loops != -1 ? iTween.LoopType.none : testSetup == TestSetup.YoyoLoop ? iTween.LoopType.pingPong : iTween.LoopType.loop;
        // Create tweens
        switch (testType)
        {
        case TestType.Floats:
            for (int i = 0; i < numTweens; ++i)
            {
                TestObjectData data = testObjsData[i];
                switch (engine)
                {
                case Engine.HOTween:
                    HOTween.To(data, duration, new Holoville.HOTween.TweenParms()
                               .Prop("floatValue", rndFloats[i])
                               .Ease(hotweenEase)
                               .Loops(loops, hotweenLoopType)
                               );
                    break;

                case Engine.LeanTween:
                    LeanTween.value(this.gameObject, x => data.floatValue = x, data.floatValue, rndFloats[i], duration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                    break;

                case Engine.GoKit:
                    Go.to(data, duration, new GoTweenConfig()
                          .floatProp("floatValueProperty", rndFloats[i])
                          .setEaseType(goEase)
                          .setIterations(loops, goLoopType)
                          );
                    break;

                case Engine.iTween:
                    Hashtable hs = new Hashtable();
                    hs.Add("from", data.floatValue);
                    hs.Add("to", rndFloats[i]);
                    hs.Add("time", duration);
                    hs.Add("onupdate", "UpdateiTweenFloat");
                    hs.Add("looptype", iTweenLoopType);
                    hs.Add("easetype", iTweenEase);
                    iTween.ValueTo(this.gameObject, hs);
                    break;

                default:
                    // tCopy is needed to create correct closure object,
                    // otherwise closure will pass the same t to all the loop
                    TestObjectData dataCopy = data;
                    DOTween.To(() => dataCopy.floatValue, x => dataCopy.floatValue = x, rndFloats[i], duration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                    break;
                }
            }
            break;

        default:
            for (int i = 0; i < numTweens; ++i)
            {
                float      twDuration = testSetup == TestSetup.Emit ? UnityEngine.Random.Range(0.25f, 1f) : duration;
                Transform  t          = testObjsTrans[i];
                GameObject go         = testObjsGos[i];         // Used by LeanTween and iTween
                switch (engine)
                {
                case Engine.HOTween:
                    Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms()
                                                      .Ease(hotweenEase)
                                                      .Loops(loops, hotweenLoopType);
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        tp.Prop("position", toPos);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenPositionFor(t, toPos, twDuration, hotweenEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        tp.Prop("rotation", toRot);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenRotationFor(t, toRot, twDuration, hotweenEase));
                        }
                    }
                    if (scaleTween)
                    {
                        tp.Prop("localScale", rndScale);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenScaleFor(t, rndScale, twDuration, hotweenEase));
                        }
                    }
                    HOTween.To(t, twDuration, tp);
                    break;

                case Engine.LeanTween:
                    LTDescr leanTween;
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        leanTween = LeanTween.move(go, rndPositions[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenPositionFor(t, go, toPos, twDuration, leanEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        leanTween = LeanTween.rotate(go, rndRotations[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenRotationFor(t, go, toRot, twDuration, leanEase));
                        }
                    }
                    if (scaleTween)
                    {
                        leanTween = LeanTween.scale(go, rndScale, twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenScaleFor(t, go, rndScale, twDuration, leanEase));
                        }
                    }
                    break;

                case Engine.GoKit:
                    GoTweenConfig goConfig = new GoTweenConfig()
                                             .setEaseType(goEase)
                                             .setIterations(loops, goLoopType);
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        goConfig.addTweenProperty(new PositionTweenProperty(toPos));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitPositionFor(t, toPos, twDuration, goEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        goConfig.addTweenProperty(new RotationTweenProperty(toRot));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitRotationFor(t, toRot, twDuration, goEase));
                        }
                    }
                    if (scaleTween)
                    {
                        goConfig.addTweenProperty(new ScaleTweenProperty(rndScale));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitScaleFor(t, rndScale, twDuration, goEase));
                        }
                    }
                    Go.to(t, twDuration, goConfig);
                    break;

                case Engine.iTween:
                    Hashtable hs;
                    if (positionTween)
                    {
                        hs = new Hashtable();
                        hs.Add("position", rndPositions[i]);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.MoveTo(go, hs);
                    }
                    if (rotationTween)
                    {
                        hs = new Hashtable();
                        hs.Add("rotation", rndRotations[i]);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.RotateTo(go, hs);
                    }
                    if (scaleTween)
                    {
                        hs = new Hashtable();
                        hs.Add("scale", rndScale);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.ScaleTo(go, hs);
                    }
                    break;

                default:
                    // tCopy is needed to create correct closure object,
                    // otherwise closure will pass the same t to all the loop
                    Transform         tCopy = t;
                    DG.Tweening.Tween dotween;
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        dotween = tCopy.DOMove(toPos, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenPositionFor(t, toPos, twDuration, dotweenEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        dotween = tCopy.DORotate(toRot, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenRotationFor(t, toRot, twDuration, dotweenEase));
                        }
                    }
                    if (scaleTween)
                    {
                        dotween = tCopy.DOScale(rndScale, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenScaleFor(t, rndScale, twDuration, dotweenEase));
                        }
                    }
                    break;
                }
            }
            break;
        }
    }
 public override void Reset()
 {
     base.Reset();
     gameObject = null;
     duration   = new FsmFloat {
         UseVariable = false
     };
     setSpeedBased = new FsmBool {
         UseVariable = false, Value = false
     };
     pathType   = PathType.Linear;
     pathMode   = PathMode.Full3D;
     resolution = new FsmInt {
         UseVariable = false, Value = 10
     };
     gizmoColor = new FsmColor {
         UseVariable = false
     };
     closePath = new FsmBool {
         UseVariable = false, Value = false
     };
     lockPosition   = AxisConstraint.None;
     lockRotation   = AxisConstraint.None;
     lookAt         = LookAt.nothing;
     lookAtPosition = new FsmVector3 {
         UseVariable = false, Value = Vector3.zero
     };
     lookAtTarget = new FsmGameObject {
         UseVariable = false, Value = null
     };
     lookAhead = new FsmFloat {
         UseVariable = false, Value = 0
     };
     forwardDirection = new FsmVector3 {
         UseVariable = false, Value = Vector3.forward
     };
     up = new FsmVector3 {
         UseVariable = false, Value = Vector3.up
     };
     startEvent        = null;
     finishEvent       = null;
     finishImmediately = new FsmBool {
         UseVariable = false, Value = false
     };
     startDelay = new FsmFloat {
         Value = 0
     };
     easeType = Ease.Linear;
     loops    = new FsmInt {
         Value = 0
     };
     loopType             = DG.Tweening.LoopType.Restart;
     autoKillOnCompletion = new FsmBool {
         Value = true
     };
     recyclable = new FsmBool {
         Value = false
     };
     updateType          = UpdateType.Normal;
     isIndependentUpdate = new FsmBool {
         Value = false
     };
     debugThis = new FsmBool {
         Value = false
     };
 }