コード例 #1
0
    static int CompletedLoops(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        DG.Tweening.Tween obj = (DG.Tweening.Tween)LuaScriptMgr.GetNetObjectSelf(L, 1, "DG.Tweening.Tween");
        int o = obj.CompletedLoops();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
コード例 #2
0
 static int CompletedLoops(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         DG.Tweening.Tween obj = (DG.Tweening.Tween)ToLua.CheckObject <DG.Tweening.Tween>(L, 1);
         int o = obj.CompletedLoops();
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #3
0
 /// <summary>
 /// Returns an async <see cref="Task"/> that waits until the tween is killed or has gone through the given amount of loops.
 /// It can be used inside an async operation.
 /// <para>Example usage:</para><code>await myTween.AsyncWaitForElapsedLoops();</code>
 /// </summary>
 /// <param name="elapsedLoops">Elapsed loops to wait for</param>
 public static async Task AsyncWaitForElapsedLoops(this Tween t, int elapsedLoops)
 {
     if (!t.active)
     {
         if (Debugger.logPriority > 0)
         {
             Debugger.LogInvalidTween(t);
         }
         return;
     }
     while (t.active && t.CompletedLoops() < elapsedLoops)
     {
         await Task.Yield();
     }
 }
コード例 #4
0
 /// <summary>
 /// Returns an async <see cref="Task"/> that waits until the tween is killed or started
 /// (meaning when the tween is set in a playing state the first time, after any eventual delay).
 /// It can be used inside an async operation.
 /// <para>Example usage:</para><code>await myTween.AsyncWaitForPosition();</code>
 /// </summary>
 /// <param name="position">Position (loops included, delays excluded) to wait for</param>
 public static async Task AsyncWaitForPosition(this Tween t, float position)
 {
     if (!t.active)
     {
         if (Debugger.logPriority > 0)
         {
             Debugger.LogInvalidTween(t);
         }
         return;
     }
     while (t.active && t.position * (t.CompletedLoops() + 1) < position)
     {
         await Task.Yield();
     }
 }
コード例 #5
0
 /// <summary>
 /// Returns an async <see cref="Task"/> that waits until the tween is killed or rewinded.
 /// It can be used inside an async operation.
 /// <para>Example usage:</para><code>await myTween.AsyncWaitForRewind();</code>
 /// </summary>
 public static async Task AsyncWaitForRewind(this Tween t)
 {
     if (!t.active)
     {
         if (Debugger.logPriority > 0)
         {
             Debugger.LogInvalidTween(t);
         }
         return;
     }
     while (t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0))
     {
         await Task.Yield();
     }
 }