1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-12 01:58:47 +08:00

Added all WaitFor fake-overloads that return a CustomYieldInstruction (Unity 5.3 or later)

This commit is contained in:
Demigiant 2018-06-01 21:25:46 +02:00
parent bc02db900d
commit 0d0eea2ead
51 changed files with 352 additions and 40 deletions

View File

@ -114,11 +114,49 @@
These require at least Unity 5.3
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForCompletionCY(DG.Tweening.Tween)">
<member name="M:DG.Tweening.TweenExtensions53.WaitForCompletion(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or complete.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForCompletionCY();</code>
<para>Example usage:</para><code>yield return myTween.WaitForCompletion(true);</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForRewind(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or rewinded.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForRewind();</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForKill(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForKill();</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForElapsedLoops(DG.Tweening.Tween,System.Int32,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or has gone through the given amount of loops.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForElapsedLoops(2);</code>
</summary>
<param name="elapsedLoops">Elapsed loops to wait for</param>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForPosition(DG.Tweening.Tween,System.Single,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or has reached the given position (loops included, delays excluded).
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForPosition(2.5f);</code>
</summary>
<param name="position">Position (loops included, delays excluded) to wait for</param>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForStart(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> 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 a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForStart();</code>
</summary>
</member>
</members>

View File

@ -114,11 +114,49 @@
These require at least Unity 5.3
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForCompletionCY(DG.Tweening.Tween)">
<member name="M:DG.Tweening.TweenExtensions53.WaitForCompletion(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or complete.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForCompletionCY();</code>
<para>Example usage:</para><code>yield return myTween.WaitForCompletion(true);</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForRewind(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or rewinded.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForRewind();</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForKill(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForKill();</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForElapsedLoops(DG.Tweening.Tween,System.Int32,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or has gone through the given amount of loops.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForElapsedLoops(2);</code>
</summary>
<param name="elapsedLoops">Elapsed loops to wait for</param>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForPosition(DG.Tweening.Tween,System.Single,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or has reached the given position (loops included, delays excluded).
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForPosition(2.5f);</code>
</summary>
<param name="position">Position (loops included, delays excluded) to wait for</param>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForStart(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> 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 a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForStart();</code>
</summary>
</member>
</members>

View File

@ -114,11 +114,49 @@
These require at least Unity 5.3
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForCompletionCY(DG.Tweening.Tween)">
<member name="M:DG.Tweening.TweenExtensions53.WaitForCompletion(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or complete.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForCompletionCY();</code>
<para>Example usage:</para><code>yield return myTween.WaitForCompletion(true);</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForRewind(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or rewinded.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForRewind();</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForKill(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForKill();</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForElapsedLoops(DG.Tweening.Tween,System.Int32,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or has gone through the given amount of loops.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForElapsedLoops(2);</code>
</summary>
<param name="elapsedLoops">Elapsed loops to wait for</param>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForPosition(DG.Tweening.Tween,System.Single,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or has reached the given position (loops included, delays excluded).
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForPosition(2.5f);</code>
</summary>
<param name="position">Position (loops included, delays excluded) to wait for</param>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForStart(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> 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 a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForStart();</code>
</summary>
</member>
</members>

View File

@ -13,7 +13,7 @@ public class CustomYieldInstructions : BrainBase
yield return new WaitForSeconds(1);
Debug.Log("01");
yield return target.DOMoveX(2, 1).WaitForCompletionCY();
yield return target.DOMoveX(2, 1).WaitForCompletion(true);
Debug.Log("02");
}
}

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.745";
public static readonly string Version = "1.1.747";
///////////////////////////////////////////////
// Options ////////////////////////////////////

View File

@ -389,6 +389,7 @@ namespace DG.Tweening
return DOTween.instance.StartCoroutine(DOTween.instance.WaitForStart(t));
}
#endregion
#region Info Getters

View File

@ -0,0 +1,107 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/06/01 21:05
// License Copyright (c) Daniele Giardini
// This work is subject to the terms at http://dotween.demigiant.com/license.php
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.CustomYieldInstructions
{
public class DOTweenCYInstruction
{
public class WaitForCompletion : CustomYieldInstruction
{
public override bool keepWaiting {
get {
return t.active && !t.isComplete;
}
}
readonly Tween t;
public WaitForCompletion(Tween tween)
{
t = tween;
}
}
public class WaitForRewind : CustomYieldInstruction
{
public override bool keepWaiting {
get {
return t.active && (!t.playedOnce || t.position * (t.completedLoops + 1) > 0);
}
}
readonly Tween t;
public WaitForRewind(Tween tween)
{
t = tween;
}
}
public class WaitForKill : CustomYieldInstruction
{
public override bool keepWaiting {
get {
return t.active;
}
}
readonly Tween t;
public WaitForKill(Tween tween)
{
t = tween;
}
}
public class WaitForElapsedLoops : CustomYieldInstruction
{
public override bool keepWaiting {
get {
return t.active && t.completedLoops < elapsedLoops;
}
}
readonly Tween t;
readonly int elapsedLoops;
public WaitForElapsedLoops(Tween tween, int elapsedLoops)
{
t = tween;
this.elapsedLoops = elapsedLoops;
}
}
public class WaitForPosition : CustomYieldInstruction
{
public override bool keepWaiting {
get {
return t.active && t.position * (t.completedLoops + 1) < position;
}
}
readonly Tween t;
readonly float position;
public WaitForPosition(Tween tween, float position)
{
t = tween;
this.position = position;
}
}
public class WaitForStart : CustomYieldInstruction
{
public override bool keepWaiting {
get {
return t.active && !t.playedOnce;
}
}
readonly Tween t;
public WaitForStart(Tween tween)
{
t = tween;
}
}
}
}

View File

@ -1,26 +0,0 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/06/01 10:55
// License Copyright (c) Daniele Giardini
// This work is subject to the terms at http://dotween.demigiant.com/license.php
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.CustomYieldInstructions
{
public class WaitForCompletion : CustomYieldInstruction
{
public override bool keepWaiting {
get {
return _tween.active && !_tween.isComplete;
}
}
readonly Tween _tween;
public WaitForCompletion(Tween tween)
{
_tween = tween;
}
}
}

View File

@ -67,7 +67,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CustomYieldInstructions\WaitForCompletion.cs" />
<Compile Include="CustomYieldInstructions\DOTweenCYInstruction.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ShortcutExtensions50.cs" />
<Compile Include="TweenExtensions53.cs" />

View File

@ -20,16 +20,94 @@ namespace DG.Tweening
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or complete.
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForCompletionCY();</code>
/// <para>Example usage:</para><code>yield return myTween.WaitForCompletion(true);</code>
/// </summary>
public static CustomYieldInstruction WaitForCompletionCY(this Tween t)
public static CustomYieldInstruction WaitForCompletion(this Tween t, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new WaitForCompletion(t);
return new DOTweenCYInstruction.WaitForCompletion(t);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or rewinded.
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForRewind();</code>
/// </summary>
public static CustomYieldInstruction WaitForRewind(this Tween t, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForRewind(t);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed.
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForKill();</code>
/// </summary>
public static CustomYieldInstruction WaitForKill(this Tween t, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForKill(t);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or has gone through the given amount of loops.
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForElapsedLoops(2);</code>
/// </summary>
/// <param name="elapsedLoops">Elapsed loops to wait for</param>
public static CustomYieldInstruction WaitForElapsedLoops(this Tween t, int elapsedLoops, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForElapsedLoops(t, elapsedLoops);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or has reached the given position (loops included, delays excluded).
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForPosition(2.5f);</code>
/// </summary>
/// <param name="position">Position (loops included, delays excluded) to wait for</param>
public static CustomYieldInstruction WaitForPosition(this Tween t, float position, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForPosition(t, position);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> 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 a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForStart();</code>
/// </summary>
public static CustomYieldInstruction WaitForStart(this Tween t, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForStart(t);
}
#endregion

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -114,11 +114,49 @@
These require at least Unity 5.3
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForCompletionCY(DG.Tweening.Tween)">
<member name="M:DG.Tweening.TweenExtensions53.WaitForCompletion(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or complete.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForCompletionCY();</code>
<para>Example usage:</para><code>yield return myTween.WaitForCompletion(true);</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForRewind(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or rewinded.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForRewind();</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForKill(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForKill();</code>
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForElapsedLoops(DG.Tweening.Tween,System.Int32,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or has gone through the given amount of loops.
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForElapsedLoops(2);</code>
</summary>
<param name="elapsedLoops">Elapsed loops to wait for</param>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForPosition(DG.Tweening.Tween,System.Single,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> that waits until the tween is killed or has reached the given position (loops included, delays excluded).
It can be used inside a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForPosition(2.5f);</code>
</summary>
<param name="position">Position (loops included, delays excluded) to wait for</param>
</member>
<member name="M:DG.Tweening.TweenExtensions53.WaitForStart(DG.Tweening.Tween,System.Boolean)">
<summary>
Returns a <see cref="T:UnityEngine.CustomYieldInstruction"/> 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 a coroutine as a yield.
<para>Example usage:</para><code>yield return myTween.WaitForStart();</code>
</summary>
</member>
</members>