Example #1
1
 public void StartEffect(string text, float duration)
 {
     _renderState = RenderState.Rendering;
     _sequense = null;
     _sequense = DOTween.Sequence();
     _animation = _textUI.DOText(text, duration);
     _sequense.Append(_animation);
     _sequense.AppendCallback(new TweenCallback(FinishDisplay));
 }
Example #2
0
    static int PrependCallback(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(DG.Tweening.Sequence), typeof(LuaInterface.LuaFunction)))
            {
                DG.Tweening.Sequence arg0 = (DG.Tweening.Sequence)ToLua.ToObject(L, 1);
                LuaFunction          arg1 = ToLua.ToLuaFunction(L, 2);
                DG.Tweening.Sequence o    = TweenUtils.PrependCallback(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(DG.Tweening.Sequence), typeof(LuaInterface.LuaFunction), typeof(object)))
            {
                DG.Tweening.Sequence arg0 = (DG.Tweening.Sequence)ToLua.ToObject(L, 1);
                LuaFunction          arg1 = ToLua.ToLuaFunction(L, 2);
                object arg2            = ToLua.ToVarObject(L, 3);
                DG.Tweening.Sequence o = TweenUtils.PrependCallback(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: TweenUtils.PrependCallback"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int InsertCallback(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        DG.Tweening.Sequence arg0 = (DG.Tweening.Sequence)LuaScriptMgr.GetNetObject(L, 1, typeof(DG.Tweening.Sequence));
        float arg1 = (float)LuaScriptMgr.GetNumber(L, 2);

        DG.Tweening.TweenCallback arg2 = null;
        LuaTypes funcType3             = LuaDLL.lua_type(L, 3);

        if (funcType3 != LuaTypes.LUA_TFUNCTION)
        {
            arg2 = (DG.Tweening.TweenCallback)LuaScriptMgr.GetNetObject(L, 3, typeof(DG.Tweening.TweenCallback));
        }
        else
        {
            LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 3);
            arg2 = () =>
            {
                func.Call();
            };
        }

        DG.Tweening.Sequence o = DG.Tweening.TweenSettingsExtensions.InsertCallback(arg0, arg1, arg2);
        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Example #4
0
        internal static Sequence DoInsert(Sequence inSequence, Tween t, float atPosition)
        {
            TweenManager.AddActiveTweenToSequence(t);

            // If t has a delay add it as an interval
            atPosition += t.delay;
            inSequence.lastTweenInsertTime = atPosition;

            t.isSequenced = t.creationLocked = true;
            t.sequenceParent = inSequence;
            if (t.loops == -1) t.loops = 1;
            float tFullTime = t.duration * t.loops;
            t.autoKill = false;
            t.delay = t.elapsedDelay = 0;
            t.delayComplete = true;
            t.isSpeedBased = false;
            t.sequencedPosition = atPosition;
            t.sequencedEndPosition = atPosition + tFullTime;

            if (t.sequencedEndPosition > inSequence.duration) inSequence.duration = t.sequencedEndPosition;
            inSequence._sequencedObjs.Add(t);
            inSequence.sequencedTweens.Add(t);

            return inSequence;
        }
Example #5
0
    static int InsertCallback(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 3);
            ToLua_DG_Tweening_Sequence obj = (ToLua_DG_Tweening_Sequence)ToLua.CheckObject(L, 1, typeof(ToLua_DG_Tweening_Sequence));
            float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            DG.Tweening.TweenCallback arg1 = null;
            LuaTypes funcType3             = LuaDLL.lua_type(L, 3);

            if (funcType3 != LuaTypes.LUA_TFUNCTION)
            {
                arg1 = (DG.Tweening.TweenCallback)ToLua.CheckObject(L, 3, typeof(DG.Tweening.TweenCallback));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 3);
                arg1 = DelegateFactory.CreateDelegate(typeof(DG.Tweening.TweenCallback), func) as DG.Tweening.TweenCallback;
            }

            DG.Tweening.Sequence o = obj.InsertCallback(arg0, arg1);
            ToLua.PushObject(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static int Join(IntPtr L)
 {
     LuaScriptMgr.CheckArgsCount(L, 2);
     DG.Tweening.Sequence arg0 = (DG.Tweening.Sequence)LuaScriptMgr.GetNetObject(L, 1, typeof(DG.Tweening.Sequence));
     DG.Tweening.Tween    arg1 = (DG.Tweening.Tween)LuaScriptMgr.GetNetObject(L, 2, typeof(DG.Tweening.Tween));
     DG.Tweening.Sequence o    = DG.Tweening.TweenSettingsExtensions.Join(arg0, arg1);
     LuaScriptMgr.PushObject(L, o);
     return(1);
 }
    static int AppendInterval(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        DG.Tweening.Sequence arg0 = (DG.Tweening.Sequence)LuaScriptMgr.GetNetObject(L, 1, typeof(DG.Tweening.Sequence));
        float arg1 = (float)LuaScriptMgr.GetNumber(L, 2);

        DG.Tweening.Sequence o = DG.Tweening.TweenSettingsExtensions.AppendInterval(arg0, arg1);
        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
    static int AppendSeqCallback(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        DG.Tweening.Sequence arg0 = (DG.Tweening.Sequence)LuaScriptMgr.GetNetObject(L, 1, typeof(DG.Tweening.Sequence));
        LuaFunction          arg1 = LuaScriptMgr.GetLuaFunction(L, 2);

        DG.Tweening.Sequence o = DOTweenLuaUtils.AppendSeqCallback(arg0, arg1);
        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
    static int Insert(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        DG.Tweening.Sequence arg0 = (DG.Tweening.Sequence)LuaScriptMgr.GetNetObject(L, 1, typeof(DG.Tweening.Sequence));
        float arg1 = (float)LuaScriptMgr.GetNumber(L, 2);

        DG.Tweening.Tween    arg2 = (DG.Tweening.Tween)LuaScriptMgr.GetNetObject(L, 3, typeof(DG.Tweening.Tween));
        DG.Tweening.Sequence o    = DG.Tweening.TweenSettingsExtensions.Insert(arg0, arg1, arg2);
        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Example #10
0
 private void RotateAngle(GameObject moveObject)
 {
     angleSequence = AppUtil.DOSequence(
         new DG.Tweening.Tween[] {
         AppUtil.Rotate(moveObject.transform, new Vector3(0f, 0f, 70f), 2f, "OutQuart"),
         AppUtil.Rotate(moveObject.transform, new Vector3(0f, 0f, -70f), 2f, "OutQuart")
     },
         0f,
         0f,
         -1
         );
 }
Example #11
0
        internal static Sequence DoPrependInterval(Sequence inSequence, float interval)
        {
            inSequence.duration += interval;
            int len = inSequence._sequencedObjs.Count;
            for (int i = 0; i < len; ++i) {
                ABSSequentiable sequentiable = inSequence._sequencedObjs[i];
                sequentiable.sequencedPosition += interval;
                sequentiable.sequencedEndPosition += interval;
            }

            return inSequence;
        }
        protected override void OnStartMinigame()
        {
            actualSecondsPerPass = SecondsPerPass / StartInfo.SpeedFactor;
            
            var ease = Ease.InOutSine;

            Player.localPosition = Left.localPosition;

            sequence = DOTween.Sequence()
                .Append(Player.DOLocalMoveX(Right.localPosition.x, SecondsPerPass).SetEase(ease).OnStepComplete(FlipPlayerRight))
                .Append(Player.DOLocalMoveX(Left.localPosition.x, SecondsPerPass).SetEase(ease).OnStepComplete(FlipPlayerLeft))
                .SetLoops(-1);
        }
Example #13
0
 static int CreateSequence(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 0);
         DG.Tweening.Sequence o = TweenUtils.CreateSequence();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #14
0
        internal static Sequence DoPrepend(Sequence inSequence, Tween t)
        {
            if (t.loops == -1) t.loops = 1;
            float tFullTime = t.delay + (t.duration * t.loops);
            inSequence.duration += tFullTime;
            int len = inSequence._sequencedObjs.Count;
            for (int i = 0; i < len; ++i) {
                ABSSequentiable sequentiable = inSequence._sequencedObjs[i];
                sequentiable.sequencedPosition += tFullTime;
                sequentiable.sequencedEndPosition += tFullTime;
            }

            return DoInsert(inSequence, t, 0);
        }
Example #15
0
    static int DOJumpAnchorPos(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 6);
        RectTransform arg0 = (RectTransform)LuaScriptMgr.GetUnityObject(L, 1, typeof(RectTransform));
        Vector2       arg1 = LuaScriptMgr.GetVector2(L, 2);
        float         arg2 = (float)LuaScriptMgr.GetNumber(L, 3);
        int           arg3 = (int)LuaScriptMgr.GetNumber(L, 4);
        float         arg4 = (float)LuaScriptMgr.GetNumber(L, 5);
        bool          arg5 = LuaScriptMgr.GetBoolean(L, 6);

        DG.Tweening.Sequence o = DG.Tweening.ShortcutExtensions46.DOJumpAnchorPos(arg0, arg1, arg2, arg3, arg4, arg5);
        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
        private void AnimateGuardian()
        {
            animatedGuardian.SetActive(true);
            guardianSequence = DOTween.Sequence();
            guardianSequence.Append(animatedGuardian.transform.DOMove(finalGuardian.position, guardianAnimationDuration).SetEase(guardianAnimationEase));

            for (int i = 0; i < extraGuardians.Length; i++)
            {
                guardianSequence.Insert(extraAnimationsStartSecond, extraGuardians[i].
                    DOMoveY(finalGuardian.position.y, guardianAnimationDuration - extraAnimationsStartSecond).
                    SetEase(extraGuardiansEase));
            }

            guardianSequence.AppendCallback(OnGuardianAnimationComplete);
        }
Example #17
0
 static int AppendCallback(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence      obj  = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
         DG.Tweening.TweenCallback arg0 = (DG.Tweening.TweenCallback)ToLua.CheckDelegate <DG.Tweening.TweenCallback>(L, 2);
         DG.Tweening.Sequence      o    = obj.AppendCallback(arg0);
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #18
0
 static int AppendInterval(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence arg0 = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
         float arg1             = (float)LuaDLL.luaL_checknumber(L, 2);
         DG.Tweening.Sequence o = TweenUtils.AppendInterval(arg0, arg1);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #19
0
 static int Join(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence arg0 = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
         DG.Tweening.Tween    arg1 = (DG.Tweening.Tween)ToLua.CheckObject(L, 2, typeof(DG.Tweening.Tween));
         DG.Tweening.Sequence o    = TweenUtils.Join(arg0, arg1);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #20
0
    private void SlidePos(GameObject moveObject)
    {
        moveObject = moveObject.transform.parent.gameObject;
        Vector3 originPos = moveObject.transform.position;
        Vector3 targetPos = new Vector3(originPos.x - 10f, originPos.y, originPos.z);

        angleSequence = AppUtil.DOSequence(
            new DG.Tweening.Tween[] {
            AppUtil.Move(moveObject.transform, moveObject.transform.position, targetPos, 3f),
            AppUtil.Move(moveObject.transform, moveObject.transform.position, originPos, 3f),
        },
            0f,
            0f,
            -1
            );
    }
 static int AppendInterval(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence obj = (DG.Tweening.Sequence)ToLua.CheckObject <DG.Tweening.Sequence>(L, 1);
         float arg0             = (float)LuaDLL.luaL_checknumber(L, 2);
         DG.Tweening.Sequence o = obj.AppendInterval(arg0);
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int Prepend(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence obj  = (DG.Tweening.Sequence)ToLua.CheckObject <DG.Tweening.Sequence>(L, 1);
         DG.Tweening.Tween    arg0 = (DG.Tweening.Tween)ToLua.CheckObject <DG.Tweening.Tween>(L, 2);
         DG.Tweening.Sequence o    = obj.Prepend(arg0);
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #23
0
 static int SetDelay(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence obj = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
         float             arg0   = (float)LuaDLL.luaL_checknumber(L, 2);
         DG.Tweening.Tween o      = obj.SetDelay(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int SetTarget(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence obj = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
         object            arg0   = ToLua.ToVarObject(L, 2);
         DG.Tweening.Tween o      = obj.SetTarget(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int OnWaypointChange(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence            obj  = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
         DG.Tweening.TweenCallback <int> arg0 = (DG.Tweening.TweenCallback <int>)ToLua.CheckDelegate <DG.Tweening.TweenCallback <int> >(L, 2);
         DG.Tweening.Tween o = obj.OnWaypointChange(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int OnStart(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence      obj  = (DG.Tweening.Sequence)ToLua.CheckObject <DG.Tweening.Sequence>(L, 1);
         DG.Tweening.TweenCallback arg0 = (DG.Tweening.TweenCallback)ToLua.CheckDelegate <DG.Tweening.TweenCallback>(L, 2);
         DG.Tweening.Tween         o    = obj.OnStart(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #27
0
 static int PrependInterval(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         ToLua_DG_Tweening_Sequence obj = (ToLua_DG_Tweening_Sequence)ToLua.CheckObject(L, 1, typeof(ToLua_DG_Tweening_Sequence));
         float arg0             = (float)LuaDLL.luaL_checknumber(L, 2);
         DG.Tweening.Sequence o = obj.PrependInterval(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #28
0
 static int QPYX_SetAlphaYoyo_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 3);
         UnityEngine.UI.Image QPYX_arg0_YXQP = (UnityEngine.UI.Image)ToLua.CheckObject <UnityEngine.UI.Image>(L_YXQP, 1);
         float QPYX_arg1_YXQP             = (float)LuaDLL.luaL_checknumber(L_YXQP, 2);
         float QPYX_arg2_YXQP             = (float)LuaDLL.luaL_checknumber(L_YXQP, 3);
         DG.Tweening.Sequence QPYX_o_YXQP = CustomerUtil.SetAlphaYoyo(QPYX_arg0_YXQP, QPYX_arg1_YXQP, QPYX_arg2_YXQP);
         ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Example #29
0
 static int QPYX_DOGradientColor_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 3);
         UnityEngine.UI.Image QPYX_obj_YXQP  = (UnityEngine.UI.Image)ToLua.CheckObject <UnityEngine.UI.Image>(L_YXQP, 1);
         UnityEngine.Gradient QPYX_arg0_YXQP = (UnityEngine.Gradient)ToLua.CheckObject(L_YXQP, 2, typeof(UnityEngine.Gradient));
         float QPYX_arg1_YXQP             = (float)LuaDLL.luaL_checknumber(L_YXQP, 3);
         DG.Tweening.Sequence QPYX_o_YXQP = QPYX_obj_YXQP.DOGradientColor(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
         ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int QPYX_Insert_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 3);
         DG.Tweening.Sequence QPYX_obj_YXQP  = (DG.Tweening.Sequence)ToLua.CheckObject(L_YXQP, 1, typeof(DG.Tweening.Sequence));
         float                QPYX_arg0_YXQP = (float)LuaDLL.luaL_checknumber(L_YXQP, 2);
         DG.Tweening.Tween    QPYX_arg1_YXQP = (DG.Tweening.Tween)ToLua.CheckObject <DG.Tweening.Tween>(L_YXQP, 3);
         DG.Tweening.Sequence QPYX_o_YXQP    = QPYX_obj_YXQP.Insert(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
         ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int Append(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.Sequence obj  = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
         DG.Tweening.Tween    arg0 = (DG.Tweening.Tween)ToLua.CheckObject(L, 2, typeof(DG.Tweening.Tween));
         DG.Tweening.Sequence o    = obj.Append(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #32
0
 static int SetAlphaYoyo(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityEngine.UI.Image arg0 = (UnityEngine.UI.Image)ToLua.CheckObject <UnityEngine.UI.Image>(L, 1);
         float arg1             = (float)LuaDLL.luaL_checknumber(L, 2);
         float arg2             = (float)LuaDLL.luaL_checknumber(L, 3);
         DG.Tweening.Sequence o = CustomerUtil.SetAlphaYoyo(arg0, arg1, arg2);
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #33
0
        static int _m_DOJumpAnchorPos(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                UnityEngine.RectTransform gen_to_be_invoked = (UnityEngine.RectTransform)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 6 && translator.Assignable <UnityEngine.Vector2>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 6))
                {
                    UnityEngine.Vector2 _endValue; translator.Get(L, 2, out _endValue);
                    float _jumpPower = (float)LuaAPI.lua_tonumber(L, 3);
                    int   _numJumps  = LuaAPI.xlua_tointeger(L, 4);
                    float _duration  = (float)LuaAPI.lua_tonumber(L, 5);
                    bool  _snapping  = LuaAPI.lua_toboolean(L, 6);

                    DG.Tweening.Sequence gen_ret = gen_to_be_invoked.DOJumpAnchorPos(_endValue, _jumpPower, _numJumps, _duration, _snapping);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 5 && translator.Assignable <UnityEngine.Vector2>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
                {
                    UnityEngine.Vector2 _endValue; translator.Get(L, 2, out _endValue);
                    float _jumpPower = (float)LuaAPI.lua_tonumber(L, 3);
                    int   _numJumps  = LuaAPI.xlua_tointeger(L, 4);
                    float _duration  = (float)LuaAPI.lua_tonumber(L, 5);

                    DG.Tweening.Sequence gen_ret = gen_to_be_invoked.DOJumpAnchorPos(_endValue, _jumpPower, _numJumps, _duration);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.RectTransform.DOJumpAnchorPos!"));
        }
 static int Insert(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         DG.Tweening.Sequence obj  = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
         float                arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         DG.Tweening.Tween    arg1 = (DG.Tweening.Tween)ToLua.CheckObject <DG.Tweening.Tween>(L, 3);
         DG.Tweening.Sequence o    = obj.Insert(arg0, arg1);
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #35
0
 static int DOGradientColor(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityEngine.UI.Image obj  = (UnityEngine.UI.Image)ToLua.CheckObject <UnityEngine.UI.Image>(L, 1);
         UnityEngine.Gradient arg0 = (UnityEngine.Gradient)ToLua.CheckObject <UnityEngine.Gradient>(L, 2);
         float arg1             = (float)LuaDLL.luaL_checknumber(L, 3);
         DG.Tweening.Sequence o = obj.DOGradientColor(arg0, arg1);
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #36
0
 static int DoJump(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 5);
         UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.Transform));
         UnityEngine.Vector3   arg1 = ToLua.ToVector3(L, 2);
         float arg2             = (float)LuaDLL.luaL_checknumber(L, 3);
         int   arg3             = (int)LuaDLL.luaL_checknumber(L, 4);
         int   arg4             = (int)LuaDLL.luaL_checknumber(L, 5);
         DG.Tweening.Sequence o = TweenUtils.DoJump(arg0, arg1, arg2, arg3, arg4);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #37
0
        void Start()
        {
            _initialized = true;

            _isRadioButton = _toggleGroupid != "";

            List<IHOtk2dBase> childrenSprites = null;
            bool hasChildrenToTween = false;
            bool hasTextMeshesToTween = false;
            if (_tweenChildren && _tweenColorOn != ButtonActionType.None) {
                Component[] children = gameObject.GetComponentsInChildren(typeof(IHOtk2dBase));
                childrenSprites = new List<IHOtk2dBase>();
                foreach (Component child in children) {
                    if (child == sprite) continue;
                    childrenSprites.Add(child as IHOtk2dBase);
                    IHOtk2dTextMesh txtMesh = child as IHOtk2dTextMesh;
                    if (txtMesh != null) _txtMeshesToUpdate.Add(txtMesh);
                }
                hasChildrenToTween = childrenSprites.Count > 0;
                hasTextMeshesToTween = _txtMeshesToUpdate.Count > 0;
            }

            // Hide eventual tooltip
            if (_tooltip != null) {
                _tooltip.SetActive(false);
                _showTooltip = true;
            }

            // Create tweens
            if (hasRollover) {
                _rolloutTween = DOTween.Sequence().SetUpdate(true).SetAutoKill(false)
                    .OnKill(() =>_rolloutTween = null)
                    .Pause();
                if (hasTextMeshesToTween) _rolloutTween.OnUpdate(UpdateTextMeshes);
                if (_tweenScaleOn == ButtonActionType.OnRollover)
                    _rolloutTween.Insert(0, trans.DOScale(trans.localScale * _tweenScaleMultiplier, _TweenDuration).From());
                if (_tweenColorOn == ButtonActionType.OnRollover) {
                    _rolloutTween.Insert(0, DOTween.To(() => sprite.color, x => sprite.color = x, _tweenColor, _TweenDuration).From());
                    if (hasChildrenToTween) {
                        foreach (IHOtk2dBase childSprite in childrenSprites) {
                            IHOtk2dBase s = childSprite;
                            _rolloutTween.Insert(0, DOTween.To(() => s.color, x => s.color = x, _tweenColor, _TweenDuration).From());
                        }
                    }
                }
                _rolloutTween.Complete();
            }
            if (_tweenColorOn == ButtonActionType.OnPress || _tweenScaleOn == ButtonActionType.OnPress) {
                _unpressTween = DOTween.Sequence().SetUpdate(true).SetAutoKill(false)
                    .OnKill(() => _unpressTween = null)
                    .Pause();
                if (hasTextMeshesToTween) _unpressTween.OnUpdate(UpdateTextMeshes);
                if (_tweenScaleOn == ButtonActionType.OnPress)
                    _unpressTween.Insert(0, trans.DOScale(trans.localScale * _tweenScaleMultiplier, _TweenDuration).From());
                if (_tweenColorOn == ButtonActionType.OnPress) {
                    _unpressTween.Insert(0, DOTween.To(() => sprite.color, x => sprite.color = x, _tweenColor, _TweenDuration).From());
                    if (hasChildrenToTween) {
                        foreach (IHOtk2dBase childSprite in childrenSprites) {
                            IHOtk2dBase s = childSprite;
                            _rolloutTween.Insert(0, DOTween.To(() => s.color, x => s.color = x, _tweenColor, _TweenDuration).From());
                        }
                    }
                }
                _unpressTween.Complete();
            }
            if (_tweenColorOn == ButtonActionType.OnClick || _tweenScaleOn == ButtonActionType.OnClick) {
                _unclickTween = DOTween.Sequence().SetUpdate(true).SetAutoKill(false)
                    .OnKill(() => _unclickTween = null)
                    .Pause();
                if (hasTextMeshesToTween) _unclickTween.OnUpdate(UpdateTextMeshes);
                if (_tweenScaleOn == ButtonActionType.OnClick)
                    _unclickTween.Insert(0.15f, trans.DOScale(trans.localScale * _tweenScaleMultiplier, _TweenDuration).From());
                if (_tweenColorOn == ButtonActionType.OnClick) {
                    _unclickTween.Insert(0.15f, DOTween.To(() => sprite.color, x => sprite.color = x, _tweenColor, _TweenDuration).From());
                    if (hasChildrenToTween) {
                        foreach (IHOtk2dBase childSprite in childrenSprites) {
                            IHOtk2dBase s = childSprite;
                            _rolloutTween.Insert(0, DOTween.To(() => s.color, x => s.color = x, _tweenColor, _TweenDuration).From());
                        }
                    }
                }
                _unclickTween.Complete();
            }

            // Execute eventual cued actions
            if (_preinitActionsQueue != null) {
                foreach (PreinitActionType visualActionType in _preinitActionsQueue) {
                    switch (visualActionType) {
                    case PreinitActionType.ToggleOn:
                        ToggleOn();
                        break;
                    case PreinitActionType.ToggleOnWithoutEventDispatching:
                        ToggleOn(false);
                        break;
                    case PreinitActionType.ToggleOff:
                        ToggleOff();
                        break;
                    case PreinitActionType.ToggleOffWithoutEventDispatching:
                        ToggleOff(false);
                        break;
                    }
                }
            }
        }
        private void InitLevelsAlarms()
        {
            var shieldFrequency = 0.3f;
            shieldGaugeBackgroundImageOriginalColor = shieldGaugeBackgroundImage.color.Copy();
            shieldAlarmSequence = DOTween.Sequence();
            shieldAlarmSequence.Append(shieldGaugeBackgroundImage.DOColor(new Color(1f, 0, 0, 1f), shieldFrequency));
            shieldAlarmSequence.Append(shieldGaugeBackgroundImage.DOColor(shieldGaugeBackgroundImageOriginalColor, shieldFrequency));
            shieldAlarmSequence.SetLoops(-1);
            shieldAlarmSequence.Pause();

            var hullFrequency = 0.1f;
            hullGaugeBackgroundImageOriginalColor = hullGaugeBackgroundImage.color.Copy();
            hullAlarmSequence = DOTween.Sequence();
            hullAlarmSequence.Append(hullGaugeBackgroundImage.DOColor(new Color(1f, 0, 0, 1f), hullFrequency));
            hullAlarmSequence.Append(hullGaugeBackgroundImage.DOColor(hullGaugeBackgroundImageOriginalColor, hullFrequency));
            hullAlarmSequence.Insert(0, alarmLight.DOIntensity(alarmLightHighIntensity, hullFrequency));
            hullAlarmSequence.Insert(hullFrequency, alarmLight.DOIntensity(alarmLightLowIntensity, hullFrequency));
            hullAlarmSequence.SetLoops(-1);
            hullAlarmSequence.Pause();
        }
Example #39
0
        void Update()
        {
            float deltaTime = Time.deltaTime;

            if( sequenceLock.Tick(deltaTime) )
            {
                mySequence = null;
            }
            RecomputeForward();
        }
Example #40
0
        // Returns TRUE in case of success
        internal static bool DoStartup(Sequence s)
        {
            if (s.sequencedTweens.Count == 0 && s._sequencedObjs.Count == 0
                && s.onComplete == null && s.onKill == null && s.onPause == null && s.onPlay == null && s.onRewind == null
                && s.onStart == null && s.onStepComplete == null && s.onUpdate == null
            ) return false; // Empty Sequence without any callback set

            s.startupDone = true;
            s.fullDuration = s.loops > -1 ? s.duration * s.loops : Mathf.Infinity;
            // Order sequencedObjs by start position
            s._sequencedObjs.Sort(SortSequencedObjs);
            // Set relative nested tweens
            if (s.isRelative) {
                for (int len = s.sequencedTweens.Count, i = 0; i < len; ++i) {
                    Tween t = s.sequencedTweens[i];
                    if (!s.isBlendable) s.sequencedTweens[i].isRelative = true;
                }
            }
            return true;
        }
Example #41
0
        public void Rotate(float deltaTime, float horizontalAxis, float verticalAxis)
        {
            bool isTurn = false;
            if( Mathf.Abs(verticalAxis) > 0.01f)
            {
                AddPitch(deltaTime, verticalAxis);
                RecomputeForward();
            }

            if( Mathf.Abs(horizontalAxis) > 0.8f)
            {
                isTurn = AddTurn(deltaTime, horizontalAxis);
            }

            if( isTurn )
            {
                speed = 0f;
                Vector3 backwards = Vector3.zero;
                if( this.transform.forward.z > 0f )
                {
                    backwards.z = -1f;
                }
                else
                {
                    backwards.z = 1f;
                }
                float duration = 0.25f;
                sequenceLock = new BasicTimer(duration, false);
                mySequence = DOTween.Sequence();
                mySequence.Append(transform.DOLookAt(thisTransform.position + backwards, duration, AxisConstraint.None));
            }
        }
Example #42
0
        // Returns TRUE in case of success
        internal static bool DoStartup(Sequence s)
        {
            if (s.sequencedTweens.Count == 0 && s._sequencedObjs.Count == 0
                && s.onComplete == null && s.onKill == null && s.onPause == null && s.onPlay == null && s.onRewind == null
                && s.onStart == null && s.onStepComplete == null && s.onUpdate == null
            ) return false; // Empty Sequence without any callback set

            s.startupDone = true;
            s.fullDuration = s.loops > -1 ? s.duration * s.loops : Mathf.Infinity;
            // Order sequencedObjs by start position
            s._sequencedObjs.Sort(SortSequencedObjs);
            return true;
        }
 public override void Execute()
 {
     var sequence = DG.Tweening.DOTween.Sequence();
     CreatedSequence = sequence;
     sequence.Pause();
 }
Example #44
0
        // Applies the tween set by DoGoto.
        // Returns TRUE if the tween needs to be killed
        internal static bool DoApplyTween(Sequence s, float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode)
        {
            // Adapt to eventual ease position
            float prevPos = prevPosition;
            float newPos = s.position;
            if (s.easeType != Ease.Linear) {
                prevPos = s.duration * EaseManager.Evaluate(s.easeType, s.customEase, prevPos, s.duration, s.easeOvershootOrAmplitude, s.easePeriod);
                newPos = s.duration * EaseManager.Evaluate(s.easeType, s.customEase, newPos, s.duration, s.easeOvershootOrAmplitude, s.easePeriod);
            }


            float from, to = 0;
            // Determine if prevPos was inverse.
            // Used to calculate correct "from" value when applying internal cycle
            // and also in case of multiple loops within a single update
            bool prevPosIsInverse = s.loopType == LoopType.Yoyo
                && (prevPos < s.duration ? prevCompletedLoops % 2 != 0 : prevCompletedLoops % 2 == 0);
            if (s.isBackwards) prevPosIsInverse = !prevPosIsInverse;
            // Update multiple loop cycles within the same update
            if (newCompletedSteps > 0) {
                // Store expected completedLoops and position, in order to check them after the update cycles.
                int expectedCompletedLoops = s.completedLoops + newCompletedSteps;
                float expectedPosition = s.position;
                //
                int cycles = newCompletedSteps;
                int cyclesDone = 0;
                from = prevPos;
                if (updateMode == UpdateMode.Update) {
                    // Run all cycles elapsed since last update
                    while (cyclesDone < cycles) {
                        if (cyclesDone > 0) from = to;
                        else if (prevPosIsInverse && !s.isBackwards) from = s.duration - from;
                        to = prevPosIsInverse ? 0 : s.duration;
                        if (ApplyInternalCycle(s, from, to, updateMode, useInversePosition, prevPosIsInverse, true)) return true;
                        cyclesDone++;
                        if (s.loopType == LoopType.Yoyo) prevPosIsInverse = !prevPosIsInverse;
                    }
                } else {
                    // Simply determine correct prevPosition after steps
                    if (s.loopType == LoopType.Yoyo && newCompletedSteps % 2 != 0) {
                        prevPosIsInverse = !prevPosIsInverse;
                        prevPos = s.duration - prevPos;
                    }
                    newCompletedSteps = 0;
                }
                // If completedLoops or position were changed by some callback, exit here
                if (expectedCompletedLoops != s.completedLoops || Math.Abs(expectedPosition - s.position) > Single.Epsilon) return !s.active;
            }
            // Run current cycle
            if (newCompletedSteps == 1 && s.isComplete) return false; // Skip update if complete because multicycle took care of it
            if (newCompletedSteps > 0 && !s.isComplete) {
                from = useInversePosition ? s.duration : 0;
                // In case of Restart loop rewind all tweens (keep "to > 0" or remove it?)
                if (s.loopType == LoopType.Restart && to > 0) ApplyInternalCycle(s, s.duration, 0, UpdateMode.Goto, false, false, false);
            } else from = useInversePosition ? s.duration - prevPos : prevPos;
            return ApplyInternalCycle(s, from, useInversePosition ? s.duration - newPos : newPos, updateMode, useInversePosition, prevPosIsInverse);
        }
Example #45
0
        // ===================================================================================
        // METHODS ---------------------------------------------------------------------------

        // Returns TRUE if the tween needs to be killed
        static bool ApplyInternalCycle(Sequence s, float fromPos, float toPos, UpdateMode updateMode, bool useInverse, bool prevPosIsInverse, bool multiCycleStep = false)
        {
            bool isBackwardsUpdate = toPos < fromPos;
//            Debug.Log(Time.frameCount + " " + s.id + " " + (multiCycleStep ? "<color=#FFEC03>Multicycle</color> > " : "Cycle > ") + s.position + "/" + s.duration + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + " - UpdateMode: " + updateMode + ", isPlaying: " + s.isPlaying);
            if (isBackwardsUpdate) {
                int len = s._sequencedObjs.Count - 1;
                for (int i = len; i > -1; --i) {
                    if (!s.active) return true; // Killed by some internal callback
                    ABSSequentiable sequentiable = s._sequencedObjs[i];
                    if (sequentiable.sequencedEndPosition < toPos || sequentiable.sequencedPosition > fromPos) continue;
                    if (sequentiable.tweenType == TweenType.Callback) {
                        if (updateMode == UpdateMode.Update && prevPosIsInverse) {
//                            Debug.Log("<color=#FFEC03>BACKWARDS Callback > " + s.id + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + "</color>");
                            OnTweenCallback(sequentiable.onStart);
                        }
                    } else {
                        // Nested Tweener/Sequence
                        float gotoPos = toPos - sequentiable.sequencedPosition;
                        if (gotoPos < 0) gotoPos = 0;
                        Tween t = (Tween)sequentiable;
                        if (!t.startupDone) continue; // since we're going backwards and this tween never started just ignore it
                        t.isBackwards = true;
                        if (TweenManager.Goto(t, gotoPos, false, updateMode)) return true;

                        // Fixes nested callbacks not being called correctly if main sequence has loops and nested ones don't
                        if (multiCycleStep && t.tweenType == TweenType.Sequence) {
                            if (s.position <= 0 && s.completedLoops == 0) t.position = 0;
                            else {
                                bool toZero = s.completedLoops == 0 || s.isBackwards && (s.completedLoops < s.loops || s.loops == -1);
                                if (t.isBackwards) toZero = !toZero;
                                if (useInverse) toZero = !toZero;
                                if (s.isBackwards && !useInverse && !prevPosIsInverse) toZero = !toZero;
                                t.position = toZero ? 0 : t.duration;
                            }
                        }
                    }
                }
            } else {
                // Debug
                int len = s._sequencedObjs.Count;
                for (int i = 0; i < len; ++i) {
                    if (!s.active) return true; // Killed by some internal callback
                    ABSSequentiable sequentiable = s._sequencedObjs[i];
                    if (sequentiable.sequencedPosition > toPos || sequentiable.sequencedEndPosition < fromPos) continue;
                    if (sequentiable.tweenType == TweenType.Callback) {
                        if (updateMode == UpdateMode.Update) {
//                            Debug.Log("<color=#FFEC03>FORWARD Callback > " + s.id + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + "</color>");
                            bool fire = !s.isBackwards && !useInverse && !prevPosIsInverse
                                || s.isBackwards && useInverse && !prevPosIsInverse;
                            if (fire) OnTweenCallback(sequentiable.onStart);
                        }
                    } else {
                        // Nested Tweener/Sequence
                        float gotoPos = toPos - sequentiable.sequencedPosition;
                        if (gotoPos < 0) gotoPos = 0;
                        Tween t = (Tween)sequentiable;
                        t.isBackwards = false;
                        if (TweenManager.Goto(t, gotoPos, false, updateMode)) return true;

                        // Fixes nested callbacks not being called correctly if main sequence has loops and nested ones don't
                        if (multiCycleStep && t.tweenType == TweenType.Sequence) {
                            if (s.position <= 0 && s.completedLoops == 0) t.position = 0;
                            else {
                                bool toZero = s.completedLoops == 0 || !s.isBackwards && (s.completedLoops < s.loops || s.loops == -1);
                                if (t.isBackwards) toZero = !toZero;
                                if (useInverse) toZero = !toZero;
                                if (s.isBackwards && !useInverse && !prevPosIsInverse) toZero = !toZero;
                                t.position = toZero ? 0 : t.duration;
                            }
                        }
                    }
                }
            }
            return false;
        }
Example #46
0
 internal static Sequence DoAppendInterval(Sequence inSequence, float interval)
 {
     inSequence.duration += interval;
     return inSequence;
 }
Example #47
0
 internal static Sequence DoInsertCallback(Sequence inSequence, TweenCallback callback, float atPosition)
 {
     SequenceCallback c = new SequenceCallback(atPosition, callback);
     c.sequencedPosition = c.sequencedEndPosition = atPosition;
     inSequence._sequencedObjs.Add(c);
     if (inSequence.duration < atPosition) inSequence.duration = atPosition;
     return inSequence;
 }
Example #48
-1
 // Called by DOTween when spawning/creating a new Sequence.
 internal static void Setup(Sequence s)
 {
     s.autoKill = DOTween.defaultAutoKill;
     s.isRecyclable = DOTween.defaultRecyclable;
     s.isPlaying = DOTween.defaultAutoPlay == AutoPlay.All || DOTween.defaultAutoPlay == AutoPlay.AutoPlaySequences;
     s.loopType = DOTween.defaultLoopType;
     s.easeType = Ease.Linear;
     s.easeOvershootOrAmplitude = DOTween.defaultEaseOvershootOrAmplitude;
     s.easePeriod = DOTween.defaultEasePeriod;
 }