1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 09:16:02 +08:00

Added "alsoCheckIfIsPlaying" parameter to DOTween.IsTweening

This commit is contained in:
Demigiant 2016-12-07 16:52:13 +01:00
parent 5922a852a4
commit 94c2faae8f
48 changed files with 41 additions and 34 deletions

View File

@ -693,14 +693,17 @@
<summary>Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled
(meaning the tweens that could be played or paused, depending on the toggle state)</summary>
</member>
<member name="M:DG.Tweening.DOTween.IsTweening(System.Object)">
<member name="M:DG.Tweening.DOTween.IsTweening(System.Object,System.Boolean)">
<summary>
Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not).
Returns TRUE if a tween with the given ID or target is active.
<para>You can also use this to know if a shortcut tween is active for a given target.</para>
<para>Example:</para>
<para><code>transform.DOMoveX(45, 1); // transform is automatically added as the tween target</code></para>
<para><code>DOTween.IsTweening(transform); // Returns true</code></para>
</summary>
<param name="targetOrId">The target or ID to look for</param>
<param name="alsoCheckIfIsPlaying">If FALSE (default) returns TRUE as long as a tween for the given target/ID is active,
otherwise also requires it to be playing</param>
</member>
<member name="M:DG.Tweening.DOTween.TotalPlayingTweens">
<summary>

View File

@ -693,14 +693,17 @@
<summary>Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled
(meaning the tweens that could be played or paused, depending on the toggle state)</summary>
</member>
<member name="M:DG.Tweening.DOTween.IsTweening(System.Object)">
<member name="M:DG.Tweening.DOTween.IsTweening(System.Object,System.Boolean)">
<summary>
Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not).
Returns TRUE if a tween with the given ID or target is active.
<para>You can also use this to know if a shortcut tween is active for a given target.</para>
<para>Example:</para>
<para><code>transform.DOMoveX(45, 1); // transform is automatically added as the tween target</code></para>
<para><code>DOTween.IsTweening(transform); // Returns true</code></para>
</summary>
<param name="targetOrId">The target or ID to look for</param>
<param name="alsoCheckIfIsPlaying">If FALSE (default) returns TRUE as long as a tween for the given target/ID is active,
otherwise also requires it to be playing</param>
</member>
<member name="M:DG.Tweening.DOTween.TotalPlayingTweens">
<summary>

View File

@ -693,14 +693,17 @@
<summary>Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled
(meaning the tweens that could be played or paused, depending on the toggle state)</summary>
</member>
<member name="M:DG.Tweening.DOTween.IsTweening(System.Object)">
<member name="M:DG.Tweening.DOTween.IsTweening(System.Object,System.Boolean)">
<summary>
Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not).
Returns TRUE if a tween with the given ID or target is active.
<para>You can also use this to know if a shortcut tween is active for a given target.</para>
<para>Example:</para>
<para><code>transform.DOMoveX(45, 1); // transform is automatically added as the tween target</code></para>
<para><code>DOTween.IsTweening(transform); // Returns true</code></para>
</summary>
<param name="targetOrId">The target or ID to look for</param>
<param name="alsoCheckIfIsPlaying">If FALSE (default) returns TRUE as long as a tween for the given target/ID is active,
otherwise also requires it to be playing</param>
</member>
<member name="M:DG.Tweening.DOTween.TotalPlayingTweens">
<summary>

View File

@ -11,34 +11,26 @@ using UnityEngine.UI;
public class TempTests : BrainBase
{
private int killCounter = 0;
public Transform target;
private void Awake()
Sequence sequence;
void Start()
{
DOTween.Init(true, true, LogBehaviour.Verbose);
DOTween.SetTweensCapacity(200, 125);
sequence = DOTween.Sequence();
sequence.Append(target.DORotate(new Vector3(0,45f,0), 1f).SetEase(Ease.InOutCubic));
sequence.AppendInterval(2f);
sequence.SetLoops(-1, LoopType.Incremental);
sequence.SetRelative(true);
}
private void Start()
public void Pause()
{
const float Delay = 2;
DOTween.Sequence().AppendInterval(Delay).OnKill(OnKill);
DOTween.Sequence().AppendInterval(Delay).OnKill(OnKill);
sequence.Pause();
}
private void OnKill()
public void Kil()
{
if (++killCounter == 2)
StartCoroutine(Coroutine());
}
private IEnumerator Coroutine()
{
Sequence sequence = DOTween.Sequence().AppendInterval(2).OnKill(() => { });
yield return new WaitForSeconds(1);
Debug.Log("sequence.Kill()");
sequence.Kill(); // IndexOutOfRangeException
sequence.Kill();
}
}

View File

@ -507,7 +507,7 @@ namespace DG.Tweening.Core
if (TogglePause(t)) totInvolved++;
break;
case OperationType.IsTweening:
if (!t.isComplete || !t.autoKill) totInvolved++;
if ((!t.isComplete || !t.autoKill) && (!optionalBool || t.isPlaying)) totInvolved++;
break;
}
}

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.500";
public static readonly string Version = "1.1.510";
///////////////////////////////////////////////
// Options ////////////////////////////////////
@ -875,15 +875,18 @@ namespace DG.Tweening
#region Global Info Getters
/// <summary>
/// Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not).
/// Returns TRUE if a tween with the given ID or target is active.
/// <para>You can also use this to know if a shortcut tween is active for a given target.</para>
/// <para>Example:</para>
/// <para><code>transform.DOMoveX(45, 1); // transform is automatically added as the tween target</code></para>
/// <para><code>DOTween.IsTweening(transform); // Returns true</code></para>
/// </summary>
public static bool IsTweening(object targetOrId)
/// <param name="targetOrId">The target or ID to look for</param>
/// <param name="alsoCheckIfIsPlaying">If FALSE (default) returns TRUE as long as a tween for the given target/ID is active,
/// otherwise also requires it to be playing</param>
public static bool IsTweening(object targetOrId, bool alsoCheckIfIsPlaying = false)
{
return TweenManager.FilteredOperation(OperationType.IsTweening, FilterType.TargetOrId, targetOrId, false, 0) > 0;
return TweenManager.FilteredOperation(OperationType.IsTweening, FilterType.TargetOrId, targetOrId, alsoCheckIfIsPlaying, 0) > 0;
}
/// <summary>

View File

@ -693,14 +693,17 @@
<summary>Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled
(meaning the tweens that could be played or paused, depending on the toggle state)</summary>
</member>
<member name="M:DG.Tweening.DOTween.IsTweening(System.Object)">
<member name="M:DG.Tweening.DOTween.IsTweening(System.Object,System.Boolean)">
<summary>
Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not).
Returns TRUE if a tween with the given ID or target is active.
<para>You can also use this to know if a shortcut tween is active for a given target.</para>
<para>Example:</para>
<para><code>transform.DOMoveX(45, 1); // transform is automatically added as the tween target</code></para>
<para><code>DOTween.IsTweening(transform); // Returns true</code></para>
</summary>
<param name="targetOrId">The target or ID to look for</param>
<param name="alsoCheckIfIsPlaying">If FALSE (default) returns TRUE as long as a tween for the given target/ID is active,
otherwise also requires it to be playing</param>
</member>
<member name="M:DG.Tweening.DOTween.TotalPlayingTweens">
<summary>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.